This is a high-level overview of how to use Video.js to display your videos in HTML5 pages. This assumes you know some basics about video. Using Video.js is a three step process.
- Creating the video in the appropriate format
- Creating your transcript
- Inserting the correct HTML code in the page
Creating the video in the appropriate format
One of the strengths of HTML5 is the ability to add video right in the Web page without any additional software, like QuickTime or Flash. However, due to licensing conflicts and turf wars, not all browsers support all video formats. Fortunately, with HTML5 video you can provide the video in multiple formats and the browser will choose the one it can play.
To get this to work there are a few things to keep in mind. At a minimum, you should provide your video as an MP4 file. This will work in all browsers except for Firefox. Unless you want your Firefox users to have to use the Video.js Flash fallback option, you should also include the video as a WebM file.
If you need help converting your video from one format into another, use the Miro Video Converter.
Creating the captions
To create captions the first thing you need to do is create a plain-text version of what is said in the video. If the video is short, like 5 minutes long, this is easy to do in a text editor. If it is longer, you might want to pay someone to create a transcript for you. The IT Accessibility Office can provide you with a list of transcription companies.
After creating the transcript you have to add in the time stamps to the file to tell when each piece of text is supposed to display on the screen. The IT Accessibility Office provides a free service to add time stamps. If you are interested, please contact the IT Accessibility Office.
Inserting the correct HTML code in the page
After you have your video file(s) and caption file, upload them to the server along with an HTML5 file with the following code embedded in it.
In the <head> section:
<link href="http://vjs.zencdn.net/4.0/video-js.css" rel="stylesheet"> <script src="http://vjs.zencdn.net/4.0/video.js"></script>
Somewhere in the <body> section:
<video id="my_vid_id" controls preload="auto" width="640" height="264" poster="poster.png" data-setup='{}'>
<source src="movie.mp4" type='video/mp4' />
<source src="movie.webm" type='video/webm' />
<track kind="captions" src="captions.vtt" srclang="en" label="English" />
</video>
When this page is loaded in a Web browser, Video.js will
- check to see which of the video formats the browser natively supports
- load the Flash fallback video player to handle any browser/video format compatibility problems
- replace the browser’s default video controls with its video controls