When updating my website recently, I decided to add iPhone and iPad video playback to my video player in case a visitor to my site did not have Flash installed. I more or less followed the tutorial here, from gotoAndLearn, but updated it to be able to use the SWF Tools module for Drupal.


If you have SWF Tools installed on your Drupal site and have your video encoded into files that are playable by the Flash Player and Apple devices, you can use this PHP code to embed the Flash video with HTML 5 video as back-up. The settings I used for encoding an mp4 would not play when I tested this, so I converted the video to an iPhone version by using the "Create iPod/iPhone Version" from iTunes.


Using this code, you can define the alternative content that shows up on a per swf basis. One could also specify a .ogg video to be used if a Firefox user does not have Flash installed, using similar HTML 5 tags.

Note - must have the PHP input filter enabled to be able to use this PHP code.

print swf('http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf',
        'params' => array
            'width' => '720',
            'height' => '406',
            'wmode' => 'transparent',
        'flashvars' => array
             'src' => '/files/demo-reel-2010.mp4',
             'controlBarMode' => 'docked',
             'poster' => '/files/demo-reel-2010.jpg',
        'othervars' => array
             'html_alt' => '&lt;video controls="controls" poster="/files/demo-reel-2010.jpg" width="720" height="406">
        &lt;source src="/files/demo-reel-2010.m4v" type="video/mp4" />