December 21st, 2012, 03:15 PM
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:
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?
>>> mymedia = MediaList()
>>> player = MediaListPlayer()
>>> pevent = player.event_manager()
>>> def event_cb( ev ):
print "Hey look an event..."
>>> pevent.event_attach(EventType().MediaPlayerMediaChanged, event_cb)