Discord 如何嵌入 YouTube-Playable 视频?

How does Discord embed YouTube-Playable Videos?

最近我一直在想 Discord 是如何嵌入 Youtube 视频的,

在 link 例如:Example

我想知道的原因是因为我目前正在开发一个网站,该网站希望在发布 link 时具有此潜在功能,例如 https://example.com/le-BoDs-Yt8,然后 discord 会输出类似的样式像 YouTube 一样嵌入。

关于如何完成的任何想法?

他们肯定会检索嵌入代码(通过 right-clicking 视频和 select 'Copy embed code'),并将其与标题 + 副标题一起添加到消息中。

例如:

<iframe width="1004" height="753" src="https://www.youtube.com/embed/cIwTYL1fwJk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<iframe width="1004" height="753" src="https://www.youtube.com/embed/cIwTYL1fwJk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

非常感谢 @Spectric this is most certainly the answer-ish except it's in a meta tag using OpenGraph,除了一个问题,它不允许您播放自己的自定义文件示例:.mp4's。

OPG 示例:

<meta property="og:url" content="https://www.youtube.com/watch?v=ur3-A7ovGUk">
<meta property="og:image" content="https://i.ytimg.com/vi/ur3-A7ovGUk/maxresdefault.jpg">
<meta property="og:video:type" content="text/html">
<meta property="og:video:url" content="https://www.youtube.com/embed/ur3-A7ovGUk">
<meta property="og:video:height" content="720">
<meta property="og:video:width" content="1280">
<meta property="og:type" content="video.other">

<iframe width="1004" height="753" src="https://www.youtube.com/embed/cIwTYL1fwJk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>