I am trying to show a video that came back from Facebook Graph Api. I have a video source, which is YouTube video, Vimeo video, Facebook video, or any other type of video that is sent to the news feed.
My $ facebookdata returns this:
[source] => http:
I set the value of SOURCE to $ status_video_embed as follows:
$status_video_embed = str_replace("autoplay=1", "autoplay=0", $data['source']);
In addition, you can see that I am replacing auto play with 0 if it exists.
I inserted a video to display as follows:
echo '<iframe src="' . $status_video_embed . '" type="text/html" allowscriptaccess="always" allowfullscreen="true" width="350" height="197"></iframe>';
This works, but I run into a few problems. Firstly, if this video is different from the video on Facebook, it works fine, but I can't make it fullscreen. I assume this is due to the fact that it is being implemented in an iFrame. The second problem is uploading videos to Facebook, they automatically start, and I canβt figure out how to prevent these videos from playing automatically.
The second approach I made is as follows:
echo '<object width="350" height="197" ><param name="allowfullscreen" value="true" />'; echo '<param name="movie" value="' . $status_video_embed . '" />'; echo '<embed src="' . $status_video_embed . '" type="application/x-shockwave-flash" allowfullscreen="true" width="350" height="197"></embed>'; echo '</object>';
This displays the video, except that they are downloaded and displayed forever - this prevents the video from automatically playing on facebook, but now when I click the play button on any video, nothing happens. No controls through the embedded video work.
Does anyone know what is the best way to embed video in this method? I have been given the source of the video from the returned array.
I hope someone can help, thanks.