html object tag should we specify type as video/mp

2019-08-02 05:04发布

I know that object tag embeds objects in html and useful for playing videos/audios. When we specify object with type="video/mpeg" does this use the default player in the device

I am having an issue in playing mp4 files. When i use object tag. It is able to play mpeg-2 transport stream though.

Also the device player specs says they support mp4.

Am i missing anything here.

标签: html video mp4
1条回答
Rolldiameter
2楼-- · 2019-08-02 05:39

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 YouTube. Anyway, you'll understand it better if you read the whole thing there.

查看更多
登录 后发表回答