我有一个活动,它需要一个网址并使用VideoView播放视频。 这很好用。
但是,视频开始播放前有一段缓冲时间。 因此,VideoView是黑色的。 没有指示缓冲区加载的微调器。
VideoView的参数是否会显示微调器? 如果没有,是否有一些消息在视频开始播放时被广播? 这样我就可以显示自己的微调器并在收到消息时隐藏它。
I have an Activity that takes a url and plays the video with a VideoView. This works fine.
However, there is a buffer time before the video starts playing. Because of this, the VideoView is black. There is no spinner indicating a buffer loading.
Is there a parameter of the VideoView that will show a spinner? If not, is there some message that gets broadcast when the video starts playing? That way I can show my own spinner and hide it when the message is received.
最满意答案
我找到了答案。 在VideoView顶部添加ProgressBar并执行以下操作:
mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mSpinner.setVisibility(View.GONE); } });I've found the answer. Add a ProgressBar over the top of the VideoView and do the following:
mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mSpinner.setVisibility(View.GONE); } });更多推荐
发布评论