Play Vimeo Video with Javascript

Hi @jon4896

I’ve changed the vimeo_play() code so you can now play anywhere you call this code

• change var playerFrameID … to … window.playerFrameID (to make it global) in vimeo_code() and
• Place this in the vimeo_play() function:


	post('play');
		
	
	// Helper function for sending a message to the player
	function post(action, value) {
	        var data = {
			method: action
		};
	
		if (value) {
			data.value = value;
		}
	
		var message = JSON.stringify(data);
		document.getElementById(playerIFrameID).firstElementChild.contentWindow.postMessage(message, "*");
	}