隐藏所有 LibVLCSharp 元素
Hide all LibVLCSharp elements
我正在开发一个有直播视频的应用程序,
我设法实现了 LibVLCSharp,但我有一个问题,我需要从屏幕上删除所有内容,这只是缺少:
这是我的代码:
XAML
<shared:MediaPlayerElement
x:Name="MediaPlayerElementPlayer"
EnableRendererDiscovery="True"
HorizontalOptions="FillAndExpand"
LibVLC="{Binding LibVLC}"
MediaPlayer="{Binding MediaPlayer}"
VerticalOptions="Start">
<shared:MediaPlayerElement.PlaybackControls>
<shared:PlaybackControls
IsAspectRatioButtonVisible="False"
IsAudioTracksSelectionButtonVisible="False"
IsCastButtonVisible="False"
IsClosedCaptionsSelectionButtonVisible="False"
IsPlayPauseButtonVisible="False"
IsRewindButtonVisible="False"
IsSeekBarVisible="False"
IsSeekButtonVisible="False"
IsSeekEnabled="False"
IsStopButtonVisible="False"
KeepScreenOn="False"
MainColor="{StaticResource Cor8}"
ShowAndHideAutomatically="True" />
</shared:MediaPlayerElement.PlaybackControls>
</shared:MediaPlayerElement>
C#
private void ConstruirLibVLC()
{
Core.Initialize();
Contexto.LibVLC = new LibVLC(enableDebugLogs: true);
Media media = new Media(Contexto.LibVLC, new Uri(TransmissaoAoVivoHelper.UrlTransmissaoAoVivo));
Contexto.MediaPlayer = new MediaPlayer(media)
{
EnableHardwareDecoding = true,
};
media.Dispose();
Contexto.MediaPlayer.Play();
}
不太清楚你的意思。如果您只想拥有视频播放器,为什么不使用 VideoView 元素而不是 MediaPlayerElement(这是一个已经嵌入常用控件的视图,例如按钮、搜索栏...)
我正在开发一个有直播视频的应用程序, 我设法实现了 LibVLCSharp,但我有一个问题,我需要从屏幕上删除所有内容,这只是缺少:
这是我的代码:
XAML
<shared:MediaPlayerElement
x:Name="MediaPlayerElementPlayer"
EnableRendererDiscovery="True"
HorizontalOptions="FillAndExpand"
LibVLC="{Binding LibVLC}"
MediaPlayer="{Binding MediaPlayer}"
VerticalOptions="Start">
<shared:MediaPlayerElement.PlaybackControls>
<shared:PlaybackControls
IsAspectRatioButtonVisible="False"
IsAudioTracksSelectionButtonVisible="False"
IsCastButtonVisible="False"
IsClosedCaptionsSelectionButtonVisible="False"
IsPlayPauseButtonVisible="False"
IsRewindButtonVisible="False"
IsSeekBarVisible="False"
IsSeekButtonVisible="False"
IsSeekEnabled="False"
IsStopButtonVisible="False"
KeepScreenOn="False"
MainColor="{StaticResource Cor8}"
ShowAndHideAutomatically="True" />
</shared:MediaPlayerElement.PlaybackControls>
</shared:MediaPlayerElement>
C#
private void ConstruirLibVLC()
{
Core.Initialize();
Contexto.LibVLC = new LibVLC(enableDebugLogs: true);
Media media = new Media(Contexto.LibVLC, new Uri(TransmissaoAoVivoHelper.UrlTransmissaoAoVivo));
Contexto.MediaPlayer = new MediaPlayer(media)
{
EnableHardwareDecoding = true,
};
media.Dispose();
Contexto.MediaPlayer.Play();
}
不太清楚你的意思。如果您只想拥有视频播放器,为什么不使用 VideoView 元素而不是 MediaPlayerElement(这是一个已经嵌入常用控件的视图,例如按钮、搜索栏...)