Skip to content

Commit

Permalink
Fix undefined return case
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Aug 26, 2021
1 parent b43f965 commit 91faca5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/dom/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ let VideoOrBaseElementPlayableDef;
*/
export function tryPlay(element, isAutoplay) {
const ret = element.play(!!isAutoplay);
if (!ret.catch) {
if (!ret?.catch) {
return Promise.resolve();
}
return ret.catch((err) => {
Expand All @@ -102,7 +102,6 @@ export function tryPlay(element, isAutoplay) {

/**
* @param {!HTMLMediaElement} element
* @return {Promise<undefined>}
*/
export function playIgnoringError(element) {
// Some browsers return undefined, some a boolean, and some a real promise.
Expand All @@ -113,5 +112,4 @@ export function playIgnoringError(element) {
// We use events to know the state of the video and do not care about
// the success or failure of the play()'s returned promise.
});
return Promise.resolve();
}

0 comments on commit 91faca5

Please sign in to comment.