Android MediaPlayer - listeners - dismissDialog help
I am streaming live video. When someone clicks "stream" a progress dialog appears which says, "Loading Video". My problem is I have no way of knowing开发者_如何学编程 when to dismiss the dialog. I would think that it should be dismissed when it starts buffering....but sometimes its buffering for 10 seconds before anything shows on the screen. Is there a way of getting a notification when the video actually shows on the screen? (I can't find one). How do I get my desired result? (And of course with live video, the buffering percent is always 0, so I can't dismiss on 100 percent or anything). My code is basically identical to the Android MediaPlayer demo. Here are my log outputs:
onPrepared called
onBufferingUpdate percent
URL rtsp://174.100.217.64:1935/live/Camera_00-12-AB-18-53-7A/YFtvtTwqdEO1_JbiXHs9ow.sdp
onVideoSizeChanged called
onPrepared called
startVideoPlayback
onBufferingUpdate percent
surfaceChanged called
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
onBufferingUpdate percent 0
**VIDEO IS ACTUALLY SHOWN HERE**
You have to register an OnPreparedListener
in your VideoView
using the setOnPreparedListener
method. These callback will be invoked when the media is loaded and ready to be played.
精彩评论