在 HTTPS 网站上嵌入 Youtube 时 Internet Explorer 出现警告?

发布于 2024-08-23 14:08:49 字数 1367 浏览 3 评论 0原文

编辑 2011 年 3 月 22 日:这个问题不再那么重要,因为 YouTube 现在提供 HTTPS 访问:http://apiblog.youtube.com/2011/02/https-support-for-youtube-embeds.html


我们的应用程序通过 HTTPS 运行,很少给我们带来任何问题。然而,当谈到 YouTube 时,他们不通过 SSL 连接呈现任何内容,这一事实让我们在尝试嵌入剪辑时感到头疼。主要是因为 Internet Explorer 著名的小警告消息:

“您只想查看网页吗 安全交付的内容? 此页面包含的内容将 不使用安全的 HTTPS 进行传送 ...等等”

我尝试通过多种方式解决这个问题。最有希望的一种是使用 Apache 中的 ProxyPass 功能来映射到 YouTube。

就像这样:

ProxyPass: /youtube/ http://www.youtube.com
ProxyPassReverse: /youtube/ http://www.youtube.com

这消除了烦人的警告。但是,youtube SWF 失败开始流式传输 我设法加载到浏览器中的 SWF 只是声明:“发生错误,请稍后再试”

潜在的解决方案可能是:

  • 下载 youtube FLV:s 并在自己的域之外提供它们(gah)
  • 使用自定义 FLV-。通过 https 代理播放并仅播放来自 YouTube 的 FLV:s?

3 月 10 日更新:我尝试过使用 Googles Youtube API for ActionScript 来加载播放器。起初看起来很有希望,我能够通过我的 https:// 代理加载播放器。但是,SWF加载的内容包含对不同非 ssl url 的显式调用负载,以便为 FLV 流创建身份验证链接并加载不同的跨域策略。

看起来我们确实不应该直接访问 flv 流。这使得绕过 Internet Explorer 警告变得非常困难,除非从 YouTube 中删除 FLV:s 并将其提供给您自己的域。

有一些解决方案可以下载 YouTube FLV:s。但这不符合 YouTube 使用条款,对我们来说确实不是一个选择。

EDIT 22 March 2011: This question is no longer that relevant since Youtube now offers HTTPS access: http://apiblog.youtube.com/2011/02/https-support-for-youtube-embeds.html


Our application is run over HTTPS which rarely presents any problems for us. When it comes to youtube however, the fact that they do not present any content over SSL connections is giving us some head ache when trying to embed clips. Mostly because of Internet Explorers famous little warning message:

"Do you want to view only the webpage
content that was delivered securely?
This page contains content that will
not be delivered using a secure HTTPS
... etc"

I've tried to solve this in several ways. The most promising one was to use the ProxyPass functionality in Apache to map to YouTube.

Like this:

ProxyPass: /youtube/ http://www.youtube.com
ProxyPassReverse: /youtube/ http://www.youtube.com

This gets rid of the annoying warning. However, the youtube SWF fails to start streaming The SWF i manage to load into the browser simply states : "An error occurred, please try again later".

Potential solutions are perhaps:

  • Download youtube FLV:s and serve them out of own domain (gah)
  • Use custom FLV-player and stream only FLV:s from youtube over a https proxy?

Update 10 March: I've tried to use Googles Youtube API for ActionScript to load a player. It looked promising at first and I was able to load a player through my https:// proxy. However, the SWF that is loaded contains loads of explicit calls to different non-ssl urls to create authentication links for the FLV-stream and for loading different crossdomain policies.

It really seems like we're not supposed to access flv-streams directly. This makes it very hard to bypass the Internet Explorer warning, short of ripping out the FLV:s from youtube and serving them out of your own domain.

There are solutions out there for downloading youtubes FLV:s. But that is not compliant with the Youtube terms of use and is really not an option for us.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

浅唱ヾ落雨殇 2024-08-30 14:08:49

好吧,最后我找到了一个解决方案。事实上,它既简单又令人愉快。

使用精彩的 jQuery 插件 YouTubin 的组合,它可以选择通过以下方式包含 YouTube 视频swfobject。 swfobject.js 中的一些魔法只是简单地为我们解决了这个问题。

因此,只要包含 jqueryswfobjectjquery.youtubin您将能够执行以下操作:

$.youtubin();

并且所有包含 youtube-clips 链接的锚链接都将替换为嵌入式 YouTube 播放器。

最后的解决方案来自精彩的 swfobject 项目。不知何故,他们只是解决了这个问题。

这是证据:): http://screencast.com/t/YzVlZjkx

Ok, so finally I've happened upon a solution. And actually it is simple and delightful.

Using a combination of the wonderful jQuery plugin YouTubin which has an option of including youtube videos via swfobject. Some magic in swfobject.js just simply solves this for us.

So as long as you include jquery, swfobject and jquery.youtubin you will be able to do this:

$.youtubin();

And all anchor links containing links to youtube-clips will be replaced with embedded youtube players.

In the end the solution comes from the wonderful swfobject project. Somehow, they just fix this.

Here's the proof :): http://screencast.com/t/YzVlZjkx

四叶草在未来唯美盛开 2024-08-30 14:08:49

您可以使用 swfobject,这实际上是 youtubin 所做的一切。

http://code.google.com/p/swfobject/

You can use swfobject, which is really all youtubin is doing.

http://code.google.com/p/swfobject/

顾忌 2024-08-30 14:08:49

好消息 - Youtube 的标准嵌入 URL 可以提供 https 前缀,而不是 http 前缀。与 swfobject 结合使用,效果很好。

swfobject.embedSWF("https://www.youtube.com/v/Zm80UedfaxA&enablejsapi=1&playerapiid=hPatentplayer", "Patentplayer", "586", "351", "9.0.0", "custom/expressInstall .swf", null, params, atts);

Good news - the standard embed URL's of Youtube can be provided with https prefix instead of http prefix. Combined with the swfobject, this works fine.

swfobject.embedSWF("https://www.youtube.com/v/Zm80UedfaxA&enablejsapi=1&playerapiid=hpatientplayer", "patientplayer", "586", "351", "9.0.0", "custom/expressInstall.swf", null, params, atts);

绿萝 2024-08-30 14:08:49

只需使用 SWFOBJECT... 就解决了我的问题

<script type="text/javascript" src="js/swfobject.js"></script>

<div id="quibskiplayer"></div>

<script type="text/javascript">
// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)

var videoID = "";  // REPLACE VIDEO IT HERE
var divID = "quibskiplayer";  //PLACE ID OF DIV TO BE REPLACED HERE 
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer" };

swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1",  divID, "325", "225", "8", null, null, params, atts);

</script>

并且在任何情况下您都不希望用户找到视频 ID,您可以在 PHP 中执行以下操作:

$src = $row['youtube_embedd']; // $src is the entire Embedd code
$regex_pattern = '/youtube\.com\/(v\/|watch\?v=)([\w\-]+)/';
preg_match($regex_pattern,$src,$output);
$videoID = $output[2];

TECHFORGE 在线

Just use SWFOBJECT... which solved my problem

<script type="text/javascript" src="js/swfobject.js"></script>

<div id="quibskiplayer"></div>

<script type="text/javascript">
// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)

var videoID = "";  // REPLACE VIDEO IT HERE
var divID = "quibskiplayer";  //PLACE ID OF DIV TO BE REPLACED HERE 
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer" };

swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1",  divID, "325", "225", "8", null, null, params, atts);

</script>

And in any case you dont want your user to find out the video ID, you may just do something like this in PHP:

$src = $row['youtube_embedd']; // $src is the entire Embedd code
$regex_pattern = '/youtube\.com\/(v\/|watch\?v=)([\w\-]+)/';
preg_match($regex_pattern,$src,$output);
$videoID = $output[2];

TECHFORGE ONLINE

绮筵 2024-08-30 14:08:49

我知道这已经很旧了,但我解决了谷歌糟糕的 YouTube 证书和 IE7 播放问题的 BS。

您必须嵌入 AS3 播放器。我用 swfObject 做到了,因为我需要控制电影等。

enter code here
var params = {allowScriptAccess:"always",wmode:"transparent"};
var atts1 = {id:"myytplayer1"};
var atts2 = {id:"myytplayer2"};
var atts3 = {id:"myytplayer3"};         
swfobject.embedSWF("https://www.youtube.com/v/xxxxx?version=3&autohide=1&controls=0&enablejsapi=1&fs=1&rel=0&iv_load_policy=3&feature=player_embeded&playerapiid=ytplayer1","video1R", "260", "150", "8", null, null, params, atts1);  
swfobject.embedSWF("https://www.youtube.com/v/xxxxx?version=3&autohide=1&controls=0&enablejsapi=1&fs=1&rel=0&iv_load_policy=3&feature=player_embeded&playerapiid=ytplayer2","video2R", "260", "150", "8", null, null, params, atts2);
swfobject.embedSWF("https://www.youtube.com/v/xxxxx?version=3&autohide=1&controls=0&enablejsapi=1&fs=1&rel=0&iv_load_policy=3&feature=player_embeded&playerapiid=ytplayer3","video3R", "260", "150", "8", null, null, params, atts3);    

function onYouTubePlayerReady(playerId) {
 ytplayer1 = document.getElementById("myytplayer1");
 ytplayer2 = document.getElementById("myytplayer2");
 ytplayer3 = document.getElementById("myytplayer3");
}

function pauseYTVideo(divId){
   if (divId.substr(5,1) == 1) ytplayer1.pauseVideo();
   if (divId.substr(5,1) == 2) ytplayer2.pauseVideo();
   if (divId.substr(5,1) == 3) ytplayer3.pauseVideo();
}

I know this is old but I worked through the BS that is Google bad YouTube Cert and IE7 playback issues.

You have to embed the AS3 player. I did it with swfObject as I neede to control the movies et al..

enter code here
var params = {allowScriptAccess:"always",wmode:"transparent"};
var atts1 = {id:"myytplayer1"};
var atts2 = {id:"myytplayer2"};
var atts3 = {id:"myytplayer3"};         
swfobject.embedSWF("https://www.youtube.com/v/xxxxx?version=3&autohide=1&controls=0&enablejsapi=1&fs=1&rel=0&iv_load_policy=3&feature=player_embeded&playerapiid=ytplayer1","video1R", "260", "150", "8", null, null, params, atts1);  
swfobject.embedSWF("https://www.youtube.com/v/xxxxx?version=3&autohide=1&controls=0&enablejsapi=1&fs=1&rel=0&iv_load_policy=3&feature=player_embeded&playerapiid=ytplayer2","video2R", "260", "150", "8", null, null, params, atts2);
swfobject.embedSWF("https://www.youtube.com/v/xxxxx?version=3&autohide=1&controls=0&enablejsapi=1&fs=1&rel=0&iv_load_policy=3&feature=player_embeded&playerapiid=ytplayer3","video3R", "260", "150", "8", null, null, params, atts3);    

function onYouTubePlayerReady(playerId) {
 ytplayer1 = document.getElementById("myytplayer1");
 ytplayer2 = document.getElementById("myytplayer2");
 ytplayer3 = document.getElementById("myytplayer3");
}

function pauseYTVideo(divId){
   if (divId.substr(5,1) == 1) ytplayer1.pauseVideo();
   if (divId.substr(5,1) == 2) ytplayer2.pauseVideo();
   if (divId.substr(5,1) == 3) ytplayer3.pauseVideo();
}
尐偏执 2024-08-30 14:08:49

我们刚刚遇到了这种性质的问题,IE7 会抛出通过 SSL 嵌入的 YouTube 视频的混合媒体错误。事实是,他们通过 https 的本机播放器根本不是 SSL。如果您查看调用该单元时页面所使用的资源,您会发现它通过 HTTP 从静态服务器调用文件。他们针对 Flash 版本和 JavaScript 版本的检测脚本也从 HTTP 地址调用。

IE 将根据此信息抛出错误。

但有一个非常简单的解决方法!使用 YouTube 无 Chrome API。该播放器不会调用任何额外的文件来操作,它是一个纯粹的现成可用的解决方案。这是一个更可靠的播放器,它使您可以通过外部元素更好地控制播放器。

http://code.google.com/apis/youtube/youtube_player_demo.html

we just came across an issue of this nature with IE7 throwing a mixed media error with YT Videos embedded over SSL. The truth is, their native player over https is not SSL at all. If you look at the resources being used by the page when the unit is called, it called files from a static server via HTTP. Their detection scripts for Flash versions and JavaScript versions also call from a HTTP address.

IE will throw an error based of this information.

But there is a very easy fix! Use the YouTube Chromeless API. That player does not call any additional files to operate, its a pure ready to use solution for the matter. This is a much more reliable player and it gives you far greater player control from external elements.

http://code.google.com/apis/youtube/youtube_player_demo.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文