Youtube Not playing Inline goes fullscreen

as the title says i can’t play youtube videos inline i’m using iframe here is what i’ve done so far…

< iframe … src=“https://www.youtube.com/embed/video_id?playsinline=1” …>

createiframe(){

var element = document.getElementById(“iframeView”);
if (element !== null) {
element.parentNode.removeChild(element);
}
var target = document.getElementById(“iframeParent”);
var newFrame = document.createElement(“iframe”);
newFrame.setAttribute(“id”, “iframeView”);
newFrame.setAttribute(“class”, “selectedVideo”);
newFrame.setAttribute(“src”, this.selectedVideo);
newFrame.height=“100%”;
newFrame.width=“100%”;
newFrame.id=“iframeView”;
newFrame.setAttribute(“frameborder”, “0”);
newFrame.setAttribute(“allow”, “accelerometer; encrypted-media; gyroscope; picture-in-picture”);
newFrame.setAttribute(“allowfullscreen”, “”)
if (target !== null) {
target.appendChild(newFrame);
let iframe = document.getElementById(‘iframe’) as HTMLIFrameElement
if(iframe){
iframe.contentWindow.document.getElementById(“player”).firstElementChild.firstElementChild.firstElementChild.setAttribute(“autoplay”, “”);
iframe.contentWindow.document.getElementById(“player”).firstElementChild.firstElementChild.firstElementChild.setAttribute(“loop”, “”);
iframe.contentWindow.document.getElementById(“player”).firstElementChild.firstElementChild.firstElementChild.setAttribute(“muted”, “”);
iframe.contentWindow.document.getElementById(“player”).firstElementChild.firstElementChild.firstElementChild.setAttribute(“playsinline”, “”);
}

}

}

I’m creating iframe from ts file because of loading plugin…
when i inspect the iframe in chrome it looks like this:

< iframe id=“iframeView” class=“selectedVideo” src=“https://www.youtube.com/embed/video_id?playsinline=1” height=“100%” width=“100%” frameborder=“0” allow=“accelerometer; encrypted-media; gyroscope; picture-in-picture” allowfullscreen="">

.
.
.

< video tabindex="-1" class=“video-stream html5-main-video” webkit-playsinline="" playsinline="" controlslist=“nodownload” style=“width: 1536px; height: 150px; left: 0px; top: -150px;”>