Question play video on webbrowser

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
491
Programming Experience
3-5
i try to navigate to a mp4 video link in code on a webbrowser. but instead of playing the video, it popup a download link. How do i make it play instead?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,493
Location
Sydney, Australia
Programming Experience
10+
A browser does not understand MP4 files the way it does a JPG or the like. You would need to load some HTML code that could play the file. MP4 is also not a format that HTML 4.x understands natively, so your HTML would have to use some media player to actually play the file. Here are some examples:


Keep in mind that Flash Player is probably not supported or soon won't be.

HTML 5 does understand MP4 and you can play a file like so:


You would need to craft the appropriate HTML code and, assuming that you're using the WebBrowser control, assign it to the (I believe) DocumentText property. That said, I'm not 100% sure that the WebBrowser control supports HTML 5. If it doesn't, you'd have to use a WebView2 instead.
 
Top Bottom