iPhone, iPad and Flash Video with SWF Tools and Drupal 6
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.
1.
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.
2.
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.
<?php
print swf('http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf',
array
(
'params' => array
(
'width' => '720',
'height' => '406',
'wmode' => 'transparent',
),
'flashvars' => array
(
'src' => 'http://www.samwirch.com/files/demo-reel-2010.mp4',
'controlBarMode' => 'docked',
'poster' => 'http://www.samwirch.com/files/demo-reel-2010.jpg',
),
'othervars' => array
(
'html_alt' => '<video controls="controls" poster="http://www.samwirch.com/files/demo-reel-2010.jpg" width="720" height="406">
<source src="http://www.samwirch.com/files/demo-reel-2010.m4v" type="video/mp4" />
</video>',
),
)
);?>
Comments
Hi this looks great. I got it all installed and working but in my case on iphone it doesn't work. instead of actually interpreting the tag it just shows the whole tag as plain text instead of embedding the video . I am using panels as well so maybe that breaks something. The flash embed works correctly but the iOS (4.1) isn't working instead of the video embed it shows the actual embed text for me. PHP code is set as input. Not sure what else to try. Any ideas? thanks
I'm trying to do exactly this but I'm not following what exactly you do with this code. Are you putting it in a block? Is there a way to get this to work with a CCK filefield? I tried using it with a custom formatter but I didn't have any luck that way.
The above code is not executing in iPhone.....can u help...me for that
Post new comment