diff --git a/src/js/player.js b/src/js/player.js index a32fd7eef8..fb26ae9971 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -1292,7 +1292,15 @@ class Player extends Component { * @method play */ play() { - this.techCall_('play'); + // Only calls the tech's play if we already have a src loaded + if (this.src() || this.currentSrc()) { + this.techCall_('play'); + } else { + this.tech_.one('loadstart', function() { + this.play(); + }); + } + return this; } diff --git a/test/unit/player.test.js b/test/unit/player.test.js index 8273820b64..af1c61bb34 100644 --- a/test/unit/player.test.js +++ b/test/unit/player.test.js @@ -247,7 +247,7 @@ test('should hide the poster when play is called', function() { }); equal(player.hasStarted(), false, 'the show poster flag is true before play'); - player.play(); + player.tech_.trigger('play'); equal(player.hasStarted(), true, 'the show poster flag is false after play'); player.tech_.trigger('loadstart'); @@ -255,7 +255,7 @@ test('should hide the poster when play is called', function() { false, 'the resource selection algorithm sets the show poster flag to true'); - player.play(); + player.tech_.trigger('play'); equal(player.hasStarted(), true, 'the show poster flag is false after play'); });