Skip to content

Commit e7740bb

Browse files
Fix rich media issues (multiple 3D models, video looping and media pausing) (#679)
1 parent 7786f95 commit e7740bb

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

assets/global.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function pauseAllMedia() {
9696
});
9797
document.querySelectorAll('video').forEach((video) => video.pause());
9898
document.querySelectorAll('product-model').forEach((model) => {
99-
if (model.modelViewerUI) modelViewerUI.pause();
99+
if (model.modelViewerUI) model.modelViewerUI.pause();
100100
});
101101
}
102102

@@ -454,6 +454,7 @@ class ModalDialog extends HTMLElement {
454454
this.setAttribute('open', '');
455455
if (popup) popup.loadContent();
456456
trapFocus(this, this.querySelector('[role="dialog"]'));
457+
window.pauseAllMedia();
457458
}
458459

459460
hide() {

sections/featured-product.liquid

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@
367367

368368
hide() {
369369
super.hide();
370-
window.pauseAllMedia();
371370
}
372371

373372
show(opener) {

sections/main-product.liquid

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@
416416

417417
hide() {
418418
super.hide();
419-
window.pauseAllMedia();
420419
}
421420

422421
show(opener) {

snippets/product-media.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
{{ media | external_video_url: autoplay: true, loop: loop | external_video_tag: class: video_class, loading: "lazy" }}
7575
{%- endif -%}
7676
{%- when 'video' -%}
77-
{{ media | media_tag: image_size: "2048x", autoplay: true, loop: enable_video_looping, controls: true, preload: "none", autoplay: true }}
77+
{{ media | media_tag: image_size: "2048x", autoplay: true, loop: loop, controls: true, preload: "none", autoplay: true }}
7878
{%- when 'model' -%}
7979
{{ media | media_tag: image_size: "2048x", toggleable: true }}
8080
{%- endcase -%}

0 commit comments

Comments
 (0)