6


I'm having problems with seeking video. My application should resume video from place where it was stopped last time. So I do this:

videoView.seekTo(bookmark);
videoView.start();
However when it plays I hear sounds form beginning of video for about 1-2 sec. And only after that video seeks to the right position. This behavior is reproducible on HTC Nexus One, HTC G1, HTC evo. But on Samsung galaxy tab all plays normally.

Anybody had similar problems? Is this bug HTC-specific? Thanks in advance.
underwood
  • 278
  • 1
  • 3
  • 9

2 Answers2

3

It is definitely not specific to your phone. I am having the same issue on an HTC Incredible. The seekTo works but there is an audio glitch from the beginning of the clip. Based on the results trying to implement the custom VideoView I guess I won't go to the trouble. I am now going to see if I can mute the very beginning of the clip. I'll report back here if I succeed.

Well, I have given up on this. The only way I have found to mute the beginning of the clip is to mute the phone entirely, which would mute the background music as well. I will assume that this will be fixed sometime in the future since this is a known issue:

http://code.google.com/p/android/issues/detail?id=9135 Issue 9135: MediaPlayer/VideoView and SeekTo before initial playback starts from beginning for few millisecs

charles young
  • 2,269
  • 2
  • 23
  • 38
2

I guess that can be a reason:

from api doc

Although the asynchronuous seekTo(int) call returns right way, the actual seek operation may take a while to finish, especially for audio/video being streamed. When the actual seek operation completes, the internal player engine calls a user supplied OnSeekComplete.onSeekComplete() if an OnSeekCompleteListener has been registered beforehand via setOnSeekCompleteListener(OnSeekCompleteListener).

now Videoview does not have OnSeekCompleteListener exposed and it sucks, but Videoview is just a wrapper class for Mediaplayer and SurfaceView

mishkin
  • 5,932
  • 8
  • 45
  • 64
  • Thanks for an answer. And also thanks for idea about implementing custom VideoView by my own – underwood Feb 08 '11 at 15:27
  • 2
    Tried to implement VideoView by my own. I still having the same problems even if I call `start()` after `onSeekComplete()` is called. First I thought that problem is in `VideoView.mSHCallback` that calls `start()` on OS 1.6 and made fixes. So I call `start()` only after player is prepared and seek position is set. Still having hiccups at startup. – underwood Feb 14 '11 at 15:48
  • Can you please explain how to implemented videoview and still managed to use onSeekComplete(). Thanks – Farhan Nov 05 '11 at 17:02
  • 1
    Where are you quoting the api docs from? All I see for the description of seekTo is: `Seeks to specified time position.` – Peter Ajtai Apr 05 '12 at 20:58
  • mishkin is right, VideoView is just a wrapper and you can customize by making a copy of it, try looking at my answer to [7990784](http://stackoverflow.com/questions/7990784/videoview-not-playing-video-from-desired-position/11938019#11938019). – Peter Tran Aug 13 '12 at 17:35
  • How did you do this "So I call start() only after player is prepared and seek position is set." in the code? Can you please tell me how to do that - I ve added onSeekComplete support but still my onSeekListener is called prematurely – Vrashabh Irde Oct 17 '12 at 17:57