vlc library on python (linux)

Question:

Good day everyone! You need to write a python program that will play video files from a folder in a vlc player. Moreover, they must be in the playlist, that is, one after the other. The following code is written:

import vlc

mrl1 = '....1.3gp'
mrl2 = '....2.3gp'

Instance = vlc.Instance('--input-repeat=-1', '--fullscreen', '--mouse-hide-timeout=0')

MediaList = Instance.media_list_new()
MediaList.add_media(Instance.media_new(mrl2))
MediaList.add_media(Instance.media_new(mrl1))

list_player = Instance.media_list_player_new()
list_player.set_media_list(MediaList)

list_player.next()

        player.play()

The problem is that after starting the first video spins and then the player closes. That is, the feeling that he is not adding a second video to the list. Everything works with 1 video (repeat, etc.), but how to make sure that all videos are correctly added to the playlist? I rummaged through the Internet, alas, I did not find examples for this function 🙁 Thank you in advance. PS maybe there is a function that simply plays all videos and a specific folder in a row? That would be even better.

Answer:

In general, the problem was really in vlc. Was it crookedly or the OS was crookedly delivered. I reinstalled the OS, installed vlc, did an update and everything is fine 🙂

Scroll to Top
AllEscort