HTML5<视频>适用于 YouTube视频>
我正在开发一个网站,通过 iBooks 专门为 iPad 创建动态 ePub 电子书。
它需要支持 youtube 视频播放,因此当我知道视频的直接路径时,我使用有效的 html5
有没有办法使用 html5 标签嵌入 youtube 视频,而不是使用 youtube 嵌入代码?
I am working on a site that creates dynamic ePub ebooks specifically for iPad, via iBooks.
It needs to support youtube video playback, so I am using the html5 <video>
tag which is working, when I know the direct path to the video.
Is there a way to embed a youtube video using the html5 <video>
tag, as opposed to using the youtube embed code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ClickToPlugin(又名 ClickToFlash)Safari 扩展能够用
< 替换 YouTube 嵌入内容视频>
。也许执行此操作的代码可能是使用。它看起来很复杂,因为它正在处理许多不同类型的嵌入,但也许您可以找出适合您的情况的具体结果 - 或者,创建一个嵌入视频的网页,应用 ClickToFlash,然后查看它在 Web 中生成的结果督察。
The ClickToPlugin (a.k.a. ClickToFlash) Safari extension is capable of replacing YouTube embeds with
<video>
. Perhaps its code for doing that may be of use.It looks complicated because it is handling many different kinds of embeds, but perhaps you can figure out the specific result for your case — or, create a web page with the video embedded, apply ClickToFlash, and look at the result it produces in the Web Inspector.
YouTube 的 HTML5 嵌入代码似乎可以在 iPad 上的 iBooks 上正常工作,无需
标签。
Youtube's HTML5 embed code seems to work ok natively with iBooks on the iPad, without the need for
<video>
tags.YouTube 不会公开其视频的直接 URL。如果他们这样做,他们就无法跟踪观看次数、投放广告、允许视频所有者控制其分发,也无法使用他们的徽标来为播放器打上品牌烙印。
您可以尝试设计一些方法来解决这个问题,但是绕过 YouTube 播放器意味着绕过他们控制内容的能力,这是可以理解的,他们的服务条款禁止这样做:
如果您希望视频在发布后继续运行,那么这不是一个好计划你的内容。
相反,最好的选择是使用 YouTube 提供的选项,让您可以控制向嵌入式播放器呈现的体验。
不幸的是,目前唯一支持的选项是
IFrame 方法是目前最好的可用选项,此标签展示了如何调整嵌入 URL 以获得仅包含最少 YouTube 功能的播放器:
此处使用的参数是:
您可以在此处找到支持参数的完整列表:https://developers.google.com/youtube/player_parameters#Parameters
我知道这不是答案你在追求,但它不太可能很快改变,正如另一位响应者提到的,这种方法确实有效。事实上,在数字印刷出版物中呈现联网视频是当前的行业惯例。
祝你好运!
YouTube does not expose the direct URLs to their videos. If they did that, they couldn't track the views, serve ads, allow the owner of the video control over its distribution, or brand the player with their logo.
You could try to devise something to get around this, but bypassing the YouTube player means bypassing their ability to control content, something that is understandably prohibited by their ToS:
Not a great plan if you want your video to keep running once you've published your content.
Instead, your best bet is to use the options that YouTube does expose to allow you to control the experience you present to an embedded player.
Unfortunately, the only supported options right now are an <embed> tag and an <iframe> tag, and the <embed> tag would restrict you to Flash.
The IFrame approach is the best available option right now, and this tag shows how to twiddle your embed URL to get a player that includes only a minimum of YouTube-ness:
The parameters in use here are:
You can find a full list of supported parameters here: https://developers.google.com/youtube/player_parameters#Parameters
I know it's not the answer you're after, but it's unlikely to change anytime soon, and as another responder mentioned, this approach does work. In fact, it is current industry practice for presenting connected video in digital print publications.
Good luck!