Python VLC MediaPlayer – Getting Instance of it
In this article we will see how we can get the instance of the 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. We can create a MediaPlayer object with the help of MediaPlayer method.
In order to do this we will use get_instance method with the MediaPlayer object Syntax : media_player.get_instance() Argument : It takes no argument Return : It returns the associated Instance with it
Below is the implementation
Python3
import time
media_player = vlc.MediaPlayer("death_note.mkv")
media_player.play()
time.sleep( 5 )
inst = media_player.get_instance()
print ("Media player Instance : " + str (inst))
|
Output :
Media player Instance : <vlc.Instance object at 0x000001DE3184EE08
Another example
Python3
import vlc
import time
media_player = vlc.MediaPlayer()
inst = media_player.get_instance()
print ("Media player Instance : " + str (inst))
|
Output :
Media player Instance : <vlc.Instance object at 0x000001AD5452ED48
Last Updated :
11 Apr, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...