Document

 Browser Support

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the <video> and <audio> element.

Note: Internet Explorer 8 and earlier versions, do not support the <video> and <audio> element.

 Video Formats and Browser Support

Currently, there are 3 supported video formats for the <video> element: MP4, WebM, and Ogg:

  • MP4 = MPEG 4 files with H264 video codec and AAC audio codec
  • WebM = WebM files with VP8 video codec and Vorbis audio codec
  • Ogg = Ogg files with Theora video codec and Vorbis audio codec
Browser MP4 H.264 WebM Ogg
Internet Explorer 9+
Chrome 6+
Firefox 3.6+
Safari 5+
Opera 10.6+
 Video Options
Attribute Type Default Description
HasControls bool true Specifies that video controls should be displayed (such as a play/pause button etc).
HasPoster bool false Specifies an image to be shown while the video is downloading, or until the user hits the play button
HasLoop bool false Specifies if and how the author thinks the video should be loaded when the page loads
HasMuted bool false Specifies that the audio output of the video should be muted
HasAutoplay bool false Specifies that the video will start playing as soon as it is ready
HasPreload bool true Specifies video should be loaded when the page loads.
PosterUrl string Specifies an image to be shown while the video is downloading, or until the user hits the play button
Mp4Url string Specifies the mp4 URL of the audio file
WebmUrl string Specifies the webm URL of the audio file
OggUrl string Specifies the ogg URL of the audio file
VideoNotSupported string Specifies Your browser does not support the video element
HasDownloadLink bool false Set download link available
TrackEnable bool false This element is used to specify subtitles, caption files or other files containing text, that should be visible when the media is playing.
Note (Browser Support): The <track> tag is supported in Internet Explorer 10, Opera, and Chrome.
 HTML Structure
<video controls poster="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg" width="640" height="360">
	<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4" />
	<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm" />
	<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv" type="video/ogg" />
</video>
<p>
	<strong>Download video:</strong> <a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4">MP4 format</a> | <a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv">Ogg format</a> | <a href="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm">WebM format</a>
</p>
 MIME Types for Video Formats
Format MIME-type
MP4 video/mp4
WebM video/webm
Ogg video/ogg
Add a MIME type in IIS
  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager.
  2. In Features View, double-click MIME Types.
  3. In the Actions pane, click Add.
  4. In the Add MIME Type dialog box, type a file name extension in the File name extension text box. For example, type .mp4.
  5. Type a MIME type in the MIME type text box. For example, type video/mp4.
  6. Click OK.
 Audio Formats and Browser Support

Currently, there are 3 supported video formats for the <audio> element: MP3, Ogg, and Wav:

Browser MP3 Wav Ogg
Internet Explorer 9+
Chrome 6+
Firefox 3.6+
Safari 5+
Opera 10+
 Audio Options
Attribute Type Default Description
HasControls bool true Specifies that audio controls should be displayed (such as a play/pause button etc).
HasLoop bool false Specifies that the audio will start over again, every time it is finished
HasMuted bool false Specifies that the audio output should be muted
HasAutoplay bool false Specifies that the audio will start playing as soon as it is ready
HasPreload bool true Specifies if and how the author thinks the audio should be loaded when the page loads
Mp3Url string Specifies the mp3 URL of the audio file
WavUrl string Specifies the wav URL of the audio file
OggUrl string Specifies the ogg URL of the audio file
AudioNotSupported string Specifies Your browser does not support the audio element
HasDownloadLink bool false Set download link available
 HTML Structure
<audio controls preload class="audio" id="audio1">
    <source type="audio/mpeg" src="Content/audio/jazz.mp3"/>
    <source type="audio/ogg" src="Content/audio/jazz.ogg"/>
    <source type="audio/wav" src="Content/audio/jazz.wav"/>
    <p>This browser does not support the audio.</p>
</audio>
 MIME Types for Audio Formats
Format MIME-type
MP3 audio/mpeg
Wav audio/wav
Ogg audio/ogg
Add a MIME type in IIS
  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager.
  2. In Features View, double-click MIME Types.
  3. In the Actions pane, click Add.
  4. In the Add MIME Type dialog box, type a file name extension in the File name extension text box. For example, type .mp3.
  5. Type a MIME type in the MIME type text box. For example, type audio/mpeg.
  6. Click OK.
nuget package
PM> Install-Package MVC4.Video