Python VLC MediaListPlayer – Setting Media Player to it
Last Updated :
29 Aug, 2020
In this article we will see how we can set media player to the MediaListPlayer 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. Media list player is used to play multiple media in a row for example playing a series, instead of taking single media it accepts media list. Its working is almost similar like the MediaPlayer object but it is capable of playing list of media. Media player is the base class of all the player available in vlc module.
In order to do this we will use set_media_player
method with the MediaListPlayer object
Syntax : media_list_player.set_media_player(media_player)
Argument : It takes MediaPlayer instance as argument
Return : It returns None
Below is the implementation
import vlc
import time
media_player = vlc.MediaListPlayer()
player = vlc.Instance()
media_list = player.media_list_new()
media = player.media_new( "death_note.mkv" )
media_list.add_media(media)
media_player.set_media_list(media_list)
new = player.media_player_new()
media_player.set_media_player(new)
media_player.play()
|
Output :
Another example
Below is the implementation
import vlc
import time
media_player = vlc.MediaListPlayer()
player = vlc.Instance()
media_list = player.media_list_new()
media = player.media_new( "1.mp4" )
media_list.add_media(media)
media_player.set_media_list(media_list)
new = player.media_player_new()
media_player.set_media_player(new)
media_player.play()
|
Output :
Share your thoughts in the comments
Please Login to comment...