I am using the libvlc within a C# Xamarin project to target UWP, Android and iOS. We would like to have an application that is able to play two (remote) streams simultaneously. While this works well on UWP and Android, there is an issue with iOS which I cannot figure out - although I tried everything I can think of.
- I am creating two instances of the libvlc, by calling
Code: Select all
libvlc_new
- Then I pass these handles to calls to That way, I should have two independent player instances.
Code: Select all
libvlc_media_player_new
- Afterwads, I load one URL for each player instance, assign it to the player(s) and start the playback.
Code: Select all
media = libvlc_media_new_location(instanceHandle, url); libvlc_media_player_set_media(playerHandle, media); libvlc_media_release(media); libvlc_media_player_play(playerHandle);
- Until now, everything works fine. Both videos are being played. When I now change the media for one player, it usually works. But as soon as I change the media for the second player one of the calls to libvlc_media_player_stop, libvlc_media_player_set_media or libvlc_media_player_play never returns and blocks the thread I am working in forever.
Currently, the sequence is the following, in pseudocode. I use a queue and a timer to achieve the delay:Code: Select all
libvlc_media_player_set_pause(playerHandle, 1); delay(100ms); libvlc_media_player_stop(playerHandle); delay(100ms); // When the event manager reports the stop state: libvlc_media_player_set_media(playerHandle, newMedia); // When the event manager reports the new media (mediachanged): libvlc_media_player_play(playerHandle);
- I used a custom renderer instead of the UIView (via libvlc_media_player_set_nsobject) to make sure its not caused by an interaction with the UI thread.
- I disabled animations for the UIView acting as render target by calling RemoveAllAnimations, RemoveFromSuperLayer and Actions = null.
- I started a separate thread for every libvlc call that has to do with the media player.
- I added a delay between every libvlc call.
- I stopped the other player first and then restarted both.
- I tried the media list and media list player interfaces - the effect stays the same.
- I tried to completely recreate the player instance, but then the call to libvlc_media_player_release blocks.
- The log output sometimes shows slicing errors when stopping a stream. Not sure if this is related to the issue.
Thanks.