
December 21st, 2012, 02:15 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 1
Time spent in forums: 2 m 43 sec
Reputation Power: 0
|
|
|
Trouble with VLC Binding's event_attach
I'm using the VLC python bindings found here -> http://wiki.videolan.org/Python_bindings
I've also been reading over the excellent API documentation found here -> http://liris.cnrs.fr/advene//download/python-ctypes/doc/
The thing that is currently escaping me though - how do I have an event fire when a song ends? I'm assuming it has to do with EventType.MediaPlayerEndReached - but could anyone out there provide a small example on how to utilize this event? The proper syntax escapes me.
For reference a small bit of code I am trying that is failing:
Code:
>>> mymedia = MediaList()
>>> mymedia.add_media("/path/to/mediafile1")
0
>>> mymedia.add_media("/path/to/mediafile2")
0
>>> player = MediaListPlayer()
>>> player.set_media_list(mymedia)
>>> pevent = player.event_manager()
>>> def event_cb( ev ):
print "Hey look an event..."
>>> pevent.event_attach(EventType().MediaPlayerMediaChanged, event_cb)
-1
When I tell my player to play the media comes up just fine - but the event doesn't fire when I change tracks. I'm assuming it has to do with the returning -1 from the event_attach - what am I doing wrong?
Regards,
~Jeff
|