mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
Handle resolved play promise
It seems that without processing the Promise resolution, there is no subscription to the error event.
This commit is contained in:
parent
c2629b5c3f
commit
8aa6088e24
@ -200,17 +200,22 @@ import { Events } from 'jellyfin-apiclient';
|
|||||||
const promise = elem.play();
|
const promise = elem.play();
|
||||||
if (promise && promise.then) {
|
if (promise && promise.then) {
|
||||||
// Chrome now returns a promise
|
// Chrome now returns a promise
|
||||||
return promise.catch(function (e) {
|
return promise
|
||||||
const errorName = (e.name || '').toLowerCase();
|
.then(() => {
|
||||||
// safari uses aborterror
|
|
||||||
if (errorName === 'notallowederror' ||
|
|
||||||
errorName === 'aborterror') {
|
|
||||||
// swallow this error because the user can still click the play button on the video element
|
|
||||||
onSuccessfulPlay(elem, onErrorFn);
|
onSuccessfulPlay(elem, onErrorFn);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
})
|
||||||
return Promise.reject();
|
.catch((e) => {
|
||||||
});
|
const errorName = (e.name || '').toLowerCase();
|
||||||
|
// safari uses aborterror
|
||||||
|
if (errorName === 'notallowederror' ||
|
||||||
|
errorName === 'aborterror') {
|
||||||
|
// swallow this error because the user can still click the play button on the video element
|
||||||
|
onSuccessfulPlay(elem, onErrorFn);
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return Promise.reject();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
onSuccessfulPlay(elem, onErrorFn);
|
onSuccessfulPlay(elem, onErrorFn);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
Loading…
Reference in New Issue
Block a user