Html5 video tag not working in chrome

2019-09-06 05:42发布

On a W3school video tag tutorial, I checked on Chrome and it was working fine but I copied the code in my project and it didn't work. Here is the code:

<video width="500" height="400" controls autoplay>
    <source src="C:\Users\Sunny\Desktop\My_Passion.mp4" type="video/mp4"/>              
</video>

标签: html5
2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-09-06 06:26

Chrome does not support .mp4 video codec. ReEncode video.

<video width="500" height="400" controls autoplay> <source src="C:\Users\Sunny\Desktop\My_Passion.mp4" type="video/mp4"/> <source src="C:\Users\Sunny\Desktop\My_Passion.ogv" type="video/ogg"/>
</video>

You can use online video converter

查看更多
小情绪 Triste *
3楼-- · 2019-09-06 06:29

The video source URL has to point to your web server where this page is being hosted. It won't work for local file paths like the one you currently have in there (pointing to a video file on your local computer).

So make sure the My_Passion.mp4 file is on your web server and then change the source as follows:

<source src="My_Passion.mp4" type="video/mp4"/>
查看更多
登录 后发表回答