Twitch clips embed problem

AI-generated summary

Users are reporting an issue with embedding Twitch clips in Discourse, where the parent parameter is incorrectly set, preventing the iframe from loading. RGJ identifies the problem as the system scraping the Twitch page and failing to replace meta.tag with the correct hostname. Heliosurge confirms the issue on Meta but notes that regular oneboxes work on their instance, while clips with query parameters fail. The issue appears specific to clips, as full videos embed correctly. Falco tests various formats and proposes a fix, which is later confirmed to resolve the issue. A pull request (#31080) is submitted to address the bug.

Problem

Embedding a Twitch clip does not work, it somehow generates a bad parent parameter.

https://www.twitch.tv/paymoneywubby/clip/AmazonianMoralSwordCharlietheUnicorn-JoRQeBi1QJuyKfu2

At first I thought meta.tag had to do with Discourse Meta, but it’s the same value on every instance.

When you manually change the link into the actual hostname of the forum, the iframe will load.

A quick Google search leads me here, to another piece of software having the same issue, and the gist of that topic is

This suggests that it’s scraping the Twitch page for the Embed code. And is not replacing “meta.tag” with the correct parent.

Which seems to be the case here as well.

5 Likes

The link you posted above the pic. Is that the one not loading the iframe? When I created a post in my instance (Tests-passed) up to date it loads

https://www.twitch.tv/paymoneywubby/clip/AmazonianMoralSwordCharlietheUnicorn-JoRQeBi1QJuyKfu2

Here on Meta doesn’t load

Screenshot from my forum.

I thought it might have been added via the iftrane Customization > Theme component & site settings. But twitch is not directly added to either.

My dashboard for version

Additional info This is in my Google Pixel 8 Chrome

On my tests-passed instance (same commit as yours), I get a regular onebox when I paste that link, just like on your forum. But when I add ?foo (or any other query parameter) I get the behavior like here on Meta. So I guess that’s a second bug (or at least: something I don’t understand)

But anyway… that’s a regular onebox. I want an embedded player (and that’s what I get when I manually “fix up” the parent parameter in the link through the dev tools inspector)

1 Like

Is the clip a bit different than this

https://www.twitch.tv/videos/1845242876?tt_medium=mobile_web_share&tt_content=vod

The above works on my instance for twitch video.

Okay was able to repo. As you said it is the clips that are not sharing correctly. Full twitch videos seem fine.

Interesting bug. I am wondering if it might be more on twitch’s side as Video works with player but the share clips doesn’t

2 Likes

Test

2 Likes

Tentative fix

https://github.com/discourse/discourse/pull/31080

4 Likes

Testing formats

https://www.twitch.tv/jenandaliona/clip/CrispyFriendlyLobsterFeelsBadMan-MelPMGMLiS9GFKea?filter=clips&range=all&sort=time

https://clips.twitch.tv/CrispyFriendlyLobsterFeelsBadMan-MelPMGMLiS9GFKea

https://clips.twitch.tv/embed?clip=CrispyFriendlyLobsterFeelsBadMan-MelPMGMLiS9GFKea&parent=meta.discourse.org

Looks like all is done here.

5 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.