HTML5 video with Sitecore


I worked with a client that was having trouble getting HTML5 video to play in Sitecore. Inside of our support tickets I found the trick to getting it to work is to add the following MIME Types to the App_Config/MIMETypes.config file.

  <mediaType extensions="ogg">
    <mimeType>video/ogg</mimeType>
  </mediaType>
  <mediaType extensions="m4v">
    <mimeType>video/mp4</mimeType>
  </mediaType>

After that I was able to play video with those two formats in IE9 and the latest versions of FF and Chrome. I have not tested on any mobile devices or older browsers.

With HTML5 you need to specify the source video for each codec you want to support because the browsers do not support the same codecs.

<video controls="controls"">
   <source src="~/media/Files/sample_h264.m4v" type="video/mp4" />
   <source src="~/media/Files/sample_ogg.ogg" type="video/ogg"/>
   <p>Your browser does not support the <code>video</code> element.</p>
 </video>
Advertisements

About Kevin Buckley
.Net web developer with a lot of experience in CMS. Currently working at Sitecore as Solutions Engineer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: