Tuesday, December 4, 2012

HTML5 Video

I recently had to post a lot of videos on a cfwheels site.
The videos needed to be behind a login, so to achieve that I put a little function in the Controllers/Controller.cfc. I was passing the videoid in the url so I just cued off that.

So then I just set a filter on my sitepages controller to run on the page.
<cfset filters(through="memberloginRequired", only="show")>

I had to report on the videos, so for the video playback, I used the Projekktor video player. It has a flash fallback and it had a tracking plugin that I bought to keep track of all player events and states.
http://www.projekktor.com/docs/plugins_tracking

To make the video available to the most people, we used mp4 and ogv
I had a little trouble figuring out how everything has to fit together, but basically you have to go into IIS and add support for the video types, so you have to add MIME types for video/mp4 and video/ogg with an ogv extension. This will add the following to your web.config file just under your rewrite tag:

One problem I ran into was browser's not recognizing the mp4 so I ended up taking the type out of that in the video page script:
Altogether adding html5 videos was very nice. However, we are still having some people reporting problems, so next I'm going to write a little script to help with debugging. I will try to post that later.