在API 23中添加了PlaybackParams以支持MediaPlayer。
有人对setSpeed
中的PlaybackParams
方法有什么好运吗?我正在尝试减慢MediaPlayer上的视频并获得100错误(MEDIA_ERROR_SERVER_DIED
):
参考文献:
答案 0 :(得分:1)
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
//Log.d(TAG, "onPrepared Start: " + mPlaybackState + " LeanbackPlaybackState:" + LeanbackPlaybackState.PLAYING );
if (mPlaybackState == LeanbackPlaybackState.FastForward) {
mp.setPlaybackParams(new PlaybackParams().setSpeed(3.0f));
mVideoView.start();
Log.d(TAG, "onPrepared: if " + mPlaybackState + " LeanbackPlaybackState:" + LeanbackPlaybackState.FastForward);
}
else
if (mPlaybackState == LeanbackPlaybackState.PLAYING){
mp.setPlaybackParams(new PlaybackParams().setSpeed(1.0f));
mVideoView.start();
Log.d(TAG, "onPrepared: else " + mPlaybackState + " LeanbackPlaybackState:" +LeanbackPlaybackState.PLAYING);
}
}
});