I’m trying to mute an embed video from youtube in a rectangle’s inner html
<iframe id="ytplayer" width="1080" height="920" src="https://www.youtube.com/embed/uMJpLCmRweA?&html5-1&enablejsapi=1&autoplay=1" frameborder="0" allowfullscreen=""></iframe>
and then running the following function on Scene Load:
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('ytplayer', {
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady() {
player.playVideo();
// Mute!
player.mute();
}
It works fine normal HTML files which means the code is OK, but it’s not working in hype 3 pro.
Can someone help me ?
tks