NoWar
NoWar

Reputation: 37633

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.

And VLC ActiveX is not working...

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!

Also I have tried to use index.html like an embedded resource.

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?

Any clue?

P.S. I've tried to do the same with WInForm WebBrowser control - no joy...

P.S.#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. But it is done in C++ and I dont know it at all... :(

P.S. #3 I've just tried together MS Media Player and VLC ActiveX and MS Media Player is working fine!

  <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>

enter image description here

P.S.#4 Also I have tried to create VLC ActiveX control dynamically using this example but no joy at all...

Upvotes: 4

Views: 2333

Answers (1)

Chris Barlow
Chris Barlow

Reputation: 3314

Regarding this comment:

Please note if I load it remotely it is working fine!

Are you using Internet Explorer for this test? 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. Just because something works in your full-blown browser does not necessarily mean that it will work in the WebBrowser. If you are using an ActiveX plugin for this VLC integration, this likely won't work in the WebBrowser control.

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? Or does it load, but your video (VLC) control doesn't work?

Upvotes: 1

Related Questions