当存在mdl js时,不会触发iframe api onStateChange。
See codepen
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
控制台将记录更改。
link ,iFrame Player API出现临时问题,作为临时修复,您只需要在 onReady
onReady
function onReady() { player.addEventListener('onStateChange', function(e) { console.log('State is:', e.data); }); }
确保卸下 onStateChange YT的事件。玩家构造函数 (see the jsfiddle)
onStateChange