문제

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