如何确定 Android 上的 MediaPlayer 中的视频已从 URI(Youtube) 完全缓冲? 有回调吗?
最佳答案
如果您想查看视频何时可以播放,请使用此回调。 http://developer.android.com/reference/android/media/MediaPlayer.OnPreparedListener.html
onPrepared(MediaPlayer mp)
//Called when the media file is ready for playback.
如果您想查看视频何时 100% 缓冲,请使用此回调: http://developer.android.com/reference/android/media/MediaPlayer.OnBufferingUpdateListener.html
public abstract void onBufferingUpdate (MediaPlayer mp, int percent)
Added in API level 1 Called to update status in buffering a media stream received through progressive HTTP download. The received buffering percentage indicates how much of the content has been buffered or played. For example a buffering update of 80 percent when half the content has already been played indicates that the next 30 percent of the content to play has been buffered.
Parameters mp the MediaPlayer the update pertains to percent the percentage (0-100) of the content that has been buffered or played thus far
关于android - 如何确定 Android 上的 MediaPlayer 中的视频已缓冲?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17650097/