Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
13.07k stars 1.51k forks source link

Video embeds in Discord #5040

Closed Sobsz closed 1 year ago

Sobsz commented 2 years ago

Describe the problem to be solved

Discord is mostly compatible with the Twitter embed format, but one area it differs in is video HTML embeds. Enabling video embeds for Twitter not only doesn't work for Discord, but it causes the embeds to go from a full-size static image:

full-size thumbnail

to this subjectively uglier-looking format:

tiny thumbnail to the right

Describe the solution you would like:

According to this comment from a Discord developer, arbitrary iframes cannot be embedded and the only way to embed a video is by providing a direct URL to the video file itself in the og:video:url meta tag.

I've confirmed that copying the HLS URL from the Download section into og:video and related meta tags makes the video embed work in Discord, while still delivering the custom iframe (defined in twitter:player) to Twitter users. However, there might be concern about the added "leech" factor due to viewers no longer being incentivized to view the video in the browser and thus participate in the P2P network.

Sobsz commented 2 years ago

Another issue I just realized: while Twitter would be unaffected, other services with iframe support (such as Mastodon) would. I've only just heard of OpenGraph, so I don't know if it's possible to provide both an iframe URL and a fallback MP4 one, but if not, the proposed feature should probably be toggleable.

Chocobozzz commented 2 years ago

Hi,

I'm not sure to understand: you say that updating twitter setting changes discord behaviour so I presume they use the twitter:card tags no? Why would they also use opengraph tags?

Sobsz commented 2 years ago

Oh, I thought the setting changed the Open Graph tags too, but the diff doesn't lie... I guess Discord tries to embed with the Twitter tags first, then falls back to Open Graph once it notices it's an embed.

Some new notes:

Chocobozzz commented 1 year ago

Hello,

It's sad but we can't do anything here. Discord needs to adapt their whitelist or do not use a whitelist like Twitter that correctly embed PeerTube player. We prefer to not change our OpenGraph/Twitter card metadata to just work with Discord.

Aeris1One commented 8 months ago

Based on what I understood :

Discord might not be the only social network having such a whitelist on iframes. There's no known way of adding an instance to the Discord whitelist.

What could be done is to expose the direct link in og:video:url when the webpage is retrieved by a known whitelisted social media.

A flow could be :

ben221199 commented 3 months ago

As far as I know the iframe-embeds are done by the html attribute in the OEmbed response.