【发布时间】:2015-06-02 08:41:58
【问题描述】:
这是我的代码。我在右上角看到了视频,控件本身位于该位置,但主网格背景为空。它应该通过VisualBrush拍摄视频,对吧?我用谷歌搜索了几个样本,它们都使用相同的技巧,但它不起作用......
我也尝试在控件顶部放置一些控件,但没有任何显示,因为我假设它在内部使用 WinForms 控件,这是最顶层的。
那么我如何将这个视频作为背景呢?
<Grid>
<vlc:VlcControl x:Name="myVlcControl" Width="100" Height="100" HorizontalAlignment="Right" VerticalAlignment="Top" />
<Grid>
<Grid.Background>
<VisualBrush Stretch="Uniform">
<VisualBrush.Visual>
<Image Source="{Binding VideoSource, ElementName=myVlcControl}" />
</VisualBrush.Visual>
</VisualBrush >
</Grid.Background>
</Grid>
【问题讨论】:
-
您看到的教程将针对旧版本的 Vlc.DotNet。 2015 年初发布了一个较新的版本,它使用 WPF HwndHost 来显示 WinForms 播放器。只是做了一些探讨,我认为您不能将 VisualBrush 与 HwndHost 一起使用。
-
嗯,这就解释了为什么它不起作用。有什么选择吗?我需要显示 rtsp 流...
-
如果您只需要显示您的提要,那么您可以尝试使用 MediaElement。很确定它支持 RTSP 和 VisualBrushes。
-
当我在 SO 上发现新事物时喜欢它。我正要去试试这个,但它看起来很有希望解决你的问题:jonathanantoine.com/2011/09/24/…。