Python-VLC - How to play a video at specific time?

Viewed 407

I have a one-hour video, that I want to only play sections of it when something triggers it.

from vlc import *
import os

os.add_dll_directory('D:\\VLC')
media_player = MediaPlayer()
media = Media("VID.mp4")
media_player.set_media(media)
media_player.play()

x = 0

if x==1:
   # play the video at 2:34
else:
   # play the video at 3:09
1 Answers

Media.add_option('start-time=120.0') TypeError: add_option() missing 1 required positional argument: 'psz_options'

This simply means you are applying this to Media where in your code you have defined media = Media("VID.mp4")
So the add_option should be applied to media

Related