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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
klishb-morrisville
Posts: 17
Last visit: Thu Jan 11, 2024 12:08 pm

Embed html5 video in browser control

Post by klishb-morrisville »

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
Posts: 17
Last visit: Thu Jan 11, 2024 12:08 pm

Re: Embed html5 video in browser control

Post by klishb-morrisville »

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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Embed html5 video in browser control

Post by jvierra »

How are you setting the Url?
User avatar
klishb-morrisville
Posts: 17
Last visit: Thu Jan 11, 2024 12:08 pm

Re: Embed html5 video in browser control

Post by klishb-morrisville »

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
Posts: 17
Last visit: Thu Jan 11, 2024 12:08 pm

Re: Embed html5 video in browser control

Post by klishb-morrisville »

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>
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Embed html5 video in browser control

Post by jvierra »

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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Embed html5 video in browser control

Post by jvierra »

Here is that tag:

<meta http-equiv="X-UA-Compatible" content="IE=11" />
User avatar
klishb-morrisville
Posts: 17
Last visit: Thu Jan 11, 2024 12:08 pm

Re: Embed html5 video in browser control

Post by klishb-morrisville »

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.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Embed html5 video in browser control

Post by jvierra »

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

Only IE 11 fully supports HTML 5.
This topic is 6 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked