使 youtube.com/embed URLs 在 iOS 上工作 [英] Making youtube.com/embed URLs work on iOS

查看:22
本文介绍了使 youtube.com/embed URLs 在 iOS 上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 YouTube 上的给定视频,您可以在任何 iOS 设备上访问 http://youtube.com/watch?v=[code] 以查看视频.

For a given video on YouTube, you can visit http://youtube.com/watch?v=[code] on any iOS device to see the video.

但是,如果您使用 http://youtube.com/embed/[code] URL - 例如,在页面上的 iframe 或 Colorbox modal — 它不会在 iOS 上播放.

However, if you use the http://youtube.com/embed/[code] URL — for instance, in an iframe on a page or in a Colorbox modal — it will not play on iOS.

例如,如果您使用这样的代码:

For instance, if you use code like this:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">

您只是看到一个错误:

您的浏览器目前无法识别任何可用的视频格式.点击此处访问我们关于 HTML5 视频的常见问题.

Your browser does not currently recognize any of the video formats available. Click here to visit our frequently asked questions about HTML5 video.

雪上加霜的是,该链接在iOS上无法点击,所以我不知道去哪个页面.YouTube 上有一个 HTML5 页面,但它没有说明任何特别有用或令人惊讶的内容.

To add insult to injury, the link is not clickable on iOS, so I don't know what page that goes to. There is an HTML5 page on YouTube, but it says nothing particularly useful or surprising.

是否有一种可以用于 iframe 嵌入的语法,可以在 iOS 上按预期工作?

Is there a syntax that can be for iframe embedding that works as expected on iOS?

推荐答案

试试这个,它确实有效:

Try this, it just works:

<object>
    <param name="movie" value="http://www.youtube.com/v/[VIDEO_ID]"></param>
    <embed src="http://www.youtube.com/v/[VIDEO_ID]" type="application/x-shockwave-flash"></embed>
</object>

编辑:之所以有效,是因为 Apple 将 html 标记替换为可以播放 youtube 视频的嵌入式本机电影播放器​​.

Edit: It works because Apple replaces the html tag with an embedded native movie player that can play the youtube video.

这篇关于使 youtube.com/embed URLs 在 iOS 上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆