mirror of
https://github.com/videojs/video.js.git
synced 2024-12-14 11:23:30 +02:00
99a973e529
We use a div with a background image to simulate the poster image so that we can use a single poster implementation for flash and html. It may be desirable on some platforms to use the native poster image, however. On iPhones for instance, the simulated poster image covers up the native play button and can make it difficult to figure out where to touch to initiate playback. By keeping the poster attribute on the underlying video element, you can hide the simulated poster to get a native look-and-feel on that platform.
41 lines
1.2 KiB
JavaScript
41 lines
1.2 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 = function(player, options, onReady){
|
|
goog.base(this, player, options, onReady);
|
|
|
|
this.triggerReady();
|
|
};
|
|
goog.inherits(vjs.MediaFaker, vjs.MediaTechController);
|
|
|
|
// Support everything
|
|
vjs.MediaFaker.isSupported = function(){ return true; };
|
|
vjs.MediaFaker.canPlaySource = function(srcObj){ return true; };
|
|
vjs.MediaFaker.prototype.features = {
|
|
progressEvents: true,
|
|
timeupdateEvents: true
|
|
};
|
|
vjs.MediaFaker.prototype.createEl = function(){
|
|
var el = goog.base(this, 'createEl', '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;
|
|
};
|
|
|
|
vjs.MediaFaker.prototype.currentTime = function(){ return 0; };
|
|
vjs.MediaFaker.prototype.volume = function(){ return 0; };
|
|
|
|
goog.exportSymbol('videojs.MediaFaker', vjs.MediaFaker);
|
|
goog.exportProperty(vjs.MediaFaker, 'isSupported', vjs.MediaFaker.isSupported);
|
|
goog.exportProperty(vjs.MediaFaker, 'canPlaySource', vjs.MediaFaker.canPlaySource);
|