Skip to content

Commit 9b5613c

Browse files
committed
minor code refactoring of video
1 parent a119a95 commit 9b5613c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

blocks/video/video.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ function getVideoElement(source, autoplay, background) {
5959
video.addEventListener('loadedmetadata', () => delete video.dataset.loading);
6060
if (autoplay) video.setAttribute('autoplay', '');
6161
if (background) {
62-
video.setAttribute('loop', '');
63-
video.setAttribute('playsinline', '');
64-
video.removeAttribute('controls');
65-
video.addEventListener('canplay', () => {
66-
video.muted = true;
67-
video.play();
68-
});
62+
video.setAttribute('loop', '');
63+
video.setAttribute('playsinline', '');
64+
video.removeAttribute('controls');
65+
video.addEventListener('canplay', () => {
66+
video.muted = true;
67+
video.play();
68+
});
6969
}
7070

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

79-
8079
const loadVideoEmbed = (block, link, autoplay, background) => {
8180
if (block.dataset.embedIsLoaded === 'true') {
8281
return;

0 commit comments

Comments
 (0)