android - 如何在 Android 中播放任意时间的视频?

标签 android android-videoview

我想在Android videoview 中任意时间播放视频

            _player.setVideoURI(Uri.parse(uri));
    MediaController mc = new MediaController(this);
    _player.setMediaController(mc);
    _player.start();

现在我要设置时间:10:20 寻找文件并播放它(10 分 20 秒)

最佳答案

参见 VideoView.seekTo(int msec)方法

另请注意 doc 中的一件事

The playback position can be adjusted with a call to seekTo(int). 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).

关于android - 如何在 Android 中播放任意时间的视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16035592/

相关文章:

android - 列出云端硬盘中的所有文件

android - 我如何在某个特定位置查看 videoview 内的视频?

android - 在后台播放视频中的音频

android - 如何在Android 4.0.3上运行CTS(兼容性测试套件)

android - 嵌套 fragment 在过渡动画期间消失

Android Jetpack 撰写 : Using google map got crash on map create

fullscreen - Vitamio全屏视频查看

android - 在 Android VideoView 上绘制叠加层(HUD)?

android - 如何在 Android 的 VideoView 中隐藏控件?

安卓调试 : Frame is not available