The a return time when VLC plays the HTTP stream is not correct
Posted: 29 May 2018 05:07
This is my code, which is used to play a HTTP video and listen to the current playtime.
When playing a video without sound, its output is not the same as expected, and it can not get the right time to play.# -*- coding: utf-8 -*-
import vlc[*]
import sys
import os
def MediaPlayerTimeChanged(event, *args, **kwds):
print event.u.new_time
if __name__ == "__main__":
t_instance = vlc.Instance("-q")
t_mediaPlayer = t_instance.media_player_new()
vlc_events = t_mediaPlayer.event_manager()
vlc_events.event_attach(vlc.EventType.MediaPlayerTimeChanged, MediaPlayerTimeChanged, None)
t_movie_url = "http://pic.qiantucdn.com/58pic/video/27 ... 023_69.mp4"
t_media = t_instance.media_new_location(t_movie_url)
t_mediaPlayer.set_media(t_media)
t_mediaPlayer.play()
os.system("pause")
Press any key to continue . . . 250
250
250
250
250
250
250
250
250
250
250
250
250
.....