Reputation: 2576
How to determine that video was fully buffered from URI(Youtube) in MediaPlayer on Android? Is there any callback?
Upvotes: 2
Views: 1406
Reputation: 1632
If you want to see when a video is ready for playback, use this callback. http://developer.android.com/reference/android/media/MediaPlayer.OnPreparedListener.html
onPrepared(MediaPlayer mp)
//Called when the media file is ready for playback.
If you would like to see when a video is 100% buffered, use this callback: 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
Upvotes: 5