【发布时间】:2014-12-19 21:28:52
【问题描述】:
我正在尝试通过 Vlc.DotNet 在 WPF 中使用 VLC。我已经成功地让 Vlc.DotNet 在 Winforms 中工作,但到目前为止 WPF 没有成功。
我没有收到任何错误,但我也没有收到视频...只是一个空白的白色窗格。
这是我非常简单的 XAML:
<Window x:Class="VLC.Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Closing="Window_Closing">
<Grid x:Name="Grid1">
</Grid>
</Window>
这是我用来插入和启动 Vlc Wpf 控件的代码隐藏。
public MainWindow()
{
VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64;
VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64;
VlcContext.StartupOptions.IgnoreConfig = true;
VlcContext.Initialize();
InitializeComponent();
var vlcPlayer = new VlcControl();
var media = new LocationMedia("rtsp://admin:12345@192.168.42.200:554/MediaInput/h264");
Grid1.Children.Add(vlcPlayer);
var vlcBinding = new Binding("VideoSource");
vlcBinding.Source = vlcPlayer;
var vImage = new Image();
vImage.SetBinding(Image.SourceProperty, vlcBinding);
var vBrush = new VisualBrush();
vBrush.TileMode = TileMode.None;
vBrush.Stretch = Stretch.Uniform;
vBrush.Visual = vImage;
Grid1.Background = vBrush;
vlcPlayer.Play();
}
有人觉得这有什么问题吗?
使用 Vlc 2.1.5 win32
【问题讨论】:
-
您看过 WPF 示例:vlcdotnet.codeplex.com/wikipage?title=Wpf 吗?