首页 > 解决方案 > Youtube 视频在 iframe 标记中给出,但在 Safari 浏览器中不起作用

问题描述

<iframe width="100%" height="500" src="https://www.youtube.com/embed/alswD2tCc_Q?rel=0" frameborder="0" allowfullscreen=""></iframe>

大家好,

以上是我的代码。该视频可在除 Safari 之外的所有浏览器中运行。你们能帮我解决这个问题吗?

提前致谢。

标签: htmlvideoiframeyoutube

解决方案


Safari 需要网络服务器支持“[Range][1]”请求标头才能播放您的媒体内容。

https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6

对于合法的“范围”请求响应,您的 webserve 需要返回状态代码“206”。


推荐阅读