So you want to serve up some video content and use the <video> tag? Cool!
You want to do it using video files you have in SharePoint? Cool, that shouldn’t be too hard.
Unfortunately out of the box SharePoint 2010 is going to serve that video file out of the document library with a MIME Type of application/octet-stream, which IE and Firefox are not going to recognise as playable video. Chrome seems to be inspecting the file and determining the file type itself so video plays in that browser without needing a correct MIME Type sent from the web server.
I’m not going to get deeply into the ins and outs of the codec nightmare (ugh). Expect to say, there are some good free tools for encoding your video as H.264. I like x264 for a command line tool or H.264 Encoderif you want a GUI. I’m not discussing WebM as I didn’t need to create videos using that encoding for the piece of work that generated this blog post.
If you’re after a hand on the front of generating your HTML, check out Video for Everybody. One of my big complaints is that there is nothing laid down in the spec to require a “full window” mode control, the individual browsers may provide this control, but at this stage IE, Firefox and Chrome don’t . If you’re looking to provide something on this front, then I’d suggest using VideoJS
So assuming that you have that all sorted there are a couple of steps to make SharePoint serve the content in a manner that a browser can use, so don’t just stand there, let’s get to it.
Step 1 – Configure IIS 7 to provide a MIME type for .mp4 files.
Yes, I’m only covering the .mp4/H.264 case, just repeat Step 1 tweaking for WebM/Ogv
1. From the Start menu, enter inetmgr in the search box and press Enter. An instance of the IIS Management Console will start.
2. Select the server node, in the Features View locate the MIME Types feature in the IIS Group and double click on it.
3. In the Actions pane click Add…
4. Fill in the form providing .mp4 as the File name extension and video/mp4as the MIME Type and click OK
5. Close the IIS Management Console.
Step 2 – Configure the SharePoint Web Application to serve mp4 using the configured MIME Type.
1. From the Start Menu, select All Programs | Microsoft SharePoint 2010 Products | SharePoint 2010 Central Administration. Under Application Management select Manage web applications.
2. Select the desired web application in the list.
3. Click on General Settingsin the ribbon.
4. Scroll down and find the Browser File Handling section, change the selection to Permissive, scroll to the bottom of the dialog and click OK.
5. Close the browser window.
6. You now need to reset IIS. Open and command prompt and enter run the iisresetcommand.
You’re now serving video files in a manner that all the major browsers should be able to play them when used as a <source> element in the <video> tag!