Make sure the video rectangle has an id.
In this example it is video1
We have the button run a Hype function that runs
var playerIFrameID = "video1";
var palyPause = element.innerText
palyPause == 'Pause' ? (
element.innerText = 'Play'
) : (
element.innerText = 'Pause'
);
var youtube_command = window.JSON.stringify( { event: 'command', func: palyPause.toLowerCase() + 'Video' } );
document.getElementById(playerIFrameID).firstElementChild.contentWindow.postMessage( youtube_command, '*' );
player 3.hype.zip (14.6 KB)
ref: