Search code examples
iosxamarinvlclibvlclibvlcsharp

VLC Xamarin iOS bindings. Can't play several media items with one player


I have an app that uses VLC media player bindings in Xamarin iOS When I play instantiate a MediaPlayer object, and play one media item as follows:

        var media = new Media(libVLC, new Uri(mediaItem.MediaUri));
        await media.Parse();
        Player.Play(media);

The player works perfectly well. But once I want to play the next media item, that is I use the same player to play a new instance of Media, The media player blocks my UI. It just hangs there, without any error message.

I would love to use MediaList, but as mentioned here, the functionality is limited, and if I will like to play a specific item in my list I wouldn't be able to.

Please can someone help ?


Solution

  • I believe this was solved on the Discord chat.

    The problematic code isn't included in the Q (please always include full repro code), but it turns out to be the LibVLC callback issue. When calling back into LibVLC from a LibVLC event, use a threadpool scheduler.