mirror of
https://github.com/videojs/video.js.git
synced 2024-12-25 02:42:10 +02:00
@bc-bbay fixed a bug where the player would try to autoplay when there was no source. closes #2127
This commit is contained in:
parent
ec53eda738
commit
652a44026f
@ -3,6 +3,7 @@ CHANGELOG
|
||||
|
||||
## HEAD (Unreleased)
|
||||
* @tjenkinson Added background-color to vjs-poster to remove transparent borders around scaled poster image ([view](https://github.com/videojs/video.js/pull/2138))
|
||||
* @bc-bbay fixed a bug where the player would try to autoplay when there was no source ([view](https://github.com/videojs/video.js/pull/2127))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -76,7 +76,7 @@ vjs.Html5 = vjs.MediaTechController.extend({
|
||||
// In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays)
|
||||
// This fixes both issues. Need to wait for API, so it updates displays correctly
|
||||
player.ready(function(){
|
||||
if (this.tag && this.options_['autoplay'] && this.paused()) {
|
||||
if (this.src() && this.tag && this.options_['autoplay'] && this.paused()) {
|
||||
delete this.tag['poster']; // Chrome Fix. Fixed in Chrome v16.
|
||||
this.play();
|
||||
}
|
||||
|
@ -153,6 +153,39 @@ test('should have the source handler interface', function() {
|
||||
ok(vjs.Html5.registerSourceHandler, 'has the registerSourceHandler function');
|
||||
});
|
||||
|
||||
test('should not autoplay if there is no source', function() {
|
||||
var
|
||||
plays = 0,
|
||||
i = 0,
|
||||
readyQueue = [];
|
||||
|
||||
player.play = function() {
|
||||
plays ++;
|
||||
};
|
||||
|
||||
player.ready = function(func) {
|
||||
readyQueue.push(func);
|
||||
};
|
||||
|
||||
player.src = function() { return ''; };
|
||||
|
||||
//re-initialized the tech to catch the callback in the readyQueue
|
||||
tech = new vjs.Html5(player, {});
|
||||
|
||||
//set up other options to bypass the condition
|
||||
player.options_['autoplay'] = true;
|
||||
player.paused = function () {
|
||||
return true;
|
||||
};
|
||||
player.tag = 'tag';
|
||||
|
||||
for (; i < readyQueue.length; i++) {
|
||||
readyQueue[i].call(player);
|
||||
}
|
||||
|
||||
equal(plays, 0, 'did not autoplay');
|
||||
});
|
||||
|
||||
test('native source handler canHandleSource', function(){
|
||||
var result;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user