Skip to content

Commit 492b090

Browse files
committed
js fix
1 parent 0908a34 commit 492b090

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

assets/src/vidstack_helper.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
}
8585

8686
// Initialize on various events (cover different CMS scenarios)
87-
['DOMContentLoaded', 'vsrun'].forEach(event =>
87+
['DOMContentLoaded', 'load', 'vsrun'].forEach(event =>
8888
document.addEventListener(event, vidstackInitialize)
8989
);
9090

@@ -100,8 +100,9 @@
100100
});
101101
}
102102

103-
// If already loaded, initialize immediately
104-
if (['complete', 'interactive'].includes(document.readyState)) {
103+
// If DOM is already ready or script loads late (e.g., with defer), initialize immediately
104+
if (document.readyState === 'complete' ||
105+
(document.readyState === 'interactive' && document.body)) {
105106
vidstackInitialize();
106107
}
107108
})();

assets/vidstack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)