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.
|
|
|
|
|
2015-05-03 16:12:38 -07:00
|
|
|
import Tech from '../../../src/js/tech/tech.js';
|
2015-03-10 18:01:11 -07:00
|
|
|
|
2013-01-25 17:36:40 -08:00
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
2015-05-03 16:12:38 -07:00
|
|
|
class TechFaker extends Tech {
|
2013-01-17 20:33:53 -05:00
|
|
|
|
2015-05-06 14:01:52 -04:00
|
|
|
constructor(options, handleReady){
|
|
|
|
super(options, handleReady);
|
2013-04-09 13:43:35 -07:00
|
|
|
this.triggerReady();
|
|
|
|
}
|
2015-04-14 13:08:32 -07:00
|
|
|
|
|
|
|
createEl() {
|
|
|
|
var el = super.createEl('div', {
|
|
|
|
className: 'vjs-tech'
|
|
|
|
});
|
|
|
|
|
2015-05-06 14:01:52 -04:00
|
|
|
/*if (this.player().poster()) {
|
2015-04-14 13:08:32 -07:00
|
|
|
// transfer the poster image to mimic HTML
|
|
|
|
el.poster = this.player().poster();
|
2015-05-06 14:01:52 -04:00
|
|
|
}*/
|
2015-04-14 13:08:32 -07:00
|
|
|
|
|
|
|
return el;
|
2013-04-04 09:55:27 -04:00
|
|
|
}
|
2013-01-17 20:33:53 -05:00
|
|
|
|
2015-04-14 13:08:32 -07:00
|
|
|
// fake a poster attribute to mimic the video element
|
|
|
|
poster() { return this.el().poster; }
|
|
|
|
setPoster(val) { this.el().poster = val; }
|
|
|
|
|
2015-05-06 14:01:52 -04:00
|
|
|
setControls(val) {}
|
|
|
|
|
2015-04-14 13:08:32 -07:00
|
|
|
currentTime() { return 0; }
|
|
|
|
seeking() { return false; }
|
|
|
|
src() { return 'movie.mp4'; }
|
|
|
|
volume() { return 0; }
|
|
|
|
muted() { return false; }
|
|
|
|
pause() { return false; }
|
|
|
|
paused() { return true; }
|
2015-05-06 14:01:52 -04:00
|
|
|
play() { this.trigger('play'); }
|
2015-04-14 13:08:32 -07:00
|
|
|
supportsFullScreen() { return false; }
|
|
|
|
buffered() { return {}; }
|
|
|
|
duration() { return {}; }
|
|
|
|
networkState() { return 0; }
|
|
|
|
readyState() { return 0; }
|
2015-08-21 17:43:07 -04:00
|
|
|
controls() { return false; }
|
2015-04-14 13:08:32 -07:00
|
|
|
|
|
|
|
// Support everything except for "video/unsupported-format"
|
|
|
|
static isSupported() { return true; }
|
2015-10-27 13:46:05 -04:00
|
|
|
static canPlayType(type) { return (type !== 'video/unsupported-format' ? 'maybe' : ''); }
|
2015-04-14 13:08:32 -07:00
|
|
|
static canPlaySource(srcObj) { return srcObj.type !== 'video/unsupported-format'; }
|
|
|
|
}
|
2015-03-25 21:43:41 -07:00
|
|
|
|
2015-11-10 15:53:14 -05:00
|
|
|
Tech.registerTech('TechFaker', TechFaker);
|
2015-05-03 16:12:38 -07:00
|
|
|
export default TechFaker;
|