Skip to content

Commit

Permalink
minor code refactoring of video
Browse files Browse the repository at this point in the history
  • Loading branch information
shsteimer committed May 7, 2024
1 parent a119a95 commit 9b5613c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions blocks/video/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ function getVideoElement(source, autoplay, background) {
video.addEventListener('loadedmetadata', () => delete video.dataset.loading);
if (autoplay) video.setAttribute('autoplay', '');
if (background) {
video.setAttribute('loop', '');
video.setAttribute('playsinline', '');
video.removeAttribute('controls');
video.addEventListener('canplay', () => {
video.muted = true;
video.play();
});
video.setAttribute('loop', '');
video.setAttribute('playsinline', '');
video.removeAttribute('controls');
video.addEventListener('canplay', () => {
video.muted = true;
video.play();
});
}

const sourceEl = document.createElement('source');
Expand All @@ -76,7 +76,6 @@ function getVideoElement(source, autoplay, background) {
return video;
}


const loadVideoEmbed = (block, link, autoplay, background) => {
if (block.dataset.embedIsLoaded === 'true') {
return;
Expand Down

0 comments on commit 9b5613c

Please sign in to comment.