diff options
author | Sam Potts <sam@potts.es> | 2020-03-29 11:18:08 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 11:18:08 +1100 |
commit | 2f26c80c8884911db7029b8f9fcf4e8e0c5e57d6 (patch) | |
tree | bb14cbfd13f3006fc0e7a73248ff8c07947d5ff8 /src/js/plyr.js | |
parent | be3ffc1f96ea830ad77d3cc4213b700ad91c416c (diff) | |
parent | 6a1d6f13a2581228b6ec64887bef4be8f9fed2b0 (diff) | |
download | plyr-2f26c80c8884911db7029b8f9fcf4e8e0c5e57d6.tar.lz plyr-2f26c80c8884911db7029b8f9fcf4e8e0c5e57d6.tar.xz plyr-2f26c80c8884911db7029b8f9fcf4e8e0c5e57d6.zip |
Merge pull request #1739 from ydylla/ignore-internal-play-promises
Ignore internal play promises
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r-- | src/js/plyr.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js index 00d33463..00b95a5f 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -27,6 +27,7 @@ import is from './utils/is'; import loadSprite from './utils/load-sprite'; import { clamp } from './utils/numbers'; import { cloneDeep, extend } from './utils/objects'; +import { silencePromise } from './utils/promise'; import { getAspectRatio, reduceAspectRatio, setAspectRatio, validateRatio } from './utils/style'; import { parseUrl } from './utils/urls'; @@ -303,7 +304,7 @@ class Plyr { // Autoplay if required if (this.isHTML5 && this.config.autoplay) { - setTimeout(() => this.play(), 10); + setTimeout(() => silencePromise(this.play()), 10); } // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek @@ -356,7 +357,7 @@ class Plyr { // Intecept play with ads if (this.ads && this.ads.enabled) { - this.ads.managerPromise.then(() => this.ads.play()).catch(() => this.media.play()); + this.ads.managerPromise.then(() => this.ads.play()).catch(() => silencePromise(this.media.play())); } // Return the promise (for HTML5) |