简体   繁体   English

Xamarin.Forms 上的 Vlc 播放器黑屏

[英]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.视频正常播放,但是如果您打开另一个应用程序并返回,vlc 将显示一个只有声音的黑屏。 (Android 8.0.0, last version of nuget package) (Android 8.0.0,nuget 包的最新版本)

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.在 Android 上,由于操作系统的工作方式,后台支持需要一些仪式。 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.简而言之,这意味着您需要重新创建VideoView并在其上设置现有的MediaPlayer ,以便在从后台返回时让视频正常工作。

Sample demonstrating this is available https://code.videolan.org/mfkl/libvlcsharp-samples/-/tree/master/ForegroundBackground演示此内容的示例可用https://code.videolan.org/mfkl/libvlcsharp-samples/-/tree/master/ForegroundBackground

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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