gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 03:39:28 25 4
gpt4 key购买 nike

我想在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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com