Python - How to play a playlist?

This forum is about all development around libVLC.
Heigler
New Cone
New Cone
Posts: 3
Joined: 11 Jun 2010 15:53

Python - How to play a playlist?

Postby Heigler » 04 May 2011 16:21

Hi,

I'm trying to play something like a python list [file1.mpg, file2.mpg] as a playlist, searching on the web i found a MediaControl object, but it seems doesn't exists anymore. So what the best way to play a playlist using python bidings?
By the way, those videos should be run at fullscreen mode with the classic hotkeys for pause, quit, previous and next buttons, should i map them also? The docs aren't clear.

Thanks in advanced,
Heigler

OlivierAubert
Developer
Developer
Posts: 92
Joined: 08 Mar 2007 15:43

Re: Python - How to play a playlist?

Postby OlivierAubert » 13 May 2011 11:08

The MediaControl API is deprecated. You should use the new libvlc API. For your needs, you will have to use the vlc.MediaListPlayer component, which takes a vlc.MediaList (instanciate through instance.media_list_new()). So basically, you do:

Code: Select all

i=vlc.Instance() l=i.media_list_new() l.insert_media(i.media_new(...)) p=i.media_list_player_new() p.set_media_list(l)

Nepho
Blank Cone
Blank Cone
Posts: 16
Joined: 23 Mar 2015 01:50

Re: Python - How to play a playlist?

Postby Nepho » 23 Mar 2015 01:55

Hi,

This reply is super late, but I have a bug with this feature.
I'm simply trying to fill a playlist with videos, here is my code :

Code: Select all

player = vlc.Instance("E:\\Program Files (x86)\\VideoLAN\\VLC\\plugins") medialist = player.media_list_new() tmp = 0 for i in os.listdir('..\\FolderWithVideos\\'): tmp += 1 print str(tmp) + ': ' + str(i) # for debug purpose medialist.insert_media(player.media_new(i), tmp)
And it works!... For a while. It will randomly bug and never fill the whole playlist.
The error is this one: WindowsError: exception: access violation reading 0xRANDOMADRESS

I'm running it on Windows 7 and I have the latest VLC version. I tried with the latest nightly build, too, but no luck.

Anyone who could help me on this matter?

Edit: Oh, I forgot to precise it, but the error comes from the insert_media(...) call.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 43 guests