1
我有一個網站,我一直在努力研究我們在哪裏可以獲得從給定YouTube頻道獲取最新視頻的iframe。它可以在桌面或運行Flash的設備上正常工作,但是當用戶在IOS設備或某些Android設備上時,什麼也沒有顯示。它是一個空的廣場。有沒有人知道的一個很好的解決方法或我可以解決這個問題的方法?我曾嘗試檢測它是否是移動平臺,並顯示填充圖像,但仍然無法在所有設備上使用。任何建議都會很棒。禁用YouTube或可能修復臺式機以外的設備
我也認爲只是走在YouTube API和獲取的視頻圖像,並顯示出然後用戶點擊它,它只是爲您帶來的視頻,這將是一個修復,但不得已修復。
此外,在任何情況下,任何人都有更好的代碼工作方式,那麼我有下面的id愛看到它!
<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>
使用來檢測移動瀏覽器的IM代碼只是http://detectmobilebrowsers.com/