【问题标题】:how resume playback after stopPlayback? (Android)stopPlayback 后如何恢复播放? (安卓)
【发布时间】:2014-03-30 13:45:02
【问题描述】:

继续这个话题:

How to stop video playing in VideoView programmatically in android?

stopPlayback 后如何恢复播放?

【问题讨论】:

    标签: android


    【解决方案1】:

    停止视频

     // will stop and release the media player instance and move to idle state
     videoView.stopPlayback() 
    

    开始新游戏

    // fist set video path
    videoView.setVideoPath("path"); // will release the previous media player instance if any
    videoView.start() // will start if not in prepare/error state 
    

    暂停当前播放

    // pause the video
    videoView.pause()  // will pause if already playing
    

    从当前暂停位置恢复视频

    // resume the video
    videoView.resume()  // will resume from the last paused state
    

    【讨论】:

    • 我试图做同样的事情已经遵循了你的代码,但不幸的是它从第一个位置而不是 seekTo 位置开始播放视频
    • 谢谢你,你比谷歌做得更好。这个 stopPlayback() 在这个地方没有文档 developer.android.com/reference/android/widget/…,此时。我正在寻找释放播放器的方法。
    【解决方案2】:

    MediaPlayer mediaPlayer = new MediaPlayer();

    mediaPlayer.pause(); 长度=mediaPlayer.getCurrentPosition();

    mediaPlayer.seekTo(长度); mediaPlayer.start();

    【讨论】:

      猜你喜欢
      • 2011-07-21
      • 1970-01-01
      • 2013-12-23
      • 2014-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-10
      • 1970-01-01
      相关资源
      最近更新 更多