for run this code using local environment like vs-code etc.
this snippet working on a computer browser properly when I open the same page using IP on my mobile Chrome browser I got an error, but it works on incognito mode. I don't know why but does anyone has a solution provided in the answer section.
//YouTube embed with YouTube Iframe APIvar tag = document.createElement("script");tag.src = "https://www.youtube.com/iframe_api";var firstScriptTag = document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);// YouTube embed player detailsvar player;function onYouTubeIframeAPIReady() { player = new YT.Player("player", { height: "390", width: "640", videoId: "668nUCeBHyY", //Features playerVars: { controls: 0, rel: 0, disablekb: 1, }, });}//functionsfunction playYT() { player.playVideo();}function pauseYT() { player.pauseVideo();}
<div style="pointer-events:none" id="player"></div><br><br><button onclick="playYT()">Play</button><button onclick="pauseYT()">Pause</button>