質問

I'm using following code to forward streaming media. But it is giving me exception seeking not allowed on media.

Is there any way to seek streaming media in blackberry?

private void forwardPlayer(){
            if(isPlaying){
                try {
                    long prevTime = player.getMediaTime()/1000000;

                    final long newTime = prevTime + 5;
                    if(newTime <= player.getDuration()/1000000){

                        Thread t = new Thread(new Runnable() {

                            public void run() {
                                try {
                                    player.setMediaTime(newTime * 1000000);
                                } catch (final MediaException e) {
                                    UiApplication.getUiApplication().invokeLater(new Runnable() {

                                        public void run() {
                                            Dialog.inform("forward "+e.toString());
                                        }
                                    });
                                }
                            }
                        });
                        t.start();


                    }
                } catch (final Exception e) {
                    UiApplication.getUiApplication().invokeLater(new Runnable() {

                        public void run() {
                            Dialog.inform("forward "+e.toString());
                        }
                    });
                }
            }
        }
役に立ちましたか?

解決

At the risk of stating the obvious, the reason why you cannot seek on your media is almost certainly because it is not possible to do so.

One solution would be to stream the data from your remote media source into a buffer which you can then seek on. Check out Streaming media - Start to finish for reference code.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top