HTML5 Game - Use the type Attribute on the source Element

Introduction

You can provide a hint to the user by applying the type attribute to the source element, specifying the MIME type of the file.

Demo

ResultView the demo in separate window

<!DOCTYPE HTML>  
<html>  
    <head>  
        <title>Example</title>  
    </head>  
    <body>  
        <video controls width="360" height="240">  
            <source src="http://java2s.com/style/demo/your.webm" type="video/webm" />  
            <source src="http://java2s.com/style/demo/your.ogv" type="video/ogg" />  
            <source src="http://java2s.com/style/demo/your.mp4" type="video/mp4" />  
            Video cannot be displayed  //  ww w  .  j  a va  2s. co m
        </video>  
    </body>  
</html>

The media attribute provides the browser with guidance about the kind of device that the video is best suited for.

Related Topic