I have a website i have been working on where we have an iframe that pulls in the newest video from given YouTube channels. It works just fine on the desktop or device that can run flash but when a user is on an IOS device or some android devices nothing shows up there. Its an empty square. Is there a good fix that someone knows or a way I can get around this? I have tried detecting if it is a mobile platform and to display a filler image instead but still doesn't work on all devices. Any suggestions would be great.
I did also consider just taking the YouTube API and getting the image of the video and showing that then the user clicks it it just brings you to the video, which would be a fix but a last resort fix.
Also in-case anyone has a better way for the code to work then what I have below id love to see it!
<div class="span6 data_video">
<?php
$url = 'http://gdata.youtube.com/feeds/api/users/'. $Youtube .'/uploads?max-results=1';
$xml = simplexml_load_file($url);
foreach ($xml->entry as $entry) :
// get nodes using mrss ('media' rss namespace)
$kids = $entry->children('http://search.yahoo.com/mrss/');
// for the embed src (just the flv location - you'll need to print out the rest of the object/embed tag
$attributes = $kids->group->content[0]->attributes();
$flv = $attributes['url'];
endforeach;
?>
<iframe align="left" width="100%" height="315" src="<?php echo $flv; ?>" frameborder="0" allowfullscreen></iframe>
</div>
The code to detect a mobile browser im using is just http://detectmobilebrowsers.com/