mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
refactor: Unify handling of play success
This commit is contained in:
parent
56080df163
commit
801c29d3b9
1 changed files with 4 additions and 5 deletions
|
@ -201,20 +201,19 @@ import { Events } from 'jellyfin-apiclient';
|
|||
if (promise && promise.then) {
|
||||
// Chrome now returns a promise
|
||||
return promise
|
||||
.then(() => {
|
||||
onSuccessfulPlay(elem, onErrorFn);
|
||||
return Promise.resolve();
|
||||
})
|
||||
.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();
|
||||
})
|
||||
.then(() => {
|
||||
onSuccessfulPlay(elem, onErrorFn);
|
||||
return Promise.resolve();
|
||||
});
|
||||
} else {
|
||||
onSuccessfulPlay(elem, onErrorFn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue