2013-01-25 17:36:40 -08:00
|
|
|
// Fake a media playback tech controller so that player tests
|
2013-01-17 20:33:53 -05:00
|
|
|
// can run without HTML5 or Flash, of which PhantomJS supports neither.
|
|
|
|
|
2013-01-25 17:36:40 -08:00
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
2013-04-09 13:43:35 -07:00
|
|
|
vjs.MediaFaker = vjs.MediaTechController.extend({
|
|
|
|
init: function(player, options, onReady){
|
|
|
|
vjs.MediaTechController.call(this, player, options, onReady);
|
2013-01-17 20:33:53 -05:00
|
|
|
|
2013-04-09 13:43:35 -07:00
|
|
|
this.triggerReady();
|
|
|
|
}
|
|
|
|
});
|
2013-01-17 20:33:53 -05:00
|
|
|
|
|
|
|
// Support everything
|
|
|
|
vjs.MediaFaker.isSupported = function(){ return true; };
|
|
|
|
vjs.MediaFaker.canPlaySource = function(srcObj){ return true; };
|
2013-04-09 13:18:55 -07:00
|
|
|
|
2013-01-17 20:33:53 -05:00
|
|
|
vjs.MediaFaker.prototype.createEl = function(){
|
2013-04-09 13:43:35 -07:00
|
|
|
var el = vjs.MediaTechController.prototype.createEl.call(this, 'div', {
|
2013-01-17 20:33:53 -05:00
|
|
|
className: 'vjs-tech'
|
|
|
|
});
|
2013-04-04 18:56:52 -04:00
|
|
|
if (this.player().poster()) {
|
2013-04-04 09:55:27 -04:00
|
|
|
// transfer the poster image to mimic HTML
|
2013-04-04 18:56:52 -04:00
|
|
|
el.poster = this.player().poster();
|
2013-04-04 09:55:27 -04:00
|
|
|
}
|
2013-01-17 20:33:53 -05:00
|
|
|
|
|
|
|
vjs.insertFirst(el, this.player_.el());
|
|
|
|
|
|
|
|
return el;
|
|
|
|
};
|
|
|
|
|
2013-08-24 19:34:26 -04:00
|
|
|
// 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; };
|
|
|
|
|
2013-01-17 20:33:53 -05:00
|
|
|
vjs.MediaFaker.prototype.currentTime = function(){ return 0; };
|
2013-08-23 15:05:04 -07:00
|
|
|
vjs.MediaFaker.prototype.seeking = function(){ return false; };
|
2014-01-25 22:37:40 -05:00
|
|
|
vjs.MediaFaker.prototype.src = function(){ return 'movie.mp4'; };
|
2013-01-17 20:33:53 -05:00
|
|
|
vjs.MediaFaker.prototype.volume = function(){ return 0; };
|
2013-05-02 17:07:05 -07:00
|
|
|
vjs.MediaFaker.prototype.muted = function(){ return false; };
|
2013-05-28 15:29:42 -07:00
|
|
|
vjs.MediaFaker.prototype.pause = function(){ return false; };
|
|
|
|
vjs.MediaFaker.prototype.supportsFullScreen = function(){ return false; };
|
|
|
|
vjs.MediaFaker.prototype.features = {};
|
|
|
|
vjs.MediaFaker.prototype.buffered = function(){ return {}; };
|
2013-10-15 13:38:48 -07:00
|
|
|
vjs.MediaFaker.prototype.duration = function(){ return {}; };
|
2013-01-17 20:33:53 -05:00
|
|
|
|
2013-04-09 13:43:35 -07:00
|
|
|
// Export vars for Closure Compiler
|
|
|
|
vjs['MediaFaker'] = vjs.MediaFaker;
|
|
|
|
vjs['MediaFaker']['isSupported'] = vjs.MediaFaker.isSupported;
|
|
|
|
vjs['MediaFaker']['canPlaySource'] = vjs.MediaFaker.canPlaySource;
|