翼度科技»论坛 编程开发 .net 查看内容

WPF中使用LibVLCSharp.WPF 播放rtsp

11

主题

11

帖子

33

积分

新手上路

Rank: 1

积分
33
目录

LibVLCSharp.WPF简介

从vlc说起

LibVLC支持的平台:
平台LibVLC包Nuget地址最低操作系统版本WindowsVideoLAN.LibVLC.Windowshttps://www.nuget.org/packages/VideoLAN.LibVLC.Windows/Windows XPUWPVideoLAN.LibVLC.UWPhttps://www.nuget.org/packages/VideoLAN.LibVLC.UWP/Windows 10MacVideoLAN.LibVLC.Machttps://www.nuget.org/packages/VideoLAN.LibVLC.Mac/macOS 10.7AndroidVideoLAN.LibVLC.Androidhttps://www.nuget.org/packages/VideoLAN.LibVLC.Android/Android 2.3iOSVideoLAN.LibVLC.iOShttps://www.nuget.org/packages/VideoLAN.LibVLC.iOS/iOS 8.4tvOSVideoLAN.LibVLC.tvOShttps://www.nuget.org/packages/VideoLAN.LibVLC.tvOS/tvOS 10.2LinuxLinuxGuide:https://code.videolan.org/videolan/LibVLCSharp/-/blob/3.x/docs/linux-setup.md

  • LibVLCSharp是对LibVLC的封装,相当于一个包装器,提供给C#开发人员使用LibVLC的功能。地址:https://code.videolan.org/videolan/LibVLCSharp
  • LibVLCSharp.WPF是LibVLCSharp的WPF实现,封装了vlc:VideoView 这个UI控件,用来播放视频。 LibVLCSharp.WPF可以在.NETCoreApp 3.1 ;.NETFramework 4.6.1+; net6.0+运行时中使用。
虽然  LibVLCSharp 提供跨平台的解决方案,但是本文主要基于 Windows 平台来讨论。
vlc:VideoView基本使用

安装LibVLC

在使用LIibVLCSharp.WPF前必须先安装 LibVLC,否则会报如下错误:
  1. //报错位置:实例化 LibVLC
  2.  LibVLC    _libvlc=new LibVLC();
  3. //Message:
  4. Failed to load required native libraries.
  5. Have you installed the latest LibVLC package from nuget for your target platform?
  6. Search paths include E:\code\WPF\APngApp\bin\Debug\net7.0-windows\libvlc\win-x64\libvlc.dll,E:\code\WPF\APngApp\bin\Debug\net7.0-windows\libvlc\win-x64\libvlccore.dll; E:\code\WPF\APngApp\bin\Debug\net7.0-windows\libvlc\win-x64\libvlc.dll,E:\code\WPF\APngApp\bin\Debug\net7.0-windows\libvlc\win-x64\libvlccore.dll; E:\code\WPF\APngApp\bin\Debug\net7.0-windows\libvlc.dll,
复制代码
LibVLC安装方式:

  • 集成安装:LibVLC 已经打包成了一个package,放在了nuget上面,只需要在项目中安装此VideoLAN.LibVLC.Windows依赖就可以。nuget安装命令:NuGet\Install-Package VideoLAN.LibVLC.Windows
播放rtsp

新建 wpf 应用程序
引入命名空间
  1. xmlns:vlc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
复制代码
xaml 代码
  1. <vlc:VideoView  x:Name="video_main" >
  2. ......
  3. </vlc:VideoView>
复制代码
cs代码
  1. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  2. {
  3. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  4. <Label.Background>
  5.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  6. </Label.Background>
  7. </Label>LibVLC _libvlc = new LibVLC();
  8. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  9. <Label.Background>
  10.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  11. </Label.Background>
  12. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);
  13. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>video_main.Width = this.Width;
  18. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  19. <Label.Background>
  20.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  21. </Label.Background>
  22. </Label>video_main.Height = this.Height;
  23. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  24. <Label.Background>
  25.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  26. </Label.Background>
  27. </Label>video_main.MediaPlayer = player;
  28. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  29. <Label.Background>
  30.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  31. </Label.Background>
  32. </Label>//通过设置宽高比为窗体宽高可达到视频铺满全屏的效果
  33. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>player.AspectRatio = this.Width + ":" + this.Height;
  38. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  39. <Label.Background>
  40.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  41. </Label.Background>
  42. </Label>string url = "rtsp://user:password@192.168.1.120:554/ch1/main/av_stream";
  43. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  44. <Label.Background>
  45.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  46. </Label.Background>
  47. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))
  48. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  49. <Label.Background>
  50.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  51. </Label.Background>
  52. </Label>{
  53. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  54. <Label.Background>
  55.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  56. </Label.Background>
  57. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  58. <Label.Background>
  59.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  60. </Label.Background>
  61. </Label>video_main.MediaPlayer.Play(media);
  62. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  63. <Label.Background>
  64.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  65. </Label.Background>
  66. </Label>}
  67. }
复制代码
截图

概述

LibVLCSharp是对 vlc 的封装,而vlc本身就支持截图的功能,相应的LibVLCSharp也提供了一个 MediaPlayer.TakeSnapshot 的方法用来截图
调用该方法需要传递的参数:

  • num:视频输出数量(通常第一个/仅一个为0)【直译过来的,这个参数具体什么意思尚不太清楚,当前是直接传0】
  • filePath:图片文件存放路径,需要确保文件夹存在并有访问权限,如:D:\A\2.png
  • width:图片的宽度
  • height:图片的高度
  • 若宽高都为0,则生成的图片为视频原始大小;若宽为0或者高为0,则生成的图片为视频原始的纵横比
代码示例

在页面添加一个按钮,在按钮点击事件中处理截图。
xaml:
  1. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>
复制代码
cs:
  1. private void snapshot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>string dirPath = AppDomain.CurrentDomain.BaseDirectory+ "\\snapshot\";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>//string dirPath = "D:\\A\";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>string imgName = DateTime.Now.Ticks+ ".png";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>string filePath = dirPath + imgName;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>bool r = this.video_main.MediaPlayer.TakeSnapshot(0, filePath, (uint)this.video_main.Width, (uint)this.video_main.Height);}
复制代码

  • video_main 就是 VideoView 控件的name
vlc:VideoView进阶使用

空域问题

由于VideoView控件的实现原理是在window上面绑定一个前台窗体(ForegroudWindow),然后在ForegroudWindow中播放视频,所以当需要在window中添加其他控件(如:label,button<vlc:VideoView  x:Name="video_main" >
......
</vlc:VideoView>)的时候不可以使用WPF原始的“并列”写法,而需要使用“层级”写法,即将需要展示的控件写在VideoView控件的"里面",他们形成父子级关系。
上述文字可能比较难以理解, 用代码来分析。首先通过编写如下代码,让视频播放起来:
xaml:
  1. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label>                                            <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>
复制代码
cs:
  1. using LibVLCSharp.Shared;using System;using System.Collections.Generic;using System.Linq;using System.Security.Policy;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;namespace APngApp{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>/// <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>/// Interaction logic for MainWindow.xaml<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>/// <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>public partial class MainWindow : Window<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label>private LibVLC _libvlc;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>public MainWindow()<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  42. <Label.Background>
  43.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  44. </Label.Background>
  45. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  46. <Label.Background>
  47.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  48. </Label.Background>
  49. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  50. <Label.Background>
  51.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  52. </Label.Background>
  53. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  54. <Label.Background>
  55.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  56. </Label.Background>
  57. </Label>InitializeComponent();<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  58. <Label.Background>
  59.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  60. </Label.Background>
  61. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  62. <Label.Background>
  63.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  64. </Label.Background>
  65. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  66. <Label.Background>
  67.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  68. </Label.Background>
  69. </Label>_libvlc=new LibVLC();<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  70. <Label.Background>
  71.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  72. </Label.Background>
  73. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  74. <Label.Background>
  75.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  76. </Label.Background>
  77. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  78. <Label.Background>
  79.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  80. </Label.Background>
  81. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  82. <Label.Background>
  83.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  84. </Label.Background>
  85. </Label>private void Window_Loaded(object sender, RoutedEventArgs e)<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  86. <Label.Background>
  87.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  88. </Label.Background>
  89. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  90. <Label.Background>
  91.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  92. </Label.Background>
  93. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  94. <Label.Background>
  95.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  96. </Label.Background>
  97. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  98. <Label.Background>
  99.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  100. </Label.Background>
  101. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  102. <Label.Background>
  103.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  104. </Label.Background>
  105. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  106. <Label.Background>
  107.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  108. </Label.Background>
  109. </Label> <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  110. <Label.Background>
  111.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  112. </Label.Background>
  113. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  114. <Label.Background>
  115.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  116. </Label.Background>
  117. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  118. <Label.Background>
  119.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  120. </Label.Background>
  121. </Label>videoView.MediaPlayer = player;   <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  122. <Label.Background>
  123.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  124. </Label.Background>
  125. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  126. <Label.Background>
  127.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  128. </Label.Background>
  129. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  130. <Label.Background>
  131.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  132. </Label.Background>
  133. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri("rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream")))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  134. <Label.Background>
  135.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  136. </Label.Background>
  137. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  138. <Label.Background>
  139.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  140. </Label.Background>
  141. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  142. <Label.Background>
  143.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  144. </Label.Background>
  145. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  146. <Label.Background>
  147.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  148. </Label.Background>
  149. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  150. <Label.Background>
  151.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  152. </Label.Background>
  153. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  154. <Label.Background>
  155.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  156. </Label.Background>
  157. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  158. <Label.Background>
  159.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  160. </Label.Background>
  161. </Label>videoView.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  162. <Label.Background>
  163.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  164. </Label.Background>
  165. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  166. <Label.Background>
  167.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  168. </Label.Background>
  169. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  170. <Label.Background>
  171.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  172. </Label.Background>
  173. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  174. <Label.Background>
  175.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  176. </Label.Background>
  177. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  178. <Label.Background>
  179.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  180. </Label.Background>
  181. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  182. <Label.Background>
  183.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  184. </Label.Background>
  185. </Label>}}
复制代码
如果一切正常,将看到如下的画面,并且在VS实时可视化树中将看到  ForegroudWindow 和 MainWindow。


  • 可以看到虽然我们仅仅创建了一个MainWindow,但是确实有两个窗体存在,VideoView控件为程序生成了一个ForegroudWindow。
  • 当我们在VideoView内部编写一个button控件的时候,控件正确的显示出来了,如果我们将这个button移动到和vlc:VideoView并列的位置,按钮将不会显示出来,因为它被ForegroudWindow遮住了,这很诡异,也很有趣,这里就不列举并列写法的代码了。
  • 官方(videolan)把这种情况总结为空域问题,即 Airspace。
  • 不难看出来VideoView控件的这种设计有悖常理,但是据说这是由于LibVLC和vlc的局限性导致的,属于妥协式设计。但是大可放心使用,LibVLCSharp这套解决方案使用非常的广泛,而且截至目前(2023)官方issues仍非常活跃,并且版本也在不断更新中。官方也提供商业版本和付费的技术支持。
宽高比设置

宽高比设置是一个非常神奇的功能,它可以解决:

  • 想让画面全屏显示却出现了间隙,这里的间隙是指画面没有完全覆盖窗体。
  • 想要挤压或者拉伸画面却不知道如何实现。
  • 在异形屏幕上面全屏显示画面,如:画面比例是16:9,想要在分辨率为5:5的屏幕上面全屏显示画面
  • 其他宽高比问题,实际生产中,画面宽高比和屏幕宽高比都是不固定的,甚至可以说很随意,比如海康全景相机,其输出的画面本身就是宽度远高于高度,再比如同一个WPF程序需要在分辨率为1366768和25601440的屏幕分辨率下面全屏显示
  • 这里提到的画面是指rtsp源本身的画面大小
通过如下代码和现象可以很直观的观察到宽高比的神奇之处。
全屏问题

环境:Windows11,屏幕分辨率为2560*1440,未设置缩放


  • 新建一个WPF的窗体,引入VideoView控件,并在Window_ContentRendered 事件中初始化 MediaPlayer 以播放rtsp流。
  • 为尽可能排除其他因素对本问题的影响,将对窗体和VideoView控件做如下初始化设置:

    • 窗体的WindowStyle=None
    • 窗体的ResizeMode=NoResize
    • 窗体的AllowTransparency=true
    • 设置窗体初始宽高为屏幕工作区域,即不包括任务栏部分,此时实际高度小于1440
    • 设置video控件的 宽高为窗体的宽高

xaml代码:
  1. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  42. <Label.Background>
  43.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  44. </Label.Background>
  45. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  46. <Label.Background>
  47.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  48. </Label.Background>
  49. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  50. <Label.Background>
  51.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  52. </Label.Background>
  53. </Label>
复制代码
cs:
  1. using LibVLCSharp.Shared;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;namespace RambleWPF{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>/// <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>/// 视频控件3.xaml 的交互逻辑<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>/// <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>public partial class 视频控件3 : Window<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label>readonly LibVLC _libvlc;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>public 视频控件3()<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  42. <Label.Background>
  43.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  44. </Label.Background>
  45. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  46. <Label.Background>
  47.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  48. </Label.Background>
  49. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  50. <Label.Background>
  51.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  52. </Label.Background>
  53. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  54. <Label.Background>
  55.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  56. </Label.Background>
  57. </Label>InitializeComponent();<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  58. <Label.Background>
  59.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  60. </Label.Background>
  61. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  62. <Label.Background>
  63.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  64. </Label.Background>
  65. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  66. <Label.Background>
  67.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  68. </Label.Background>
  69. </Label>_libvlc = new LibVLC();<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  70. <Label.Background>
  71.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  72. </Label.Background>
  73. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  74. <Label.Background>
  75.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  76. </Label.Background>
  77. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  78. <Label.Background>
  79.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  80. </Label.Background>
  81. </Label>this.WindowStyle = WindowStyle.None;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  82. <Label.Background>
  83.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  84. </Label.Background>
  85. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  86. <Label.Background>
  87.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  88. </Label.Background>
  89. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  90. <Label.Background>
  91.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  92. </Label.Background>
  93. </Label>ResizeMode = ResizeMode.NoResize;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  94. <Label.Background>
  95.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  96. </Label.Background>
  97. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  98. <Label.Background>
  99.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  100. </Label.Background>
  101. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  102. <Label.Background>
  103.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  104. </Label.Background>
  105. </Label>AllowsTransparency = true;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  106. <Label.Background>
  107.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  108. </Label.Background>
  109. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  110. <Label.Background>
  111.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  112. </Label.Background>
  113. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  114. <Label.Background>
  115.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  116. </Label.Background>
  117. </Label>//工作区域就是不包括任务栏的其他区域<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  118. <Label.Background>
  119.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  120. </Label.Background>
  121. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  122. <Label.Background>
  123.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  124. </Label.Background>
  125. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  126. <Label.Background>
  127.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  128. </Label.Background>
  129. </Label>double x = SystemParameters.WorkArea.Width;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  130. <Label.Background>
  131.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  132. </Label.Background>
  133. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  134. <Label.Background>
  135.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  136. </Label.Background>
  137. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  138. <Label.Background>
  139.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  140. </Label.Background>
  141. </Label>//得到屏幕工作区域宽度<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  142. <Label.Background>
  143.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  144. </Label.Background>
  145. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  146. <Label.Background>
  147.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  148. </Label.Background>
  149. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  150. <Label.Background>
  151.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  152. </Label.Background>
  153. </Label>double y = SystemParameters.WorkArea.Height;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  154. <Label.Background>
  155.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  156. </Label.Background>
  157. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  158. <Label.Background>
  159.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  160. </Label.Background>
  161. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  162. <Label.Background>
  163.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  164. </Label.Background>
  165. </Label>win.Width = x;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  166. <Label.Background>
  167.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  168. </Label.Background>
  169. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  170. <Label.Background>
  171.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  172. </Label.Background>
  173. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  174. <Label.Background>
  175.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  176. </Label.Background>
  177. </Label>win.Height = y;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  178. <Label.Background>
  179.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  180. </Label.Background>
  181. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  182. <Label.Background>
  183.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  184. </Label.Background>
  185. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  186. <Label.Background>
  187.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  188. </Label.Background>
  189. </Label>win.Top = 0;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  190. <Label.Background>
  191.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  192. </Label.Background>
  193. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  194. <Label.Background>
  195.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  196. </Label.Background>
  197. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  198. <Label.Background>
  199.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  200. </Label.Background>
  201. </Label>win.Left = 0;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  202. <Label.Background>
  203.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  204. </Label.Background>
  205. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  206. <Label.Background>
  207.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  208. </Label.Background>
  209. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  210. <Label.Background>
  211.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  212. </Label.Background>
  213. </Label>video.Width = x;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  214. <Label.Background>
  215.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  216. </Label.Background>
  217. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  218. <Label.Background>
  219.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  220. </Label.Background>
  221. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  222. <Label.Background>
  223.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  224. </Label.Background>
  225. </Label>video.Height = y;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  226. <Label.Background>
  227.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  228. </Label.Background>
  229. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  230. <Label.Background>
  231.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  232. </Label.Background>
  233. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  234. <Label.Background>
  235.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  236. </Label.Background>
  237. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  238. <Label.Background>
  239.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  240. </Label.Background>
  241. </Label>private void Window_ContentRendered(object sender, EventArgs e)<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  242. <Label.Background>
  243.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  244. </Label.Background>
  245. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  246. <Label.Background>
  247.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  248. </Label.Background>
  249. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  250. <Label.Background>
  251.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  252. </Label.Background>
  253. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  254. <Label.Background>
  255.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  256. </Label.Background>
  257. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  258. <Label.Background>
  259.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  260. </Label.Background>
  261. </Label>string url = "rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  262. <Label.Background>
  263.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  264. </Label.Background>
  265. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  266. <Label.Background>
  267.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  268. </Label.Background>
  269. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  270. <Label.Background>
  271.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  272. </Label.Background>
  273. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  274. <Label.Background>
  275.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  276. </Label.Background>
  277. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  278. <Label.Background>
  279.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  280. </Label.Background>
  281. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  282. <Label.Background>
  283.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  284. </Label.Background>
  285. </Label>video.MediaPlayer = player;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  286. <Label.Background>
  287.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  288. </Label.Background>
  289. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  290. <Label.Background>
  291.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  292. </Label.Background>
  293. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  294. <Label.Background>
  295.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  296. </Label.Background>
  297. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  298. <Label.Background>
  299.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  300. </Label.Background>
  301. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  302. <Label.Background>
  303.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  304. </Label.Background>
  305. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  306. <Label.Background>
  307.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  308. </Label.Background>
  309. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  310. <Label.Background>
  311.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  312. </Label.Background>
  313. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  314. <Label.Background>
  315.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  316. </Label.Background>
  317. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  318. <Label.Background>
  319.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  320. </Label.Background>
  321. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  322. <Label.Background>
  323.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  324. </Label.Background>
  325. </Label>video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  326. <Label.Background>
  327.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  328. </Label.Background>
  329. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  330. <Label.Background>
  331.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  332. </Label.Background>
  333. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  334. <Label.Background>
  335.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  336. </Label.Background>
  337. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  338. <Label.Background>
  339.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  340. </Label.Background>
  341. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  342. <Label.Background>
  343.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  344. </Label.Background>
  345. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  346. <Label.Background>
  347.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  348. </Label.Background>
  349. </Label>}}
复制代码
此时启动程序,如果不出意外,将看到如下的存在“间隙”的画面:

可以看到虽然在初始化的时候我们显示指定了video控件的宽高等于窗体的宽高,但是由于rtsp视频源的画面宽高比和窗体的宽高比不一致,所以出现了“间隙”。要如何解决此问题呢?只需要在Window_ContentRendered中主动设置video.MediaPlayer的宽高比为video控件的宽高即可。
修改后的 Window_ContentRendered 是这样的:
  1. private void Window_ContentRendered(object sender, EventArgs e){<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>string url = "rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>video.MediaPlayer = player;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label>video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>player.AspectRatio = video.Width + ":" + video.Height;}
复制代码
修改后的画面是这样的:


  • 可以看到间隙已经没有了,画面按照预期的方式显示了。
拉伸问题

环境:Windows11,屏幕分辨率为2560*1440,未设置缩放
通过对全屏问题的分析,拉伸问题其实就很好理解了,只需要设置特定的宽高比即可实现,如下代码将对画面纵向和横向进行拉伸
  1. /// /// 挤压和拉伸/// /// /// private void extrusion_Click(object sender, RoutedEventArgs e){<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>video.MediaPlayer.AspectRatio = this.Width + ":" + 100;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>//video.MediaPlayer.AspectRatio = 100 + ":" + video.Height;}
复制代码
响应鼠标点击事件

由于空域问题的存在,视频画面是无法响应鼠标点击事件的,不过有一个曲线救国的办法:

  • 首先设置videoView控件的 isEnable 属性为false
  • 然后在视频画面上面放一个遮罩层,遮罩层背景需要设置为透明,此时点击画面将可以获取到响应的事件
核心代码如下:
初始化VideoView:
  1. private void Window_ContentRendered(object sender, EventArgs e){<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>video.IsEnabled = false;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>string url = "rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>video.MediaPlayer = player;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label>video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label>player.AspectRatio = video.Width + ":" + video.Height;   }
复制代码
遮罩层xaml:
  1. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label> <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label> <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label>  
复制代码
其中,mask_MouseLeftButtonDown 和root_grid_MouseLeftButtonDown 事件可以正常响应。
而video_MouseLeftButtonDown 事件无法响应,因为空域的存在,此事件要么绑定在ForegroudWindow上面,要么可能就没有成功被委托。
播放其他类型

如下代码演示了播放M3U8和本地文件:
  1. private void Window_ContentRendered(object sender, EventArgs e){<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>video.IsEnabled = false;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>//rtsp 播放串<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>//string url = "rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>//m3u8播放串<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>//string url = "http://1257120875.vod2.myqcloud.com/0ef121cdvodtransgzp1257120875/3055695e5285890780828799271/v.f230.m3u8";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label>//播放文件<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label>string url = "C:\\Users\\cml\\Desktop\\temp\\流浪地球2.mp4";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>video.MediaPlayer = player;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  42. <Label.Background>
  43.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  44. </Label.Background>
  45. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  46. <Label.Background>
  47.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  48. </Label.Background>
  49. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  50. <Label.Background>
  51.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  52. </Label.Background>
  53. </Label>video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  54. <Label.Background>
  55.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  56. </Label.Background>
  57. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  58. <Label.Background>
  59.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  60. </Label.Background>
  61. </Label>player.AspectRatio = video.Width + ":" + video.Height;}
复制代码
多视频重叠

在一个窗体中播放两个视频,一个在后,全屏显示,一个在前,小窗播放。并且点击按钮可以切换画面位置。效果如下:

实现思路:

  • 首先,其实只要在xaml中编排好VideoView控件的上下位置就可以实现重叠了 ,越靠上的控件会覆盖在靠下的控件上方。
  • 切换功能的实现需要分别销毁前后两个VideoView的MediaPlayer.Media对象,并重新创建。
代码如下:
xaml:
  1. <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  42. <Label.Background>
  43.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  44. </Label.Background>
  45. </Label>
复制代码
cs:
  1. using LibVLCSharp.Shared;using System;using System.Collections.Generic;using System.Linq;using System.Security.Policy;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;namespace RambleWPF{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  2. <Label.Background>
  3.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  4. </Label.Background>
  5. </Label>/// <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  6. <Label.Background>
  7.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  8. </Label.Background>
  9. </Label>/// 视频控件2.xaml 的交互逻辑<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  10. <Label.Background>
  11.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  12. </Label.Background>
  13. </Label>/// <Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  14. <Label.Background>
  15.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  16. </Label.Background>
  17. </Label>public partial class 视频控件2 : Window<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  18. <Label.Background>
  19.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  20. </Label.Background>
  21. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  22. <Label.Background>
  23.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  24. </Label.Background>
  25. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  26. <Label.Background>
  27.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  28. </Label.Background>
  29. </Label>readonly LibVLC _libvlc;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  30. <Label.Background>
  31.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  32. </Label.Background>
  33. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  34. <Label.Background>
  35.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  36. </Label.Background>
  37. </Label>public 视频控件2()<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  38. <Label.Background>
  39.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  40. </Label.Background>
  41. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  42. <Label.Background>
  43.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  44. </Label.Background>
  45. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  46. <Label.Background>
  47.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  48. </Label.Background>
  49. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  50. <Label.Background>
  51.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  52. </Label.Background>
  53. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  54. <Label.Background>
  55.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  56. </Label.Background>
  57. </Label>InitializeComponent();<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  58. <Label.Background>
  59.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  60. </Label.Background>
  61. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  62. <Label.Background>
  63.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  64. </Label.Background>
  65. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  66. <Label.Background>
  67.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  68. </Label.Background>
  69. </Label>_libvlc = new LibVLC();<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  70. <Label.Background>
  71.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  72. </Label.Background>
  73. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  74. <Label.Background>
  75.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  76. </Label.Background>
  77. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  78. <Label.Background>
  79.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  80. </Label.Background>
  81. </Label>WindowStyle = WindowStyle.None;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  82. <Label.Background>
  83.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  84. </Label.Background>
  85. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  86. <Label.Background>
  87.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  88. </Label.Background>
  89. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  90. <Label.Background>
  91.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  92. </Label.Background>
  93. </Label>ResizeMode = ResizeMode.NoResize;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  94. <Label.Background>
  95.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  96. </Label.Background>
  97. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  98. <Label.Background>
  99.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  100. </Label.Background>
  101. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  102. <Label.Background>
  103.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  104. </Label.Background>
  105. </Label>AllowsTransparency = true;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  106. <Label.Background>
  107.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  108. </Label.Background>
  109. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  110. <Label.Background>
  111.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  112. </Label.Background>
  113. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  114. <Label.Background>
  115.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  116. </Label.Background>
  117. </Label>//工作区域就是不包括任务栏的其他区域<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  118. <Label.Background>
  119.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  120. </Label.Background>
  121. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  122. <Label.Background>
  123.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  124. </Label.Background>
  125. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  126. <Label.Background>
  127.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  128. </Label.Background>
  129. </Label>double x = SystemParameters.WorkArea.Width;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  130. <Label.Background>
  131.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  132. </Label.Background>
  133. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  134. <Label.Background>
  135.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  136. </Label.Background>
  137. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  138. <Label.Background>
  139.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  140. </Label.Background>
  141. </Label>//得到屏幕工作区域宽度<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  142. <Label.Background>
  143.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  144. </Label.Background>
  145. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  146. <Label.Background>
  147.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  148. </Label.Background>
  149. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  150. <Label.Background>
  151.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  152. </Label.Background>
  153. </Label>double y = SystemParameters.WorkArea.Height;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  154. <Label.Background>
  155.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  156. </Label.Background>
  157. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  158. <Label.Background>
  159.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  160. </Label.Background>
  161. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  162. <Label.Background>
  163.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  164. </Label.Background>
  165. </Label>win.Width = x;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  166. <Label.Background>
  167.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  168. </Label.Background>
  169. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  170. <Label.Background>
  171.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  172. </Label.Background>
  173. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  174. <Label.Background>
  175.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  176. </Label.Background>
  177. </Label>win.Height = y;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  178. <Label.Background>
  179.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  180. </Label.Background>
  181. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  182. <Label.Background>
  183.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  184. </Label.Background>
  185. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  186. <Label.Background>
  187.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  188. </Label.Background>
  189. </Label>win.Top = 0;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  190. <Label.Background>
  191.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  192. </Label.Background>
  193. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  194. <Label.Background>
  195.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  196. </Label.Background>
  197. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  198. <Label.Background>
  199.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  200. </Label.Background>
  201. </Label>win.Left = 0;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  202. <Label.Background>
  203.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  204. </Label.Background>
  205. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  206. <Label.Background>
  207.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  208. </Label.Background>
  209. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  210. <Label.Background>
  211.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  212. </Label.Background>
  213. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  214. <Label.Background>
  215.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  216. </Label.Background>
  217. </Label>private void Window_Loaded(object sender, RoutedEventArgs e)<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  218. <Label.Background>
  219.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  220. </Label.Background>
  221. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  222. <Label.Background>
  223.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  224. </Label.Background>
  225. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  226. <Label.Background>
  227.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  228. </Label.Background>
  229. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  230. <Label.Background>
  231.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  232. </Label.Background>
  233. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  234. <Label.Background>
  235.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  236. </Label.Background>
  237. </Label>Canvas.SetLeft(main_video, 100);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  238. <Label.Background>
  239.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  240. </Label.Background>
  241. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  242. <Label.Background>
  243.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  244. </Label.Background>
  245. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  246. <Label.Background>
  247.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  248. </Label.Background>
  249. </Label>Canvas.SetZIndex(main_video, 1);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  250. <Label.Background>
  251.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  252. </Label.Background>
  253. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  254. <Label.Background>
  255.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  256. </Label.Background>
  257. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  258. <Label.Background>
  259.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  260. </Label.Background>
  261. </Label>main_video.Width = 1366;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  262. <Label.Background>
  263.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  264. </Label.Background>
  265. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  266. <Label.Background>
  267.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  268. </Label.Background>
  269. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  270. <Label.Background>
  271.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  272. </Label.Background>
  273. </Label>main_video.Height = 768;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  274. <Label.Background>
  275.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  276. </Label.Background>
  277. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  278. <Label.Background>
  279.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  280. </Label.Background>
  281. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  282. <Label.Background>
  283.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  284. </Label.Background>
  285. </Label>Canvas.SetLeft(small_video, 150);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  286. <Label.Background>
  287.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  288. </Label.Background>
  289. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  290. <Label.Background>
  291.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  292. </Label.Background>
  293. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  294. <Label.Background>
  295.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  296. </Label.Background>
  297. </Label>Canvas.SetTop(small_video, 500);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  298. <Label.Background>
  299.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  300. </Label.Background>
  301. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  302. <Label.Background>
  303.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  304. </Label.Background>
  305. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  306. <Label.Background>
  307.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  308. </Label.Background>
  309. </Label>Canvas.SetZIndex(small_video, 2);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  310. <Label.Background>
  311.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  312. </Label.Background>
  313. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  314. <Label.Background>
  315.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  316. </Label.Background>
  317. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  318. <Label.Background>
  319.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  320. </Label.Background>
  321. </Label>small_video.Width = 300;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  322. <Label.Background>
  323.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  324. </Label.Background>
  325. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  326. <Label.Background>
  327.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  328. </Label.Background>
  329. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  330. <Label.Background>
  331.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  332. </Label.Background>
  333. </Label>small_video.Height = 168.75;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  334. <Label.Background>
  335.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  336. </Label.Background>
  337. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  338. <Label.Background>
  339.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  340. </Label.Background>
  341. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  342. <Label.Background>
  343.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  344. </Label.Background>
  345. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  346. <Label.Background>
  347.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  348. </Label.Background>
  349. </Label>private void Window_ContentRendered(object sender, EventArgs e)<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  350. <Label.Background>
  351.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  352. </Label.Background>
  353. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  354. <Label.Background>
  355.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  356. </Label.Background>
  357. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  358. <Label.Background>
  359.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  360. </Label.Background>
  361. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  362. <Label.Background>
  363.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  364. </Label.Background>
  365. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  366. <Label.Background>
  367.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  368. </Label.Background>
  369. </Label>this.Tag = main_video.Name;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  370. <Label.Background>
  371.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  372. </Label.Background>
  373. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  374. <Label.Background>
  375.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  376. </Label.Background>
  377. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  378. <Label.Background>
  379.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  380. </Label.Background>
  381. </Label>string url = "rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  382. <Label.Background>
  383.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  384. </Label.Background>
  385. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  386. <Label.Background>
  387.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  388. </Label.Background>
  389. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  390. <Label.Background>
  391.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  392. </Label.Background>
  393. </Label>LibVLCSharp.Shared.MediaPlayer player = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  394. <Label.Background>
  395.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  396. </Label.Background>
  397. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  398. <Label.Background>
  399.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  400. </Label.Background>
  401. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  402. <Label.Background>
  403.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  404. </Label.Background>
  405. </Label>main_video.MediaPlayer = player;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  406. <Label.Background>
  407.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  408. </Label.Background>
  409. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  410. <Label.Background>
  411.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  412. </Label.Background>
  413. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  414. <Label.Background>
  415.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  416. </Label.Background>
  417. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  418. <Label.Background>
  419.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  420. </Label.Background>
  421. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  422. <Label.Background>
  423.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  424. </Label.Background>
  425. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  426. <Label.Background>
  427.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  428. </Label.Background>
  429. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  430. <Label.Background>
  431.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  432. </Label.Background>
  433. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  434. <Label.Background>
  435.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  436. </Label.Background>
  437. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  438. <Label.Background>
  439.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  440. </Label.Background>
  441. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  442. <Label.Background>
  443.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  444. </Label.Background>
  445. </Label>main_video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  446. <Label.Background>
  447.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  448. </Label.Background>
  449. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  450. <Label.Background>
  451.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  452. </Label.Background>
  453. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  454. <Label.Background>
  455.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  456. </Label.Background>
  457. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  458. <Label.Background>
  459.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  460. </Label.Background>
  461. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  462. <Label.Background>
  463.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  464. </Label.Background>
  465. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  466. <Label.Background>
  467.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  468. </Label.Background>
  469. </Label>string url2 = "rtsp://xxx:xxx@192.168.1.142:554/Streaming/Channels/1";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  470. <Label.Background>
  471.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  472. </Label.Background>
  473. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  474. <Label.Background>
  475.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  476. </Label.Background>
  477. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  478. <Label.Background>
  479.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  480. </Label.Background>
  481. </Label>LibVLCSharp.Shared.MediaPlayer player2 = new LibVLCSharp.Shared.MediaPlayer(_libvlc);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  482. <Label.Background>
  483.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  484. </Label.Background>
  485. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  486. <Label.Background>
  487.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  488. </Label.Background>
  489. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  490. <Label.Background>
  491.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  492. </Label.Background>
  493. </Label>small_video.MediaPlayer = player2;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  494. <Label.Background>
  495.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  496. </Label.Background>
  497. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  498. <Label.Background>
  499.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  500. </Label.Background>
  501. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  502. <Label.Background>
  503.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  504. </Label.Background>
  505. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url2)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  506. <Label.Background>
  507.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  508. </Label.Background>
  509. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  510. <Label.Background>
  511.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  512. </Label.Background>
  513. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  514. <Label.Background>
  515.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  516. </Label.Background>
  517. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  518. <Label.Background>
  519.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  520. </Label.Background>
  521. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  522. <Label.Background>
  523.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  524. </Label.Background>
  525. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  526. <Label.Background>
  527.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  528. </Label.Background>
  529. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  530. <Label.Background>
  531.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  532. </Label.Background>
  533. </Label>small_video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  534. <Label.Background>
  535.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  536. </Label.Background>
  537. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  538. <Label.Background>
  539.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  540. </Label.Background>
  541. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  542. <Label.Background>
  543.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  544. </Label.Background>
  545. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  546. <Label.Background>
  547.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  548. </Label.Background>
  549. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  550. <Label.Background>
  551.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  552. </Label.Background>
  553. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  554. <Label.Background>
  555.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  556. </Label.Background>
  557. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  558. <Label.Background>
  559.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  560. </Label.Background>
  561. </Label>private void switch_Click(object sender, RoutedEventArgs e)<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  562. <Label.Background>
  563.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  564. </Label.Background>
  565. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  566. <Label.Background>
  567.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  568. </Label.Background>
  569. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  570. <Label.Background>
  571.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  572. </Label.Background>
  573. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  574. <Label.Background>
  575.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  576. </Label.Background>
  577. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  578. <Label.Background>
  579.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  580. </Label.Background>
  581. </Label>string url = "rtsp://xxx:xxx@192.168.1.120:554/ch1/main/av_stream";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  582. <Label.Background>
  583.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  584. </Label.Background>
  585. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  586. <Label.Background>
  587.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  588. </Label.Background>
  589. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  590. <Label.Background>
  591.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  592. </Label.Background>
  593. </Label>string url2 = "rtsp://xxx:xxx@192.168.1.142:554/Streaming/Channels/1";<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  594. <Label.Background>
  595.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  596. </Label.Background>
  597. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  598. <Label.Background>
  599.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  600. </Label.Background>
  601. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  602. <Label.Background>
  603.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  604. </Label.Background>
  605. </Label>if (this.Tag as string != main_video.Name)<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  606. <Label.Background>
  607.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  608. </Label.Background>
  609. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  610. <Label.Background>
  611.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  612. </Label.Background>
  613. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  614. <Label.Background>
  615.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  616. </Label.Background>
  617. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  618. <Label.Background>
  619.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  620. </Label.Background>
  621. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  622. <Label.Background>
  623.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  624. </Label.Background>
  625. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  626. <Label.Background>
  627.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  628. </Label.Background>
  629. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  630. <Label.Background>
  631.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  632. </Label.Background>
  633. </Label>this.Tag = main_video.Name;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  634. <Label.Background>
  635.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  636. </Label.Background>
  637. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  638. <Label.Background>
  639.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  640. </Label.Background>
  641. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  642. <Label.Background>
  643.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  644. </Label.Background>
  645. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  646. <Label.Background>
  647.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  648. </Label.Background>
  649. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  650. <Label.Background>
  651.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  652. </Label.Background>
  653. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  654. <Label.Background>
  655.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  656. </Label.Background>
  657. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  658. <Label.Background>
  659.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  660. </Label.Background>
  661. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  662. <Label.Background>
  663.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  664. </Label.Background>
  665. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  666. <Label.Background>
  667.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  668. </Label.Background>
  669. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  670. <Label.Background>
  671.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  672. </Label.Background>
  673. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  674. <Label.Background>
  675.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  676. </Label.Background>
  677. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  678. <Label.Background>
  679.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  680. </Label.Background>
  681. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  682. <Label.Background>
  683.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  684. </Label.Background>
  685. </Label>main_video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  686. <Label.Background>
  687.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  688. </Label.Background>
  689. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  690. <Label.Background>
  691.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  692. </Label.Background>
  693. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  694. <Label.Background>
  695.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  696. </Label.Background>
  697. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  698. <Label.Background>
  699.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  700. </Label.Background>
  701. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  702. <Label.Background>
  703.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  704. </Label.Background>
  705. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  706. <Label.Background>
  707.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  708. </Label.Background>
  709. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  710. <Label.Background>
  711.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  712. </Label.Background>
  713. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  714. <Label.Background>
  715.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  716. </Label.Background>
  717. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url2)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  718. <Label.Background>
  719.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  720. </Label.Background>
  721. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  722. <Label.Background>
  723.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  724. </Label.Background>
  725. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  726. <Label.Background>
  727.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  728. </Label.Background>
  729. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  730. <Label.Background>
  731.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  732. </Label.Background>
  733. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  734. <Label.Background>
  735.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  736. </Label.Background>
  737. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  738. <Label.Background>
  739.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  740. </Label.Background>
  741. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  742. <Label.Background>
  743.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  744. </Label.Background>
  745. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  746. <Label.Background>
  747.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  748. </Label.Background>
  749. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  750. <Label.Background>
  751.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  752. </Label.Background>
  753. </Label>small_video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  754. <Label.Background>
  755.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  756. </Label.Background>
  757. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  758. <Label.Background>
  759.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  760. </Label.Background>
  761. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  762. <Label.Background>
  763.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  764. </Label.Background>
  765. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  766. <Label.Background>
  767.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  768. </Label.Background>
  769. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  770. <Label.Background>
  771.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  772. </Label.Background>
  773. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  774. <Label.Background>
  775.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  776. </Label.Background>
  777. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  778. <Label.Background>
  779.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  780. </Label.Background>
  781. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  782. <Label.Background>
  783.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  784. </Label.Background>
  785. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  786. <Label.Background>
  787.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  788. </Label.Background>
  789. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  790. <Label.Background>
  791.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  792. </Label.Background>
  793. </Label>else<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  794. <Label.Background>
  795.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  796. </Label.Background>
  797. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  798. <Label.Background>
  799.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  800. </Label.Background>
  801. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  802. <Label.Background>
  803.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  804. </Label.Background>
  805. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  806. <Label.Background>
  807.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  808. </Label.Background>
  809. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  810. <Label.Background>
  811.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  812. </Label.Background>
  813. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  814. <Label.Background>
  815.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  816. </Label.Background>
  817. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  818. <Label.Background>
  819.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  820. </Label.Background>
  821. </Label>this.Tag = small_video.Name;<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  822. <Label.Background>
  823.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  824. </Label.Background>
  825. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  826. <Label.Background>
  827.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  828. </Label.Background>
  829. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  830. <Label.Background>
  831.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  832. </Label.Background>
  833. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  834. <Label.Background>
  835.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  836. </Label.Background>
  837. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url2)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  838. <Label.Background>
  839.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  840. </Label.Background>
  841. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  842. <Label.Background>
  843.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  844. </Label.Background>
  845. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  846. <Label.Background>
  847.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  848. </Label.Background>
  849. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  850. <Label.Background>
  851.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  852. </Label.Background>
  853. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  854. <Label.Background>
  855.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  856. </Label.Background>
  857. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  858. <Label.Background>
  859.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  860. </Label.Background>
  861. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  862. <Label.Background>
  863.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  864. </Label.Background>
  865. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  866. <Label.Background>
  867.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  868. </Label.Background>
  869. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  870. <Label.Background>
  871.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  872. </Label.Background>
  873. </Label>main_video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  874. <Label.Background>
  875.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  876. </Label.Background>
  877. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  878. <Label.Background>
  879.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  880. </Label.Background>
  881. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  882. <Label.Background>
  883.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  884. </Label.Background>
  885. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  886. <Label.Background>
  887.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  888. </Label.Background>
  889. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  890. <Label.Background>
  891.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  892. </Label.Background>
  893. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  894. <Label.Background>
  895.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  896. </Label.Background>
  897. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  898. <Label.Background>
  899.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  900. </Label.Background>
  901. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  902. <Label.Background>
  903.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  904. </Label.Background>
  905. </Label>using (LibVLCSharp.Shared.Media media = new Media(_libvlc, new Uri(url)))<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  906. <Label.Background>
  907.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  908. </Label.Background>
  909. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  910. <Label.Background>
  911.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  912. </Label.Background>
  913. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  914. <Label.Background>
  915.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  916. </Label.Background>
  917. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  918. <Label.Background>
  919.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  920. </Label.Background>
  921. </Label>{<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  922. <Label.Background>
  923.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  924. </Label.Background>
  925. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  926. <Label.Background>
  927.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  928. </Label.Background>
  929. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  930. <Label.Background>
  931.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  932. </Label.Background>
  933. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  934. <Label.Background>
  935.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  936. </Label.Background>
  937. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  938. <Label.Background>
  939.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  940. </Label.Background>
  941. </Label>small_video.MediaPlayer.Play(media);<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  942. <Label.Background>
  943.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  944. </Label.Background>
  945. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  946. <Label.Background>
  947.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  948. </Label.Background>
  949. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  950. <Label.Background>
  951.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  952. </Label.Background>
  953. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  954. <Label.Background>
  955.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  956. </Label.Background>
  957. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  958. <Label.Background>
  959.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  960. </Label.Background>
  961. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  962. <Label.Background>
  963.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  964. </Label.Background>
  965. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  966. <Label.Background>
  967.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  968. </Label.Background>
  969. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  970. <Label.Background>
  971.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  972. </Label.Background>
  973. </Label><Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  974. <Label.Background>
  975.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  976. </Label.Background>
  977. </Label>}<Label  Width="70"  Height="70" Margin="5,0,5,0" Name="snapshot" MouseLeftButtonDown="snapshot_MouseLeftButtonDown"  Cursor="Hand">
  978. <Label.Background>
  979.     <ImageBrush ImageSource="/Images/small_video_hide.png" Stretch="Uniform"/>
  980. </Label.Background>
  981. </Label>}}
复制代码

  • small_video显示在前,为小屏;main_video显示在后,全屏显示
画中画

画中画本质上还是视频的重叠,可以参考视频重叠的实现思路实现。
引用


技术交流QQ群:1158377441 欢迎关注我的微信公众号,后续博文将在公众号首发:

来源:https://www.cnblogs.com/Naylor/archive/2023/02/14/17118993.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

举报 回复 使用道具