通过企业代理的后备解决方案嵌入 YouTube 视频
我想知道你们中是否有人遇到过允许嵌入 YouTube 视频和后备解决方案的解决方案/功能,其中如果 YouTube 视频 - 并且仅是视频,则选择替代视频源! - 被阻止。
我们的一位企业客户可以通过代理服务器访问网络,该服务器会清除 YouTube 提供的 Flash 内容。更具体地说,从 ytimg.com 提供的任何内容都会被阻止。由于他们的网站上有大量的产品视频,他们发现客户可以在他们的网站上观看视频,而他们自己的员工却不能,这很烦人。
有什么建议吗?
I am wondering whether any of you have ever come accross a solution/function that allows embedding YouTube videos with a fallback solution where an alternative video source is selected if YouTube videos - and the videos only! - are blocked.
One of our corporate clients have access to the web via a proxy server that weeds out flash content served form YouTube. More specifically anything served from ytimg.com is blocked. Since their website is quite heavy on product videos they find it annoying to boot that clients can watch videos on their site while their own staff can't.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该尝试向 youTube 中托管的内容发出 Ajax 请求,我会这样说:
You should try to make an Ajax request to something hosted in youTube, i would say something like this:
需要澄清的是,Youtube 的 Flash 播放器与其播放的 FLV 或 MP4 文件是不同的。虽然 Flash 播放器可能由 *.ytimg.com 提供服务,但流本身来自“oo.preferred.lga15s18.v2.lscache6.c.youtube.com”等主机。
如果您的客户阻止前者,那么您将无法使用 Youtube 来观看视频。我的方法是从一个页面启动您的视频,该页面具有某种自动化功能,可以识别您客户的 IP 地址范围并加载您自己的 jwplayer 或 flowplayer 或类似的东西。
虽然您可以使用 ajax 调用之类的方法在浏览器端执行此操作,但您仍然面临着过于保守的企业 IT 禁用 JavaScript 的风险。 (我已经看到它发生了。这并不漂亮。)将“智能”放在您的服务器上可以让您掌控一切,当然这意味着您需要提前知道限制是什么,以便您可以进行调整。
It should be clarified that Youtube's Flash player is a different thing than the FLV or MP4 file that it plays. While the Flash player may be served from *.ytimg.com, the streams themselves come from hosts like "o-o.preferred.lga15s18.v2.lscache6.c.youtube.com".
If your client is blocking the former, then you can't use Youtube to get at the videos. My approach would be to launch your videos from a page that has some sort of automation to recognize your client's IP address range and load up your own copy of jwplayer or flowplayer or somesuch.
While you could do this browser-side using something like an ajax call, you still run the risk of overly-conservative corporate IT disabling javascript. (I've seen it happen. It's not pretty.) Putting the "smarts" on your server leaves you in control, though of course it means you need to know ahead of time what the restrictions are, so that you can adjust for them.
构建页面时,您可以测试与 ytimg.com 的工作连接,并相应地更新用于显示的 iframe 源...
或者,您可以礼貌地建议您的客户不要那么强硬并允许员工在工作时偶尔使用 YouTube 休息一下。
编辑开玩笑吧,我是个白痴。使用上面 camilo_u 的建议。
When building the page, you could test for a working connection to ytimg.com, and update the source of the iframe you're using for display accordingly...
Alternatively, you could politely suggest that your client not be such a hard-ass and allow their employees the occasional YouTube break at work.
EDIT Just kidding, I'm an idiot. Use camilo_u's suggestion above.