我们在基于Cordova的混合应用程序中使用YouTube嵌入式播放器。该应用程序在全球范围内拥有大量流量。
当某些用户在不清楚的情况下尝试播放任何视频时,播放器会向他们显示“ 请单击此处以在YouTube上观看此视频 ”消息。
我们看不到清晰的图案,它似乎并不取决于用户所在的国家或视频的限制。
我们已经在播放器代码(https://www.youtube.com/yts/jsbin/player_ias-vflrnurMS/en_US/base.js)中看到,消息已分配给名为“ TOO_MANY_REQUESTS_WITH_LINK ” 的常量,但数量不多每个用户的请求数,配额不能像其他Google API一样配置。
我们遵循iFrame API参考:https : //developers.google.com/youtube/iframe_api_reference?hl= zh-CN
<iframe id="player" src="https://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&cc_load_policy=0&controls=0&disablekb=1&enablejsapi=1&fs=0&iv_load_policy=3&loop=0&modestbranding=1&playsinline=1&rel=0&showinfo=0&wmode=transparent&origin=XXX" frameborder="0"></iframe>
<script type="text/javascript">
var player,
scriptTag = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0];
scriptTag.src = "https://www.youtube.com/iframe_api";
firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag);
function onYouTubeIframeAPIReady() {
var options = JSON.parse('{"autoplay":1,"cc_load_policy":0,"controls":0,"disablekb":1,"enablejsapi":1,"fs":0,"iv_load_policy":3,"loop":0,"modestbranding":1,"playsinline":1,"rel":0,"showinfo":0,"wmode":"transparent","origin":"XXX"}');
if (!options.origin) {
options.origin = location.origin ||
location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
}
player = new YTRemoteVPlayer('player', '<%-videoId%>', options);
}
</script>
Run Code Online (Sandbox Code Playgroud)
有谁知道会发生什么情况以及如何解决?