YouTube嵌入式视频无法在Chrome上运行 [英] Youtube embedded video does not work on chrome

查看:268
本文介绍了YouTube嵌入式视频无法在Chrome上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月以来,我一直注意到嵌入的youtube视频在其他任何页面上显示为白色,现在我发现可以通过查看页面并放置 -nocookie 在iframe src的主机名上,即


For months I've been noticing embedded youtube videos appear white on any other page, now I found out that I can watch those videos by inspecting the page and putting -nocookie at the hostname of the iframe src, i.e. https://www.youtube-nocookie.com/embed/(VIDEO_ID). I want to know why this happen and how to fix it, my first thought was to make an userscript to change it in every page.

EDIT: It works fine on Edge and Firefox but not on Chrome, even though my settings for cookies are enabled.

SOLUTION: The problem was that my userscript on Tampermonkey extension (which was supposed to affect the youtube page) was affecting every page with an embedded video, from now on I can figure it out what part of the code was doing that but for now it's turned off.

Thanks to @JasonB for the suggestion about extensions.

解决方案

This -nocookie url came out almost a decade ago when cookies were still often turned off. This codepen shows that the standard youtube embed code works just fine on a simple site.

<iframe width="400" height="300" 
src="https://www.youtube.com/embed/9Ht5RZpzPqw" frameborder="0" 
gesture="media" allow="encrypted-media" allowfullscreen=""></iframe>

https://codepen.io/anon/pen/baqdGz

Are there any details about your domain or a link to a broken embedded video on your site that might help us better troubleshoot your issue?


The thumbnail worked just fine, I left it open for 5 minutes and then played the video, and that is all functional. Looks like there's one js error related to the codepen setup - not what you're experiencing.

这篇关于YouTube嵌入式视频无法在Chrome上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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