要解决此问题,需要在代码中进行哪些调整?
代码: https://jsfiddle.net/0bnrg3k1/2/
function onPlayerStateChange(event) {
const player = event.target;
const playerVars = player.b.b.playerVars;
if (playerVars.loop && event.data === YT.PlayerState.ENDED) {
player.seekTo(playerVars.start);
}
}
答案 0 :(得分:1)
您需要使用player.b.b.playerVars
来代替player.g.g.playerVars
。
function onPlayerStateChange(event) {
const player = event.target;
const playerVars = player.g.g.playerVars;
if (playerVars.loop && event.data === YT.PlayerState.ENDED) {
player.seekTo(playerVars.start);
}
}