how to play youtube auto video in ionic app code example

Example 1: how to stop youtube video for ionic

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

Example 2: ionic open youtube app, '_system');


Misc Example