简体   繁体   中英

HTML & Js make video url open in default device video player app

I'm creating a mediaplayer website where I can play my uploaded videos. I'd like to add a button where an user can click and the devices asks with which app play the video.

I tried something like that:

 window.open("video.mkv", '_blank');

But the browser on my android device just download the video without reading the file as a playable video with an external player.

Is this something related to the browser or I can give a hint to the browser on how to open the file?

I think that if the click on the link directly downloads the file is because the device hasn't any app that has explicitly told the system that it can manage that kind of content.

Or if you use a regular link <a>...</a> instead of a window.open you can add some mime/type information to the link, it maybe helps...

Or keep the window.open and add some extra information as defined here: https://developer.mozilla.org/en-US/docs/Web/API/Window/open

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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