How to solve vlc playing Youtube video lagging issue?

Viewed 31

Hi guys I was facing a lagging issues when using vlc packages for video playing in python. This would effect the time sleep as the duration is no longer the same when lagging occur.

youtubeURL = "https://www.youtube.com/watch?v=" + youtubeID
duration = self.get_sec(pafy.new(youtubeURL).duration)
print(duration)
try:
     stream = pafy.new(youtubeURL).streams[0]
     self.mediaPlayer = vlc.MediaPlayer(stream.url)
     self.mediaPlayer.play()
     time.sleep(duration + 3)
 
except:
     pass
0 Answers
Related