简体   繁体   English

具有WPF WebBrowser控件的本地网页中的VLC ActiveX

[英]VLC ActiveX in a local webpage with WPF WebBrowser control

So I try to get working VLC ActiveX v.2 under WPF WebBrowser control and I load it locally. 所以我尝试在WPF WebBrowser控件下运行VLC ActiveX v.2并在本地加载它。

And VLC ActiveX is not working... 并且VLC ActiveX无法正常工作......

C# 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 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! 请注意,如果我远程加载它工作正常!

Also I have tried to use index.html like an embedded resource. 此外,我试图像使用嵌入式资源一样使用index.html。

So I have used 所以我用过

Stream docStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WpfApplication12.index.html");
wb.NavigateToStream(docStream);

Is it possible to do? 有可能吗? Is WPF WebBrowser control very limited to execute local web page with ActiveX? WPF WebBrowser控件是否非常有限,无法使用ActiveX执行本地网页?

Any clue? 任何线索?

PS I've tried to do the same with WInForm WebBrowser control - no joy... PS我试图用WInForm WebBrowser控件做同样的事情 - 没有快乐......

PS#2 I've tried this project http://www.codeproject.com/Articles/3919/Using-the-WebBrowser-control-simplified and the same HTML with VLC ActiveX is working fine there. PS#2我尝试过这个项目http://www.codeproject.com/Articles/3919/Using-the-WebBrowser-control-simplified ,与VLC ActiveX相同的HTML在那里工作得很好。 But it is done in C++ and I dont know it at all... :( 但它是用C ++完成的,我根本不知道... :(

PS #3 I've just tried together MS Media Player and VLC ActiveX and MS Media Player is working fine! 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 Also I have tried to create VLC ActiveX control dynamically using this example but no joy at all... PS#4此外,我尝试使用示例动态创建VLC ActiveX控件,但根本没有快乐...

Regarding this comment: 关于这个评论:

Please note if I load it remotely it is working fine! 请注意,如果我远程加载它工作正常!

Are you using Internet Explorer for this test? 您是否使用Internet Explorer进行此测试? If so, do you have any plugins? 如果是这样,你有插件吗?

I ask this question because the WebBrowser control (at least in WinForms) does not support plugins / add-ons. 我问这个问题,因为WebBrowser控件(至少在的WinForms) 支持插件/加载项。 Just because something works in your full-blown browser does not necessarily mean that it will work in the WebBrowser. 仅仅因为在你的成熟浏览器中有效的东西并不一定意味着它可以在WebBrowser中运行。 If you are using an ActiveX plugin for this VLC integration, this likely won't work in the WebBrowser control. 如果您使用ActiveX插件进行此VLC集成,则可能无法在WebBrowser控件中使用。

EDIT in Response to Comment 编辑以回应评论

When you try this code (and note that I've changed your second line slightly): 当你尝试这段代码时(请注意我稍微更改了你的第二行):

Stream docStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WpfApplication12.index.html");
wb.NavigateToStream(docStream);

...are you saying that it doesn't load the HTML at all ? ......你说这不加载HTML呢 Or does it load, but your video (VLC) control doesn't work? 或者它是否加载,但您的视频(VLC)控件不起作用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM