📌  相关文章
📜  如何停止 ionic 的 youtube 视频 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:59.083000             🧑  作者: Mango

代码示例1
ionViewWillLeave() {
    let listaFrames = document.getElementsByTagName("iframe");
    for (var index = 0; index < listaFrames.length; index++) {
        let iframe = listaFrames[index].contentWindow;          
        iframe.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
     }
}

//Don't forget to enable JS at the end of the video link *?enablejsapi=1