admin管理员组文章数量:1301821
I am trying to build a video player in website where i want to play the local video defaultly when page first loads without choosing it from the file picker. Where path of the video is known I tried the following code where i am able to play the audio not video. Please help me with this thanks
<video controls autoplay>
<source src="small.mp4" type="video/mp4">
</video>
here the small.mp4 video is stored in the same folder of the html file.
I am trying to build a video player in website where i want to play the local video defaultly when page first loads without choosing it from the file picker. Where path of the video is known I tried the following code where i am able to play the audio not video. Please help me with this thanks
<video controls autoplay>
<source src="small.mp4" type="video/mp4">
</video>
here the small.mp4 video is stored in the same folder of the html file.
Share Improve this question asked Aug 4, 2018 at 9:50 amaresh hiremaniamaresh hiremani 6032 gold badges10 silver badges19 bronze badges 4- Browsers are not allowed to load local source, you need to run it from server. Are you running it from server? – Nikola Kirincic Commented Aug 4, 2018 at 9:55
- i am using the flask framework to run the website locally – amaresh hiremani Commented Aug 4, 2018 at 9:56
- I think you will have to create a blob with JS – V. Sambor Commented Aug 4, 2018 at 9:57
- Can you specify how to create blob for my query? – amaresh hiremani Commented Aug 4, 2018 at 10:00
3 Answers
Reset to default 5
<video controls autoplay>
<source src="../Downloads/video.mp4" type="video/mp4">
</video>
its working fine in my system just go to developer tool and check the path of the video is located in src location or parent location.
In my case, both video and HTML are placed in download folder.
<video controls autoplay>
<source src="../Downloads/video.mp4" type="video/mp4">
</video>
When using a video element, you should consider uploading the video to youtube or vimeo to improve page load times. Then you just copy the embed code provided.
本文标签: javascripthow to play mp4 video local file in the htmlStack Overflow
版权声明:本文标题:javascript - how to play mp4 video local file in the html? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741682253a2392237.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论