且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

html对象标签应该指定类型为视频/ mp4播放mp4视频?

更新时间:2022-10-25 09:55:32

You might get help from this website mentioned in this answer to a similar question.

Edit:

html object tag has some limitations like the other tags used to play videos. I think this will give you a more clear idea. There you'll see that the best solution is to use 3 different methods together like this:

<video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.ogg" type="video/ogg" />
  <source src="movie.webm" type="video/webm" />
<object data="movie.mp4" width="320" height="240">
<embed src="movie.swf" width="320" height="240">
Your browser does not support video
</embed>
</object>
</video> 

In this example, The HTML 5 video element tries to play the video either in mp4, ogg, or webm formats. If this fails, the code "falls back" to try the object element. If this also fails, it "falls back" to the embed element. And the easiest way to display videos in HTML is to use ***. Anyway, you'll understand it better if you read the whole thing there.