Python VLC – Creating MediaPlayer object
Last Updated :
11 Apr, 2022
In this article we will see how we can create a MediaPlayer object in the python vlc module. VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. MediaPlayer object is the basic object in vlc module for playing the video. MediaPlayer class is the basic class it is used to play single video at a time.
In order to do this we will use MediaPlayer method Syntax : MediaPlayer(video_uri) Argument : It takes video uri as optional argument Return : It returns MediaPlayer object
Below is the implementation
Python3
import vlc
import time
import time
media_player = vlc.MediaPlayer()
print ( type (media_player))
|
Output :
class 'vlc.MediaPlayer'
Another example
Python3
import vlc
import time
media_player = vlc.MediaPlayer(" 1.mp4 ")
media_player.play()
time.sleep( 5 )
|
Output :
Share your thoughts in the comments
Please Login to comment...