MediaPlayer.seekTo() not seeking to position on Android -
i'm working on app in video paused @ 3 different intervals. after second pause, if button clicked, should start previous location.
eg. if paused @ 1:30, on click of button, goes previous bookmark, i.e. 00:45.
i thought using mediaplayer.seekto() me achieve this. but, seekto() doesn't seek position @ all. currentposition stays same after call seekto();
here's code.
mediaplayer.setonseekcompletelistener(new onseekcompletelistener() { @override public void onseekcomplete(mediaplayer mp) { log.d("vid_player","seek complete. current position: " + mp.getcurrentposition()); mp.start(); } });
and somewhere below, have this...
mediaplayer.seekto(45000);
what problem? why isn't seekto(); working? appreciated.
i testing on android v4.0.3 (ics)
one of reasons why android not able seekto
because of strange encoding of videos. example in mp4 format called "seek points" (i.e. search index) can specified @ begining , @ end of file. if specified @ begining of file seekto
behave correctly. if specified @ end of file seekto nothing , video start begining after seekto
.
this confirmed bug-or-feature in android 4.4.2.
p.s. on youtube videos encoded "seek points" @ begining of file. if have problem seekto
in app first of check app video files youtube. perhaps you'll need reencode videos...
Comments
Post a Comment