Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed Youtube Video To Facebook And Play At Specific Timecode

I have a :30 YouTube video that I want to embed onto Facebook and start playback at :16.

I thought this would be easy enough changing the parameters in the URL for share, or the URL in the embed code. But when I post this on Facebook, even though the URL's will link to YouTube and play at the correct :16 mark, they always start from :00 when playback is initiated inside Facebook.

Does Facebook strip all of the URL parameters for embeded YouTube videos? Is there a work-around?

I've tried:

https://youtu.be/yR8fp-XzJIo?t=16s

And I've tried:

<iframe width="560" height="315" src="https://youtu.be/yR8fp-XzJIo?t=16s" frameborder="0" allowfullscreen></iframe>

And I've tried:

<iframe width="560" height="315" src="https://youtu.be/yR8fp-XzJIo?start=16&end=38" frameborder="0" allowfullscreen></iframe>

Nothing seems to work. I have an idea that depends on this functionality, so I'd love some help if anyone knows a work-around or even a reason. Thanks so much, crew!

like image 727
thebrownsquare Avatar asked Apr 20 '15 08:04

thebrownsquare


2 Answers

Facebook behaved itself with a URL in this form:

https://www.youtube.com/watch?v=tgGlbVtd7wc&t=2m53s

like image 101
user3673 Avatar answered Nov 15 '22 05:11

user3673


While I cannot think of a workaround, I think the reason why the video always starts from :00 is how the Facebook scraper works to fetch meta data for Open Graph objects. If you pop your url into the URL debugger tool you will see that og:url points to the actual url of the video. The scraper treats this as a redirect and takes data from there.

<meta property="og:url" content="http://www.youtube.com/watch?v=yR8fp-XzJIo">

Hence, when you share the video on your wall, the actual meta data for the video is taken from the site pointed to by the og:url tag which is the actual video without the t parameter that sets the playback start time.

like image 40
Bangdel Avatar answered Nov 15 '22 05:11

Bangdel