所以我尝试在 WPF WebBrowser control 下工作 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>
Please note if I load it remotely it is working fine!
此外,我试图像使用嵌入式资源一样使用index.html .
所以我用过
Stream docStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WpfApplication12.index.html");
wb.NavigateToStream(docStream);
有可能吗? WPF WebBrowser控件是否非常有限,无法使用ActiveX执行本地网页?
任何线索?
附:我试过用WInForm WebBrowser控件做同样的事情 - 没有快乐......
P.S.#2我尝试过这个项目http://www.codeproject.com/Articles/3919/Using-the-WebBrowser-control-simplified,与VLC ActiveX相同的HTML在那里工作得很好 . 但它是在C完成,我根本不知道... :(
附: #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>
P.S.#4此外,我尝试使用this示例动态创建VLC ActiveX控件但完全没有快乐...
1 回答
关于这个评论:
您是否使用Internet Explorer进行此测试?如果是这样,你有插件吗?
我问这个问题是因为WebBrowser控件(至少在WinForms中)支持插件/加载项 not . 仅仅因为在你的成熟浏览器中有效的东西并不一定意味着它可以在WebBrowser中运行 . 如果您使用ActiveX插件进行此VLC集成,则可能无法在WebBrowser控件中使用 .
EDIT in Response to Comment
当你尝试这段代码时(请注意我稍微更改了你的第二行):
...你是说它没有加载HTML at all ?或者是否加载,但您的视频(VLC)控件不起作用?