问题描述
我几个月来一直使用YouTube IFrame播放器API并且最近在播放器加载时开始看到此异常:
未捕获的ReferenceError:ytcfg未定义
检查iframe,我看到成功调用 yt.setConfig
,但是 ytcfg.set
以后失败了。 API最近有变化吗?任何播放器参数都可能导致此问题?
I have been using the YouTube IFrame Player API without problem for months and started to see this exception recently when the player loads:Uncaught ReferenceError: ytcfg is not defined
Inspecting the iframe, I see a successful call to yt.setConfig
, but ytcfg.set
fails later. Was the API changed recently? Any player parameter could cause this problem?
<script src="//s.ytimg.com/yts/jsbin/www-embed-player-vflnzmqns/www-embed-player.js" type="text/javascript" name="www-embed-player/www-embed-player"></script>
<script src="//s.ytimg.com/yts/jsbin/player-en_US-vflr--npw/base.js" name="player/base"></script>
<script>
yt.setConfig({
...
});
writeEmbed();
</script>
<script>
ytcsi.info('st', 35);
ytcfg.set({
"TIMING_ACTION": "",
"CSI_VIEWPORT": true,
"TIMING_INFO": {
"c": "WEB",
"yt_li": 1,
"cver": "1.20161112",
"yt_lt": "cold"
},
"CSI_SERVICE_NAME": "youtube"
});
;</script>
此问题存在多种变体:
__ytRIL未定义
https://issuetracker.google.com/issues/35178202 "ytcfg is not defined"https://issuetracker.google.com/issues/35177930 "__ytRIL is not defined"
推荐答案
这是Google的错误。它也发生在Youtube的开发者页面上。
This is a Google bug. It also happens on Youtube's developer page. https://developers.google.com/youtube/youtube_subscribe_button
以下错误可以解决此问题。
The following bugs tracks this issue.
(仍然活跃 - Jan 2017年5月*)
https://code.google.com/p/gdata-issues/issues/detail?id=8569 (Still active -as of Jan 5h 2017)
请使用以下链接对此错误进行投票,以便引起他们的注意。他们自9月以来一直坐在上面2016年9月!!
Please up vote on this bug using the links below so that it gets their attention. They have been sitting on it since Sep 9, 2016!!.
这篇关于未捕获的ReferenceError:未定义ytcfg(也未定义__ytRIL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!