Page 1 of 1

VLC stucks when i try to change media on end reached event

Posted: 19 Jul 2013 14:34
by sets
I use Python bindings for VLC

i need to change media if current came to end, for this i attached an event, but script just stucks on string: media_player.set_media(media) in event_end_reached_listener.

But if i comment attaching an event and execute this function manualy, everything works perfect.

what do i do wrong?

here's a simplified version of code:

Code: Select all

import vlc def event_end_reached_listener(event): media = vlc_instance.media_new("2.avi") media_player.set_media(media) media_player.play() vlc_instance = vlc.Instance() media_player = vlc_instance.media_player_new() media = vlc_instance.media_new("1.avi") em = media_player.event_manager() em.event_attach(vlc.EventType.MediaPlayerEndReached, event_end_reached_listener) media_player.set_media(media) media_player.play()

Re: VLC stucks when i try to change media on end reached eve

Posted: 19 Jul 2013 17:05
by Rémi Denis-Courmont
I would guess that the Python bindings are not reentrant and so you cannot call play from an event callback.

Re: VLC stucks when i try to change media on end reached eve

Posted: 19 Jul 2013 18:01
by sets
is there another way to solve this problem?

PS: Solved it using apscheduler, but i dont like how it looks, its gonna be a better way.
Still waiting for advice

Re: VLC stucks when i try to change media on end reached eve

Posted: 02 Aug 2013 16:40
by OlivierAubert
To precise Rémi's answer, the libvlc API is not reentrant, and since the python bindings directly wrap this API, they are not reentrant either. See for instance viewtopic.php?f=32&t=82502&start=0 for a similar discussion.