1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-25 02:42:10 +02:00

@ldayananda updated videojs to not do anything if no src is set. closes #3378

This commit is contained in:
ldayananda 2016-06-27 23:07:00 -04:00 committed by Gary Katsevman
parent 68c7ab4748
commit c51c180b3c
3 changed files with 12 additions and 3 deletions

View File

@ -13,6 +13,7 @@ CHANGELOG
* @nickygerritsen Fix test for tooltips in IE8 ([view](https://github.com/videojs/video.js/pull/3327))
* @mboles added loadstart event to jsdoc ([view](https://github.com/videojs/video.js/pull/3370))
* @hartman added default print styling ([view](https://github.com/videojs/video.js/pull/3304))
* @ldayananda updated videojs to not do anything if no src is set ([view](https://github.com/videojs/video.js/pull/3378))
--------------------

View File

@ -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;
}

View File

@ -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');
});