• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 How to embed Facebook Videos?

farang

Well-known member
#1
Embedding Facebook Videos doesn't seem to work.

This is an example code that facebook suggests for sharing a video.

Code:
<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/sv_SE/sdk.js#xfbml=1&version=v2.3";  fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class="fb-post" data-href="https://www.facebook.com/Meetville/videos/1008048852591083/" data-width="500"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/Meetville/videos/1008048852591083/"><p>Homemade OlympicsMany thanks to R&#xe9;mi GAILLARD!</p>Posted by <a href="https://www.facebook.com/Meetville">Meetville</a> on <a href="https://www.facebook.com/Meetville/videos/1008048852591083/">den 14 april 2015</a></blockquote></div></div>
Embedding the URL for video is https://www.facebook.com/Meetville/videos/1008048852591083/ doesn't auto embed as well.

So if I need to alter anything to make auto embedding Facebook videos work, please provide an example for me. Thanks.
 

Martok

Well-known member
#7
Installing s9e Media BBCodes pack which has definitions for 102 media sites will allow Facebook media links just by cutting and pasting the URL in a message body.
https://xenforo.com/community/resources/s9e-media-bbcodes-pack.2476/
Although I use that add-on and would recommend it to members who want to add a range of BB Code media sites, if the OP only wants to embed Facebook videos then the amendment that Brogan suggested is sufficient and saves installing an add-on that adds a lot of stuff that may not be required.
 
#9
You just need to add this to Match URLs for the Facebook media bb code site.
Sorry it's not working.
How I have to change HTML-code for embedding? I seems this one is old
Code:
<div class="fb-video" data-href="https://www.facebook.com/video.php?v={$id}" data-width="500"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/video.php?v={$id}">https://www.facebook.com/video.php?v={$id}</a></div></div>
 

Brogan

XenForo moderator
Staff member
#10
This is the default embed code we are using now:
Code:
<div class="fb-video" data-href="https://www.facebook.com/video.php?v={$id}" data-width="500"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/video.php?v={$id}">https://www.facebook.com/video.php?v={$id}</a></div></div>
 

Mike

XenForo developer
Staff member
#14
The match URLs are:
Code:
facebook.com/*video.php?v={$id:digits}
facebook.com/*photo.php?v={$id:digits}
facebook.com/*/videos/{$id:digits}
But I think you just missed the first one because the videos are attempting to be embedded.

I think this might be a Facebook issue of some sort though, because the Facebook recommend feature at the bottom isn't working. I thought it might be language related, but it worked correctly locally in Russian. The only other thing I could think of is either a temporary Facebook issue or some limitation regarding your domain specifically.