Embed html5 video in browser control

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.
Locked
User avatar
klishb@morrisville.edu
Posts: 17
Joined: Mon Nov 12, 2012 11:30 am

Embed html5 video in browser control

Post by klishb@morrisville.edu » Sat Jul 15, 2017 1:28 pm

I'm creating a GUI with treeview navigation and a browser object on the right. I'm trying to embed local mp4 video in the browser object, but it doesn't appear to be supported. Any way to accomplish this? Seems like it should be possible with HTML5 being the standard at this point.

User avatar
klishb@morrisville.edu
Posts: 17
Joined: Mon Nov 12, 2012 11:30 am

Re: Embed html5 video in browser control

Post by klishb@morrisville.edu » Sat Jul 15, 2017 1:32 pm

If I link to Youtube it seems to play HTML5 video just fine. That tells me it's possible, but maybe I'm not embedding the video correctly in the HTML.

User avatar
jvierra
Posts: 11479
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Embed html5 video in browser control

Post by jvierra » Sat Jul 15, 2017 1:49 pm

How are you setting the Url?

User avatar
klishb@morrisville.edu
Posts: 17
Joined: Mon Nov 12, 2012 11:30 am

Re: Embed html5 video in browser control

Post by klishb@morrisville.edu » Sat Jul 15, 2017 2:15 pm

The browser object points to a different html page and that draws correctly. Within that page I put a hyperlink to another page that is this:


<!DOCTYPE html>
<html>
<body>

<video width="661" height="443">
<source src="file:///C:\MyMovie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>

</body>
</html>

User avatar
klishb@morrisville.edu
Posts: 17
Joined: Mon Nov 12, 2012 11:30 am

Re: Embed html5 video in browser control

Post by klishb@morrisville.edu » Sat Jul 15, 2017 2:18 pm

Actually I originally used this line to get it to autoplay and display controls, but I had edited it out during troubleshooting.

<video width="661" height="443" autoplay controls>

User avatar
jvierra
Posts: 11479
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Embed html5 video in browser control

Post by jvierra » Sat Jul 15, 2017 2:22 pm

HTML 5 renders streaming video and not file based video. You need to use Media Player for MP4 files.

You also cannot use a web site to refer to a file on the local system. The file must reside on the web server that is delivering the video page.

The web browser control defaults to IE 9 I believe and will not correctly render HTML 5. Use a metatag on the page to force IE11. I am not sure that will work but it might.

User avatar
jvierra
Posts: 11479
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Embed html5 video in browser control

Post by jvierra » Sat Jul 15, 2017 2:25 pm

Here is that tag:

<meta http-equiv="X-UA-Compatible" content="IE=11" />

User avatar
klishb@morrisville.edu
Posts: 17
Joined: Mon Nov 12, 2012 11:30 am

Re: Embed html5 video in browser control

Post by klishb@morrisville.edu » Sat Jul 15, 2017 2:58 pm

Yes that works perfectly. Thank you!

Also, this appears to be false:
You also cannot use a web site to refer to a file on the local system. The file must reside on the web server that is delivering the video page.

User avatar
jvierra
Posts: 11479
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Embed html5 video in browser control

Post by jvierra » Sat Jul 15, 2017 3:05 pm

That rule may be relaxed with the browser control. Other rules are enforced for remote sites.

Only IE 11 fully supports HTML 5.

Locked