1

I have a video slider with .webm,.mp4 & .ogv media formats. as webm is a much smaller size, I want to force the use of .webm if the browser/device can support the format.

CYBORG
  • 104
  • 2
  • 4
  • 11

1 Answers1

2

You can specify a priority of formats by the way you arrange the source tags for the video. If the browser supports the first format listed it will use that, if not it will continue to the next and so on.

Example:

This will try the webm format first, if browser cannot play it the theora version is tried and finally mp4 if that didn't work either (finally a fallback if none are supported) (borrowed from wikipedia) -

<video poster="movie.jpg" controls>
    <source src="movie.webm" type='video/webm; codecs="vp8.0, vorbis"'>
    <source src="movie.ogv" type='video/ogg; codecs="theora, vorbis"'>
    <source src="movie.mp4" type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'>
    <p>This is fallback content to display for user agents that do not
       support the video tag.</p>
</video>