Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
362 views
in Technique[技术] by (71.8m points)

html - Why should we link in the HTML5 fallback the same format as the one browser doesn't already support?

I've been reading about embedding videos for my HTML page with multiple sources to maximize support for multiple browsers. However, as in my example below, when we add 2 sources in 2 different formats (MP4 and WEBM) and add a fallback content just in case that the browser won't support both of those formats,

I've seen that the same kind of format (MP4) is used in the hyperlink of the fallback content. I know that fallback content appears only when both sources we add won't be supported by the browser.

Question:
If that format would work with that browser, we wouldn't need the same format we add in the fallback content. I'm confused about how things work there.

<video controls>
  <source src="rabbit320.mp4" type="video/mp4">
  <source src="rabbit320.webm" type="video/webm">
  <p>Your browser doesn't support HTML5 video. Here is a <a href="rabbit320.mp4">link to the video</a> instead.</p>
</video>

More about this example you can find here: Media file support


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The fallback content is for browsers which don't support the <video> element, not for those which don't support the formats the <source> elements provide.

… and even if a browser doesn't support the format for internal playback, it can still be opened in an external video player by the user.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...