5

I use MediaPlayer in my android app to play videos. When playback is paused via mediaPlayer.pause() method and I call mediaPlayer.seekTo(msec) the surfaceView I display video in is not updated. It displays the frame where the video was stopped when I called pause() method.

When I start() it again only then it starts from the frame I specified in seekTo() earlier.

How can I force mediaPlayer to update surfaceView when mediaPlayer is paused and not playing?

4

1 回答 1

0

我在姜饼系列操作系统上遇到了同样的问题。我在实际调用 start 的 seekbar 中使用 onProgressChanged 时修复了它,这会将视频更新到正确的位置,但仍将视频保持在同一位置。

public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) 
{
    if(fromUser)
    {
    videoPlayer.seekTo(progress);
    setRemainingTime(progress);
    setPreviousTime(progress);
    playerPausedAt = progress;
    videoPlayer.start();
     }

}

上面的代码对我来说效果很好。

于 2012-12-04T16:51:56.057 回答