Answer the question
In order to leave comments, you need to log in
How to change iframe content of youtube video via api?
I use the YouTube API https://www.youtube.com/player_api
The video is embedded in the block on the site as a background I pass the following
parameters
public playerDefaults = {
rel: 0,
loop: 1,
controls: 0,
showinfo: 0,
autoplay: 0 ,
autohide: 1,
playsinline: 1,
modestbranding: 0,
disablekb: 1,
enablejsapi: 0,
origin: window.location.origin,
iv_load_policy: 3
}
the problem is that ads are displayed on the video, the question is how to remove them?
I tried to fit into the iframe of the video, but it doesn’t work, I do it like this:
let iframe = this.tv.getIframe();
let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
I get the error
DOMException: Blocked a frame with origin " https://domain.site " from accessing a cross-origin frame at YoutubeBg.onPlayerReady
Although the origin parameter is passed with the value window.location.origin
There are no explicit parameters for hiding ads.
Answer the question
In order to leave comments, you need to log in
And who gave you permission to change the content from someone else's site?
https://developer.mozilla.org/en/docs/Web/HTTP/CORS
"For security reasons, browsers restrict cross-origin requests initiated by scripts."
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question