The iPad is a great device to watch video. According to newteevee.com, iPad users watch 3 times as much video as regular web users.
I can attest to that, I’d much rather watch movies on my iPad than on my iPhone, my laptop or…gasp…my TV. It’ also a great way to enjoy web tutorials since it frees your laptop’s screen to completely follow along with a tutorial.
Unfortunatelly, the excellent flowplayer, the video player I’m currently using, is a flash based player and Steve Jobs is not having any of that on his iPad. HTML5 is a good solution, but managing between the Flowplayer and HTML5 takes a bit of wrangling.
You might be thinking that it would be great to just use HTML5 for all of the videos, but it’s not supported by Internet Explorer 8, so until that happens we need a workaround. Luckily FlowPlayer can work in any browser as long as it has a flash plug-in, which means we can use it for everything except for Apple’s Mobile Devices and take care of those using HTML5. If you’re interested in HTML5, check out the excellent guide by Mark Pilgrim.
In the meantime you can use this technique to make sure your video plays on the iPad, the iPhone, and the iPod Touch, as well as in other browsers.
Step 1: Download & Install FlowPlayer
Download Flowplayer, and follow the installation instructions
Copy the files to the server and note their location.
- The next part of the code is a function that checks to see if the device viewing the page is an iPad or it’s cousins, the iPhone and iPod touch. If they aren’t, it displays the flowplayer, otherwise it gives those devices HTML5 code for playing video.
- Substitute the word LOCATIONOFPLAYER with the URL of where you placed the flowplayer.
- You only need to have this code once per page. You can include this code in your
<head>tag or put it (without the
Place this anywhere you want to play a movie. Obviously, LOCATION OF MOVIE is the URL of your movie. MOVIEWIDTH is the height of your movie and MOVIEHEIGHT is the height. Make sure you update those parameters.
Step 3: Encoding your movie
Because we want this movie to also work with Flowplayer, which is flash based, the only format we can use for this is .h264. It’s really the best format to use because it will work with most players.
I’ve used a variety of applications on both Windows and Linux based systems.
- Format Factory