因此,我尝试在WPF WebBrowser 控件 下运行VLC ActiveX v.2 ,并在本地加载它。
并且 VLC ActiveX 不工作......
C#
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
var file = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "index.html");
using (StreamReader sr = new StreamReader(file))
{
String url = sr.ReadToEnd();
wb.NavigateToString(url);
}
}
HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<title></title>
</head>
<body>
<object width="720" height="408" id='vlc1_IE' events="True" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921">
<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2"
width="720" height="408"
id="vlc1">
</embed>
<param name="src" value="http://content.bitsontherun.com/videos/bkaovAYt-52qL9xLP.mp4" />
<param name="ShowDisplay" value="True" />
<param name="AutoPlay" value="False" />
</object>
</body>
</html>
请注意,如果我远程加载它,它工作正常!
我也尝试像嵌入式资源一样使用 index.html。
所以我用过
Stream docStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WpfApplication12.index.html");
wb.NavigateToStream(docStream);
有可能吗?WPF WebBrowser 控件是否非常受限于使用 ActiveX 执行本地网页?
有什么线索吗?
PS 我已经尝试对 WInForm WebBrowser 控件做同样的事情 - 不高兴......
PS#2 我已经尝试过这个项目http://www.codeproject.com/Articles/3919/Using-the-WebBrowser-control-simplified并且与 VLC ActiveX 相同的 HTML 在那里工作正常。但它是用 C++ 完成的,我根本不知道...... :(
PS #3 我刚刚尝试过 MS Media Player 和 VLC ActiveX,MS Media Player 工作正常!
<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2"
width="720" height="408"
id="vlc1">
</embed>
<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"
<param name="URL" value="example.wmv" >
</object>
PS#4 我也尝试使用这个例子动态创建 VLC ActiveX 控件,但一点也不快乐......