Thomas Vanier Thomas Vanier - 7 days ago 5
Javascript Question

Uncaught ReferenceError: ytcfg is not defined (also __ytRIL is not defined)

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>


There several variations of this issue:

https://code.google.com/p/gdata-issues/issues/detail?id=8745 "ytcfg is not defined"
https://code.google.com/p/gdata-issues/issues/detail?id=8668 "__ytRIL is not defined"
https://code.google.com/p/gdata-issues/issues/detail?id=8569 "__ytRIL is not defined"

Answer

The following bug tracks this issue. Please vote on this bug so that it gets their attention. They have been sitting on it for more than 1 month.

https://code.google.com/p/gdata-issues/issues/detail?ID=8745 (fixed)

and a similar bug : https://code.google.com/p/gdata-issues/issues/detail?id=8668 (still active)