简体   繁体   中英

Vlc player black screen on Xamarin.Forms

the video is playing normally, but if you open another application and go back, vlc will show a black screen with a only sound. (Android 8.0.0, last version of nuget package)

LibVLC libVLC = new LibVLC("--preferred-resolution=-1", " --log-verbose=3", "--no-gnutls-system-trust");
MediaPlayer mediaPlayer;
Media media = new Media(libVLC, playerUrl, FromType.FromLocation);
VideoView1.MediaPlayer = mediaPlayer;
mediaPlayer.Play();

On Android, background support needs a bit of ceremony due to how the OS works. Simply, it means you need to recreate a VideoView and set your existing MediaPlayer on it to have video working when coming back from the background.

Sample demonstrating this is available https://code.videolan.org/mfkl/libvlcsharp-samples/-/tree/master/ForegroundBackground

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM