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

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
sets
New Cone
New Cone
Posts: 2
Joined: 19 Jul 2013 14:31

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

Postby sets » 19 Jul 2013 14:34

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()

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

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

Postby Rémi Denis-Courmont » 19 Jul 2013 17:05

I would guess that the Python bindings are not reentrant and so you cannot call play from an event callback.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sets
New Cone
New Cone
Posts: 2
Joined: 19 Jul 2013 14:31

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

Postby sets » 19 Jul 2013 18:01

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

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

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

Postby OlivierAubert » 02 Aug 2013 16:40

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.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 27 guests