add autoload option, fix rare loading issue
This commit is contained in:
parent
6b37b1af89
commit
060046ffe9
2 changed files with 13 additions and 0 deletions
|
@ -125,6 +125,14 @@ And that's it! you can upload the files to your website, or zip them up and uplo
|
|||
`feature` (optional)
|
||||
> If `true`, sets this file as the "featured" track, which will queue up first when loading the page.
|
||||
> Can be either `true` or `false`
|
||||
> Defaults to `false`
|
||||
|
||||
\
|
||||
`autoload` (optional)
|
||||
> If `true` and `feature` is also `true`, this track will play after loading.
|
||||
> **NOTE:** this *will not* work in most cases, due to browsers preventing autoplaying audio until the user interacts with the page. This will only be relevant if the player is loaded after user interaction, e.g. when running on itch.io with autoload disabled.
|
||||
> Can be either `true` or `false`
|
||||
> Defaults to `false`
|
||||
|
||||
\
|
||||
`type` (optional)
|
||||
|
|
|
@ -1114,11 +1114,16 @@
|
|||
});
|
||||
loaderEl.addEventListener('canplay', e => {
|
||||
removeLoading(entry, true);
|
||||
|
||||
if(entry.feature && entry.autoplay){
|
||||
playerEl.play();
|
||||
}
|
||||
});
|
||||
loaderEl.volume = 0;
|
||||
loaderEl.src = entry.file;
|
||||
entry.started = false;
|
||||
entry.loading = true;
|
||||
entry.loaderEl = loaderEl;
|
||||
}
|
||||
});
|
||||
loadEntry(media[mod(featureIndex, media.length)]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue