1
0
Fork 0
mirror of https://github.com/lrsjng/h5ai synced 2026-01-03 22:52:24 +01:00

autoplay fix

This commit is contained in:
shirtjs 2021-04-16 13:33:58 -04:00
parent aa94de4945
commit 5666ee9898
2 changed files with 12 additions and 0 deletions

View file

@ -37,6 +37,12 @@ const load = item => {
.attr('controls', 'controls');
if (settings.autoplay) {
$el.attr('autoplay', 'autoplay');
$el.on('loadeddata', () => {
var isPlaying = $el[0].currentTime > 0 && !$el[0].paused && !$el[0].ended;
if (!isPlaying) {
$el[0].play();
}
});
}
addUnloadFn($el[0]);
$el.attr('src', item.absHref);

View file

@ -41,6 +41,12 @@ const load = item => {
.attr('controls', 'controls');
if (settings.autoplay) {
$el.attr('autoplay', 'autoplay');
$el.on('loadeddata', () => {
var isPlaying = $el[0].currentTime > 0 && !$el[0].paused && !$el[0].ended;
if (!isPlaying) {
$el[0].play();
}
});
}
addUnloadFn($el[0]);
$el.attr('src', item.absHref);