# Video embeds from facebook.com and other sites fail

**URL:** https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366
**Category:** Bug
**Created:** [26 באפריל,‏ 2020,‏ 5:44pm UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366 "2020-04-26T17:44:10Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [26 באפריל,‏ 2020,‏ 5:44pm UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/1 "2020-04-26T17:44:10Z")

</div>

A member of mine posted [this Facebook link standalone](https://www.facebook.com/dccarmen/videos/10222567743521148/), and Discourse tried to parse it and it didn’t fly.

Let me try that same link right on its own line:

> **[Video](https://www.facebook.com/dccarmen/videos/10222567743521148/)**

Just in case you don’t see it above, this is what’s displayed:

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/b/0b7ad2907ae5427c682f3f962a7229bee5f6ed57.png)

The problem also shows up with a few adult sites where members were trying to share links; I did a quick test where I pasted a bunch of video URLs from different places several of the major adult sites also do not work.

This seems like a relatively serious bug, only in that it impacts embeds for Facebook. My (less-tech-savvy) members like to share links to things on Facebook in part because it’s so popular and universal. ☹ Plus, if someone posts that URL to a message, it gets parsed into something that doesn’t work, and the original URL is gone. So you can’t even go to that URL if you wanted to… it’s not available at all any longer.

So… is it possible to tell Discourse to NOT try to auto-embed videos at those domains? I was looking for a setting like ‘blacklist URLs with these words from embedding media’ where I could add those domains. (Or perhaps a whitelist of approved URLs like youtube and vimeo, to help head off future issues with new sites.)

If not that, is there a quick fix I can do on my forums to help?

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [27 באפריל,‏ 2020,‏ 6:29am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/2 "2020-04-27T06:29:18Z")

</div>

# Firefox (desktop)

Here on my desktop, using Firefox 75 on the Mac… I get the grey fail box.

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/3/13c45210a79d2b053f5139631cfcbaafd02a81a7.png)

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [27 באפריל,‏ 2020,‏ 6:30am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/3 "2020-04-27T06:30:45Z")

</div>

# Safari (desktop)

Here on Safari, the first frame of the video shows, but when you click the “play” button, nothing happens.

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/5/a507cc53f77dd956e1b15c458e3bfa5e79f0c55c.jpeg)

# Chrome (desktop)

Using Chrome v81 on Mac desktop… same thing… you see the video but it never plays.

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/1/d1fa4badfbdf3e8ff5b10f4ac696c9dc1906eecc.jpeg)

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [27 באפריל,‏ 2020,‏ 6:33am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/4 "2020-04-27T06:33:07Z")

</div>

# iPhone - Safari iOS

Same as Chrome or Safari (desktop)… the video appears but won’t play.

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/4/84d8a3924dbdb1a36cb34253c42835b45af8b492.jpeg)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [27 באפריל,‏ 2020,‏ 11:02am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/6 "2020-04-27T11:02:02Z")

</div>

Discourse [doesn’t support](https://meta.discourse.org/t/facebook-video-support-in-onebox/42972/16) Facebook videos onebox officially.

You might want to look at:

> [@Allow playing embedded videos in Facebook frame?](https://meta.discourse.org/t/play-videos-facebook-by-link/106751/3):
>
> That is not supported out of the box by Onebox, but if you allow iframes from Facebook on the site settings, and grab the incorporation link in a Facebook video, you will get something like: \<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FPortaDosFundos%2Fvideos%2F1981258538657064%2F&show\_text=0&width=560" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"\>\</ifr…

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [27 באפריל,‏ 2020,‏ 11:05am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/7 "2020-04-27T11:05:51Z")

</div>

Can we replace the onebox output so that it doesn’t create a broken player? I guess we should make it work like it did [before](https://meta.discourse.org/t/play-videos-facebook-by-link/106751)

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/9/29a9a1e6d18819030e56d34048694ce7b6f4ec3c.jpeg)

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [27 באפריל,‏ 2020,‏ 11:09am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/8 "2020-04-27T11:09:01Z")

</div>

> [@techAPJ](#):
>
> Discourse [doesn’t support](https://meta.discourse.org/t/facebook-video-support-in-onebox/42972/16) Facebook videos onebox officially.

> [@david](#):
>
> Can we replace the onebox output so that it doesn’t create a broken player?

Yes, I would say that is critical. **It’s not a big deal to me if Discourse doesn’t support Facebook video. It’s a big deal to me when a member pastes a link (hardly unusual) and it produces an error message… and the original link is gone.** I have several messages like this in my forum now. Us admins are manually fixing them as we see this but obviously that’s not a great solution.

I believe this is a serious bug, only in that Facebook (along with other videos sites I’ve tested it with) is wildly popular.

I would love to figure out a quick fix… let me know if I can help?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [27 באפריל,‏ 2020,‏ 11:14am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/9 "2020-04-27T11:14:49Z")

</div>

> [@pnoeric](#):
>
> I would love to figure out a quick fix

The quickest fix here would be to add `www.facebook.com` to the setting: `onebox domains blacklist`. That way onebox will not try to embed [facebook.com](http://facebook.com) videos.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [27 באפריל,‏ 2020,‏ 11:23am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/10 "2020-04-27T11:23:13Z")

</div>

> [@david](#):
>
> I guess we should make it work like it did [before](https://meta.discourse.org/t/play-videos-facebook-by-link/106751)

What changed here is that Facebook updated OpenGraph metadata to add video links that are too restricted:

```plaintext
<meta property="og:video:secure_url" content="https://video.fjai1-2.fna.fbcdn.net/v/t42.9040-2/10000000_626864624535070_4779621138076532736_n.mp4?_nc_cat=107&amp;_nc_sid=985c63&amp;efg=eyJybHIiOjM1MiwicmxhIjoxMzI5LCJ2ZW5jb2RlX3RhZyI6InN2ZV9zZCJ9&amp;_nc_oc=AQkUihmrvyg1wU9qH_NjqkLUzl0XSYJGE6JREtPH7jxKc1aXEIuGLSbauCEPM-hI-DCuJRacr1hCB6HHZre1lxto&amp;rl=352&amp;vabr=196&amp;_nc_ht=video.fjai1-2.fna&amp;oh=3fd1d5e14f27d55bc0d2a91d4714148b&amp;oe=5EA6E533" />

```

The above video link shows error: `Bad URL timestamp`. 🤦‍♂️

Even the link in `og:image` tag shows same error.

We don’t have any info to show on Facebook onebox except the video title. I think we should hardcode onebox to blacklist Facebook video links.

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [27 באפריל,‏ 2020,‏ 11:24am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/11 "2020-04-27T11:24:48Z")

</div>

> [@techAPJ](#):
>
> The quickest fix here would be to add `www.facebook.com` to the setting: `onebox domains blacklist` . That way onebox will not try to embed [facebook.com](http://facebook.com) videos.

Excellent, thank you… that’s perfect.

BTW a reminder that this happens on other sites besides Facebook; a member tried to post a link to a video page on `xvideos.com` and it failed as well. (NSFW warning! That is VERY MUCH an adult site!) I tested it with a handful of other sites and found the same.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [27 באפריל,‏ 2020,‏ 11:27am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/12 "2020-04-27T11:27:56Z")

</div>

For facebook, can we take the `twitter:player` attribute and use it for an iframe? It seems to be a non-expiring URL:

![Screenshot 2020-04-27 at 12.26.42](https://global.discourse-cdn.com/meta/optimized/3X/e/6/e67ddf73bf4d25b7bc0cb4594ae61cff9f5b25bb_2_690x28.png)

(There is so much irony in Facebook serving broken opengraph data, but working twitter data 😂)

Or alternatively, apply the same logic as instagram. Show a large thumbnail with a ⏯ button, which is linked.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [27 באפריל,‏ 2020,‏ 11:29am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/13 "2020-04-27T11:29:45Z")

</div>

I did try that and got broken links for `twitter:image` and `twitter:player` tags. Do they work for you?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [27 באפריל,‏ 2020,‏ 11:32am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/14 "2020-04-27T11:32:31Z")

</div>

On @pnoeric’s [example video](https://www.facebook.com/plugins/video.php?height=222&width=400&href=https://www.facebook.com/dccarmen/videos/10222567743521148/) I see

```plaintext
<meta name="twitter:player" content="https://www.facebook.com/plugins/video.php?height=222&width=400&href=https://www.facebook.com/dccarmen/videos/10222567743521148/">

```

Which [seems to work ok](https://www.facebook.com/plugins/video.php?height=222&width=400&href=https%3A%2F%2Fwww.facebook.com%2Fdccarmen%2Fvideos%2F10222567743521148%2F).

But if you found some which are broken, then we should probably avoid it

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [27 באפריל,‏ 2020,‏ 11:41am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/15 "2020-04-27T11:41:01Z")

</div>

For that same link I am seeing:

```plaintext
https://www.facebook.com/plugins/video.php?height=222&amp;width=400&amp;href=https://www.facebook.com/dccarmen/videos/10222567743521148/

```

Notice `&amp;` that is breaking the URL… changing that to `&` does the trick. So yeah, we can work around it.

`twitter:image` links are still broken (here’s an [example](https://lookaside.fbsbx.com/lookaside/crawler/media/?media_id=10222567743521148&get_thumbnail=1)).

So we have two options here:

1. use `twitter:player` links to embed facebook video
2. blacklist facebook videos in onebox and show them as normal links

Which one do you prefer @codinghorror?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [28 באפריל,‏ 2020,‏ 4:22am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/16 "2020-04-28T04:22:06Z")

</div>

> [@techAPJ](#):
>
> use `twitter:player` links to embed facebook video

We can try this but are we sure the links don’t expire?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [28 באפריל,‏ 2020,‏ 5:10am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/17 "2020-04-28T05:10:24Z")

</div>

I don’t think the link will expire because the URL is basically pointing at a facebook plugin that will embed video for whatever video link we pass in `href` parameter.

```plaintext
https://www.facebook.com/plugins/video.php?height=222&width=400&href=https://www.facebook.com/dccarmen/videos/10222567743521148/

```

So we can use iframe to embed the facebook video.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [28 באפריל,‏ 2020,‏ 8:37am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/20 "2020-04-28T08:37:20Z")

</div>

> [@pnoeric](#):
>
> Just want to confirm that this fix will address the same problem that I’m seeing on other sites with embedded videos?

No the fix will be specific to Facebook.

Note that the failing video onebox usually indicates that the error is in the site you are trying to embed. In case of Facebook, it was Facebook being too restrictive and allowing video playback for a certain time only.

We usually work around these errors only for sites that are very popular (example: Instagram) so that the wider community can reap the benefits. If the site is not popular and you need to embed them on your site then the recommended way is to create a custom plugin adding custom Onebox engine for that site.

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [28 באפריל,‏ 2020,‏ 9:08am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/21 "2020-04-28T09:08:35Z")

</div>

Ok.

Hmm. Is there a way to whitelist domains that onebox will try to embed? If not, it seems like we have this situation:

1. I run a community forum where members like to link to sites with videos. (These could be _any_ sites, of course… we don’t know right now.)

2. If a site has an error in their code that prevent embedding from working, Discourse mangles the embed (ugly), and worse yet, removes the original URL so others can’t see what the OP was trying to share.

Doesn’t it seem like step 2 should be “If a site has an error in their code that prevent embedding from working, **Discourse stops trying to embed and instead just lets the link pass through?** ”

I can’t fix this with the blacklist because I don’t know what domains are impacted by this, and of course, any site could have this issue in the future. Just like we saw here with Facebook.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [29 באפריל,‏ 2020,‏ 2:12am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/22 "2020-04-29T02:12:15Z")

</div>

Sure you can fix it — just blacklist the domains you observe problems with. This isn’t some impossibility.

---

<div class="post-metadata">

### Author: ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)
#### Post date: [29 באפריל,‏ 2020,‏ 6:29am UTC](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366/23 "2020-04-29T06:29:21Z")

</div>

Ok, that’s fine. I don’t have a great sense of how much of a problem this is; manually handling them is a great solution if there aren’t many domains with this problem.

I still think Discourse should handle malformed external data in a more graceful way besides “create giant error message and remove the most important content from the OP’s post”-- and I think you probably do too. 🙂 But for now blacklisting is an acceptable workaround. Thank you.

[Next page](https://meta.discourse.org/t/video-embeds-from-facebook-com-and-other-sites-fail/149366.md?page=2)
