Python VLC MediaList - Getting Media at given Index Last Updated : 26 Aug, 2022 Comments Improve Suggest changes Like Article Like Report In this article we will see how we can get the media at the given index in the MediaList 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. MediaList object contains the multiple media, in other words it has list of media which can be used with MediaListPlayer object to play these multiple media object. Multiple media can be added to the media list object with the help of add_media method, so each media is lying at their respective index in the list. In order to do this we will use item_at_index method with the MediaList object Syntax : media_list.item_at_index(n) Argument : It takes index as argument Return : It returns Media object Below is the implementation Python3 # importing vlc module import vlc # importing time module import time # creating a media player object media_player = vlc.MediaListPlayer() # creating Instance class object player = vlc.Instance() # creating a media list object media_list = vlc.MediaList() # creating a new media media1 = player.media_new("death_note.mkv") # adding media to media list media_list.add_media(media1) # creating a new media media2 = player.media_new("1.mp4") # adding another media media_list.add_media(media2) # setting media list to the media player media_player.set_media_list(media_list) # start playing video media_player.play() # wait so the video can be played for 5 seconds # irrespective for length of video time.sleep(5) # getting media at the index 0 in media list value = media_list.item_at_index(0) # printing value print(value) Output : vlc.Media object at 0x00000248E1B42981 Another example Python3 # importing vlc module import vlc # importing time module import time # creating a media player object media_player = vlc.MediaListPlayer() # creating Instance class object player = vlc.Instance() # creating a media list object media_list = vlc.MediaList() # creating a new media media1 = player.media_new("1.mp4") # adding media to media list media_list.add_media(media1) # creating a new media media2 = player.media_new("death_note.mkv") # adding media to media list media_list.add_media(media2) # setting media list to the media player media_player.set_media_list(media_list) # start playing video media_player.play() # wait so the video can be played for 5 seconds # irrespective for length of video time.sleep(5) # getting media at the index 1 in media list value = media_list.item_at_index(1) # printing value print(value) Output : vlc.Media object at 0x00000248E1B42988 Comment More infoAdvertise with us Next Article Python VLC MediaList - Getting Media at given Index R rakshitarora Follow Improve Article Tags : Python Python vlc-mediaList Practice Tags : python Similar Reads Python VLC MediaList - Getting Index of given item In this article we will see how we can get the index of given media object in the MediaList 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. MediaList object contain 2 min read Python VLC MediaList - Getting Media object from it In this article we will see how we can get media object from the MediaList 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. MediaList object contains the multiple me 2 min read Python VLC MediaList - Adding Media to it In this article we will see how we can add media to the MediaList 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. MediaList object contains the multiple media, in o 2 min read Python VLC MediaList - Inserting Media In this article we will see how we can insert media in the MediaList 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. MediaList object contains the multiple media, i 2 min read Python VLC MediaList - Getting Total Count of Media In this article we will see how we can get the total count of media in the MediaList 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. MediaList object contains the m 2 min read Python VLC MediaListPlayer - Playing Item at given index In this article we will see how we can play the item at the given index in 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 2 min read Python VLC MediaListPlayer - Getting Media Player of it In this article we will see how we can get media player object from 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 2 min read Python VLC Instance - Creating MediaList Instance In this article we will see how we can create a MediaList Instance from the Instance class 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. Instance act as a main object of 2 min read Python VLC MediaPlayer - Getting length of current media In this article we will see how we can get length of the current media 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. MediPlyer object is the ba 2 min read Python VLC MediaPlayer â Getting Media Role In this article we will see how we can get role 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. MediPlyer object is the basic object in vlc modul 2 min read Like