How to show SWF, where Flash is available, and gracefully fallback to MP4 video for iOS devices?

you can achieve that in many ways, PHP, plain Javascript, Jquery…depending on many other variables in your theme / app. I could list pros and cons for all methods , but it is not the right place ..

In php for example, you could use browser detection both directly on user agent OR with get_browser() .

simple example :

if(strstr($_SERVER['HTTP_USER_AGENT'],'iPod') || strstr($_SERVER['HTTP_USER_AGENT'],'iPhone'))
{
    // LINK TO NORMAL 
}else {
            //were not - put SWF
    }

iOs together :

$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");

if( $iPod || $iPhone || $iPad ){
        //were an iPhone/iPod touch/iPad -- Load normal link 
}else {
        //were not - put SWF
}
?>  

full detection for mobile :

//Detect special conditions devices

$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
if(stripos($_SERVER['HTTP_USER_AGENT'],"Android") && stripos($_SERVER['HTTP_USER_AGENT'],"mobile")){
        $Android = true;
}else if(stripos($_SERVER['HTTP_USER_AGENT'],"Android")){
        $Android = false;
        $AndroidTablet = true;
}else{
        $Android = false;
        $AndroidTablet = false;
}
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
$BlackBerry = stripos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$RimTablet= stripos($_SERVER['HTTP_USER_AGENT'],"RIM Tablet");
//do something with this information
if( $iPod || $iPhone ){
        //were an iPhone/iPod touch -- do something here
}else if($iPad){
        //were an iPad -- do something here
}else if($Android){
        //were an Android Phone -- do something here
}else if($AndroidTablet){
        //were an Android Phone -- do something here
}else if($webOS){
        //were a webOS device -- do something here
}else if($BlackBerry){
        //were a BlackBerry phone -- do something here
}else if($RimTablet){
        //were a RIM/BlackBerry Tablet -- do something here
}

this code is from http://www.schiffner.com/index.php/programming-php-classes/php-mobile-device-detection/

you can also a FULL weight class here :

http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/