Html 如何使用 URL 嵌入视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10436658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to embed a video using URL
提问by Robert Smith
Quick question:
快速提问:
Is there a general way in which I can embed a video using a URL instead of using 'embed codes' such as <iframe src="http://player.vimeo.com/video/41406753?byline=0&portrait=0" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
or <iframe width="560" height="315" src="http://www.youtube.com/embed/JEPYYo0-gfc" frameborder="0" allowfullscreen></iframe>
).
有没有一种通用的方法可以使用 URL 而不是使用“嵌入代码”(例如<iframe src="http://player.vimeo.com/video/41406753?byline=0&portrait=0" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
或<iframe width="560" height="315" src="http://www.youtube.com/embed/JEPYYo0-gfc" frameborder="0" allowfullscreen></iframe>
)来嵌入视频。
Do I need to manage each case in a separate manner? (extracting ids and constructing a proper iframe tag).
我是否需要以单独的方式管理每个案例?(提取 id 并构建适当的 iframe 标记)。
Thanks
谢谢
回答by sarahholden
I would recommend using oEmbed. According to their official website, "oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly." http://oembed.com/
我建议使用 oEmbed。根据他们的官方网站,“oEmbed 是一种允许在第三方网站上嵌入 URL 表示的格式。当用户发布指向该资源的链接时,简单的 API 允许网站显示嵌入的内容(例如照片或视频) ,而无需直接解析资源。” http://oembed.com/
回答by Valeria Antunez
This code it's going to help you..
这段代码会帮助你..
<iframe width="425" height="344"
src="https://www.microsoft.com/es-es/videoplayer/embed/RWfmWf?pid=ocpVideo0-innerdiv-oneplayer&postJsllMsg=true&maskLevel=20&market=es-es"
frameborder="0" allowfullscreen></iframe>
you might note src's line... that's the place where you have to write your own URL.
您可能会注意到 src 的行...那是您必须编写自己的 URL 的地方。