Replay "ended" media
Posted: 28 Mar 2019 01:29
I am probably doing something wrong but I will ask the question anyways. I am trying to repeat something after it ends. The setup I have now is something like this:
The MediaEnd event is fired correctly when the video ends, no issues there but I can't seem to get it to seek back to the start and play the video again for some reason and I am not sure what is going wrong here. What am I missing?
Code: Select all
libvlc_media_player_t* player = libvlc_media_player_new(vlc_instance);
libvlc_event_manager_t* evt_mgr = libvlc_media_player_event_manager(player);
void on_media_end(onst libvlc_event_t* evt, void* user_data) {
libvlc_media_player_set_position(player, 0.0f);
libvlc_media_player_play(player);
}
libvlc_event_attach(evt_mgr, libvlc_MediaPlayerEndReached, on_media_end);
libvlc_media_t* media = libvlc_media_new_location(vlc_instance, "path");
libvlc_media_player_set_media(player, media);
libvlc_media_player_play(this->m_player);