Can't control media after EndReached event

This forum is about all development around libVLC.
tineras
New Cone
New Cone
Posts: 2
Joined: 30 Jan 2014 22:46

Can't control media after EndReached event

Postby tineras » 09 Mar 2014 14:04

libvlc Version: 2.1.x

I am subscribing to the end reached callback and it is triggered when the media finishes playing. However, I can no longer control the media (play, pause, set time, etc.) after this event fires. Actually, I can't control the media even if I don't subscribe to the EndReached event.

It seems that the media is unloaded or released. Surely there is some way to overcome this without having to release/reload the media player object.

[EDIT] I didn't realize that this was the behavior in VLC as well, so I'll probably have to find a workaround.

Thanks

tags: libvlc_MediaPlayerEndReached, libvlc_event_attach

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: Can't control media after EndReached event

Postby sherington » 09 Mar 2014 17:53

Surely there is some way to overcome this without having to release/reload the media player object.
Not ideal, but you can do libvlc_media_player_stop() then libvlc_media_player_play() without releasing the media player object.

It was not always this way.

Pap
New Cone
New Cone
Posts: 4
Joined: 23 Jan 2014 18:25

Re: Can't control media after EndReached event

Postby Pap » 06 Apr 2014 12:26

I have the same problem and I posted about it some time ago (see this thread for details). I got no answer.
Actually, the EndReached callback seems to be irrelevant. The only workaround I found is to implement my own "media_player_replay" function, which basically calls libvlc_media_player_stop() then libvlc_media_player_play() to replay the sound, pretty much as sherington said. However, this is only a workaround, and it's actually very annoying, as there is often a small delay caused by libvlc_media_player_stop(). Why do we have to stop an ended media player in the first place? (even if events are asynchronous now)

I think this asynchronous thing caused more problems than those solved. Even simple functions don't work as expected. For example, using libvlc_audio_set_volume() doesn't change the volume immediately - sometimes it simply doesn't work at all. Similar issues with libvlc_audio_set_channel(). It is a pity, as I'm afraid such things will cause people new to libVLC to move away and try another library.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests