问题
In my application am showing live video streaming, for that i have used LibVLC library. Everything is working properly.
Before playing video i want to show progress dialog, because until video gets start LibVLC surface(black screen) appears, because of which user might think video is not loading.
I tried to add progress dialog, which appears on video streaming start, but on LibVLC's EventHandler.MediaPlayerPlaying
event I dismiss it assuming video gets started,but after this event for next 5-10 seconds video buffering is happening.
How can i derive that video buffering is completed so on that event i can dismiss progress dialog?
回答1:
Use the media state from the player.
0 nothing,
1 opening,
2 buffering,
3 playing,
4 paused,
5 stopped,
6 ended,
7 error
if not self.player.get_media():
print "fail"
return
else:
media_state = self.player.get_state()
while media_state != 3 and media_state != 4:
media_state = self.player.get_state()
print repr(media_state)
print repr(media_state)
来源:https://stackoverflow.com/questions/38868822/progress-dialog-in-libvlc-android