I have a array of videos from the facebook api and i need to search if the video is a .mp4 or a .swf/youtube video ect??... I need to find all the videos from the array that are .mp4 so i can use html5 video and if its a youtube video i can use a flash iframe to play it??
I belive i need to do this because the .mp4 dose not work with the flash iframe and the .swf and youtube dose not work with the html5 video.
array example.
Array
[source] => https://fbcdn-video-d-a.akamaihd.net/hvideo-ak-xpa1/v/t42.1790-2/1073530_682984645082062_1876937949_n.mp4?rl=653&vabr=363&oh=5730d16b1824ff577a31e2a43edcb2eb&oe=54F80B4A&__gda__=1425524181_6afd6f54758f005e7ae6a46949acbea6
[source] => https://www.youtube.com/embed/5qanlirrRWs?autoplay=1
what is the best way to do this??
How do i search a array to see if it has .mp4??
What is the best way to embed facebook feed video from the array??
I have tryed some thing like this but it dosnt work??
$key = array_search('.mp4', $news_feed['source']);
If ($key===true) {
embed .mp4 to html5 video
} else {
Embed youtube video using flash iframe.
}
Any help would be good....thank you
Ok this works ...i hope someone knows a better way??
if (strpos($news_feed['source'],'mp4') !== false) {
echo '<video width="640" height="480" controls="controls" preload="none"><source src="' . $news_feed['source'] . '" type="video/mp4">Your browser does not support the video tag.</video>' . ' <br />';
} else {
echo '<iframe src="' . $news_feed['source'] . '" type="text/html" allowscriptaccess="always" allowfullscreen="true" autoplay="0" width="640" height="480"></iframe>' . '<br />';
}