mirror of
https://github.com/videojs/video.js.git
synced 2024-12-16 11:37:29 +02:00
875fc2ff32
When poster() is called with a URL, fire a `posterchange` event to update the PosterImage source and update the video element attribute. Trigger posterchange after updating the tech Wait until the tech has updated its poster image before alerting components so they don't see the intermediate state in event handlers. Remove unused variable from PosterImage.createEl. Don't create new img elements each time the poster is set on ie8 Create the img fallback for the poster during PosterImage initialization on ie8 so we can avoid having to check and possibly create it each time the src is set. Add a test to ensure that new elements are not appended to the poster component when the img fallback is in use and the src attribute is modified. fixing a broken IE8 test, and adding a negative test, for poster switching. modified the poster-switching test to accomodate IE8 added a negative test for an undefined poster fixed the assertion message in the 'undefined' image case fixed test breakage in Firefox and IE10 (quotes were not being handled properly in the test data) testing: ran the tests at the command line, and in Chrome, Firefox, IE8, IE10, Firefox and Safari all passed
51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
// Fake a media playback tech controller so that player tests
|
|
// can run without HTML5 or Flash, of which PhantomJS supports neither.
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
vjs.MediaFaker = vjs.MediaTechController.extend({
|
|
init: function(player, options, onReady){
|
|
vjs.MediaTechController.call(this, player, options, onReady);
|
|
|
|
this.triggerReady();
|
|
}
|
|
});
|
|
|
|
// Support everything
|
|
vjs.MediaFaker.isSupported = function(){ return true; };
|
|
vjs.MediaFaker.canPlaySource = function(srcObj){ return true; };
|
|
|
|
vjs.MediaFaker.prototype.createEl = function(){
|
|
var el = vjs.MediaTechController.prototype.createEl.call(this, 'div', {
|
|
className: 'vjs-tech'
|
|
});
|
|
if (this.player().poster()) {
|
|
// transfer the poster image to mimic HTML
|
|
el.poster = this.player().poster();
|
|
}
|
|
|
|
vjs.insertFirst(el, this.player_.el());
|
|
|
|
return el;
|
|
};
|
|
|
|
// fake a poster attribute to mimic the video element
|
|
vjs.MediaFaker.prototype.poster = function(){ return this.el().poster; };
|
|
vjs.MediaFaker.prototype['setPoster'] = function(val){ this.el().poster = val; };
|
|
|
|
vjs.MediaFaker.prototype.currentTime = function(){ return 0; };
|
|
vjs.MediaFaker.prototype.seeking = function(){ return false; };
|
|
vjs.MediaFaker.prototype.volume = function(){ return 0; };
|
|
vjs.MediaFaker.prototype.muted = function(){ return false; };
|
|
vjs.MediaFaker.prototype.pause = function(){ return false; };
|
|
vjs.MediaFaker.prototype.supportsFullScreen = function(){ return false; };
|
|
vjs.MediaFaker.prototype.features = {};
|
|
vjs.MediaFaker.prototype.buffered = function(){ return {}; };
|
|
vjs.MediaFaker.prototype.duration = function(){ return {}; };
|
|
|
|
// Export vars for Closure Compiler
|
|
vjs['MediaFaker'] = vjs.MediaFaker;
|
|
vjs['MediaFaker']['isSupported'] = vjs.MediaFaker.isSupported;
|
|
vjs['MediaFaker']['canPlaySource'] = vjs.MediaFaker.canPlaySource;
|