From 3bbf0199e602750ee79add28b58f0aaa506b17b1 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Thu, 2 Mar 2017 11:15:06 -0500 Subject: [PATCH] fix: early play should wait for player ready, even if source is available (#4134) Fixes #4057 --- src/js/player.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/player.js b/src/js/player.js index 97473bab4f..11fe013278 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -311,6 +311,9 @@ class Player extends Component { // Run base component initializing with new options super(null, options, ready); + // Turn off API access because we're loading a new tech that might load asynchronously + this.isReady_ = false; + // if the global option object was accidentally blown away by // someone, bail early with an informative error if (!this.options_ || @@ -1613,7 +1616,7 @@ class Player extends Component { }); // Only calls the tech's play if we already have a src loaded - } else if (this.src() || this.currentSrc()) { + } else if (this.isReady_ && (this.src() || this.currentSrc())) { return this.techGet_('play'); } else { this.ready(function() {