2015-06-02 55 views
0

有我的代码。我在控制本身所在的右上角看到视频,但主网格背景是空的。它应该通过VisualBrush拍摄视频,对吧?我GOOGLE了几个样本,他们都使用相同的技巧,但它不工作...Vlc.DotNet WPF视频背景问题

我也试图把一些控制顶部的控制,但没有显示通过,因为我假设它使用内部的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> 
+0

你见过将是老版Vlc.DotNet的教程。 2015年初发布了一个更新的版本,该版本使用WPF HwndHost来显示WinForms播放器。只是做了一些探讨,我不认为你可以使用VisualBrush和HwndHost。 – goobering

+0

好吧,这解释了为什么它不起作用。任何替代品?我需要显示rtsp流... –

+0

如果您只需要显示您的Feed,那么您可以尝试使用MediaElement。很确定它支持RTSP和VisualBrushes。 – goobering

回答

0

MediaElement的支持RTSP得很好,但它可能不支持你想与之合作的编码/容器。下面产生一个工作流的MediaElement,并且使用VisualBrush画与MediaElement的网格的背景:

<Grid x:Name="LayoutRoot"> 
    <Grid.RowDefinitions> 
     <RowDefinition /> 
     <RowDefinition /> 
    </Grid.RowDefinitions> 

    <MediaElement x:Name="MyPlayer" 
       Width="640" 
       Height="480" 
       LoadedBehavior="Play" 
       Source="rtsp://granton.ucs.ed.ac.uk/domsdemo/v2003-1.wmv" /> 

    <Grid Grid.Row="1" 
     Width="320" 
     Height="240"> 
     <Grid.Background> 
      <VisualBrush Stretch="Uniform" Visual="{Binding ElementName=MyPlayer}" /> 
     </Grid.Background> 
    </Grid> 
</Grid> 
+0

是的,似乎MediaElement不支持RTSP + H.264(即我的相机正在生产) –