Skip to content

Commit

Permalink
fix(iframe): loader missing flag check (justinribeiro#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinribeiro committed Nov 26, 2019
1 parent 3a746de commit ff5ae2d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lite-youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,16 @@ class LiteYTEmbed extends HTMLElement {
* @private
*/
__addIframe() {
const iframeHTML = `
if (!this.__iframeLoaded) {
const iframeHTML = `
<iframe frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen
src="https://www.youtube.com/embed/${this.videoId}?autoplay=1&start=${this.videoStartAt}"
></iframe>`;
this.__domRefFrame.insertAdjacentHTML('beforeend', iframeHTML);
this.__domRefFrame.classList.add('lyt-activated');
this.__iframeLoaded = true;
this.__domRefFrame.insertAdjacentHTML('beforeend', iframeHTML);
this.__domRefFrame.classList.add('lyt-activated');
this.__iframeLoaded = true;
}
}

/**
Expand Down

0 comments on commit ff5ae2d

Please sign in to comment.