Skip to content

Commit 246a265

Browse files
committed
fix an issue where some mobile browser (e.g. safari) would not emit the canplay event for video assets if autoplay is disabled
1 parent a5e1587 commit 246a265

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [16.1.1] (melonJS 2) - _2024-02-06_
4+
5+
### Fixed
6+
- Loader: fix an issue where some mobile browser (e.g. safari) would not emit the canplay event for video assets if autoplay is disabled
7+
38
## [16.1.0] (melonJS 2) - _2024-02-06_
49

510
### Added

src/loader/parsers/video.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export function preloadVideo(data, onload, onerror) {
6262
}
6363

6464
if (typeof onload === "function") {
65-
if (data.stream === true) {
65+
// some mobile browser (e.g. safari) won't emit the canplay event if autoplay is disabled
66+
if (data.stream === true || data.autoplay === false) {
6667
videoElement.onloadedmetadata = () => {
6768
if (typeof onload === "function") {
6869
onload();

0 commit comments

Comments
 (0)