I have a new problem now. While playlist handling works like a charm, setting the position does not work anymore.
This is roughly how is done in my code (simplified C code):
Code: Select all
media = libvlc_media_new_path(_vlc, /* m3u path */);
libvlc_media_parse_with_options(media, libvlc_media_parse_local | libvlc_media_parse_network, 10000);
media_list = libvlc_media_subitems(media);
media_list_player = libvlc_media_list_player_new(_vlc);
media_player = libvlc_media_player_new(_vlc);
libvlc_media_list_player_set_media_player(_media_list_player, media_player);
libvlc_media_list_player_set_media_list(_media_list_player, media_list);
libvlc_media_list_player_play_item_at_index(media_list_player, /* previously saved playlist item id */);
libvlc_media_player_set_position(media_player, /* previously saved position (0 to 1.0) */);
Position is saved on some stop event by using libvlc_media_player_get_position, which indeed returns a proper value.
libvlc_media_list_player_play_item_at_index works as expected, but when it comes to libvlc_media_player_set_position, the call has no effect.
I tried few things, including:
- enclosing
within
Code: Select all
if (libvlc_media_player_is_seekable(media_player)) { /* set position here */ }
- loop on
, until it returns true, then set position
used to work in the buggy code I mentioned when opening the thread.
Strange things happen is some cases, eg:
- if I put a sleep of 2 seconds before setting positions, then position is set and track is playing from there, but immediately after it moves to next track
I wonder how the semantics of
in context of media list player.
Thanks and Kind Regards