如何拦截错误并更改 libvlcsharp xamarin 表单的样式 [英] How to Intercept errors and change the style of libvlcsharp xamarin forms

查看:40
本文介绍了如何拦截错误并更改 libvlcsharp xamarin 表单的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在我的 Xamarin.Forms 项目中正确实施了 LibVlcSharp.

I have correctly implemented LibVlcSharp in my Xamarin.Forms project.

using (var _libVLC = new LibVLC())
            {
                var media = new Media(_libVLC, _link, FromType.FromLocation);
                myvideo.MediaPlayer = new MediaPlayer(media)
                {
                    Fullscreen = true
                };
                myvideo.MediaPlayer.Play();
            };

在我的视频播放器中,我从谷歌驱动器流式传输视频,但有时可能会发生媒体出错并显示此错误:

In my video player I stream video from google drive but sometimes it can happen that the media gives error and this error is shown:

流媒体工作,错误的原因可能有很多,但这不是我感兴趣的.我想了解如何拦截此错误自定义此错误标签,但我在文档或在线中未找到任何内容.

Streaming works, there may be many reasons for the error but that's not what interests me. I would like to understand how to intercept this error and customize this error label but I have not found anything in the documentation or online.

我还想知道是否可以更改按钮的样式,我发现此属性 myvideo.PlaybackControls 具有许多其他属性,但我不知道它是否正确以及如何应用它.

I also wanted to know if it was possible to change the style of the buttons, I found this property myvideo.PlaybackControls that has many other properties but I do not know if it is correct and how to apply it.

谢谢

推荐答案

看看

 <Label Text="{TemplateBinding ErrorMessage}" Style="{TemplateBinding MessageStyle}"
                       IsVisible="{TemplateBinding ErrorMessage, Converter={StaticResource ObjectToBoolConverter}}" />

来自 https://code.videolan.org/videolan/LibVLCSharp/-/blob/3.x/LibVLCSharp.Forms/Shared/Themes/Generic.xaml.这是您要修改的 LibVLCSharp 提供的基本样式.

From https://code.videolan.org/videolan/LibVLCSharp/-/blob/3.x/LibVLCSharp.Forms/Shared/Themes/Generic.xaml. This is the base style provided by LibVLCSharp that you want to modify.

您可以按照本指南覆盖样式 https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/styles/xaml/inheritance

You can override the style by following this guide https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/styles/xaml/inheritance

在 XAML 中,这可能是

In XAML, that could be

<Style x:Key="labelStyle" TargetType="Label" BasedOn="{StaticResource MessageStyle}">
   <Setter Property="TextColor" Value="Teal" />
</Style>

我创建了一张票来添加更多关于此https://code.videolan.org/videolan/LibVLCSharp/-/issues/309

I created a ticket to add more docs about this https://code.videolan.org/videolan/LibVLCSharp/-/issues/309

这篇关于如何拦截错误并更改 libvlcsharp xamarin 表单的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆