8 lines
7.8 KiB
JavaScript
8 lines
7.8 KiB
JavaScript
|
/**
|
||
|
* videojs-flash
|
||
|
* @version 2.1.0
|
||
|
* @copyright 2017 Brightcove, Inc.
|
||
|
* @license Apache-2.0
|
||
|
*/
|
||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsFlash=t(e.videojs)}(this,function(e){"use strict";function t(e){var t=e.charAt(0).toUpperCase()+e.slice(1);v["set"+t]=function(t){return this.el_.vjs_setProperty(e,t)}}function r(e){v[e]=function(){return this.el_.vjs_getProperty(e)}}e=e&&e.hasOwnProperty("default")?e["default"]:e;for(var n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o="undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:{},i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},s=e.getComponent("Tech"),c=e.dom,u=e.url,l=e.createTimeRange,p=e.mergeOptions,f=o&&o.navigator||{},d=function(e){function t(r,n){i(this,t);var s=a(this,e.call(this,r,n));return r.source&&s.ready(function(){this.setSource(r.source)},!0),r.startTime&&s.ready(function(){this.load(),this.play(),this.currentTime(r.startTime)},!0),o.videojs=o.videojs||{},o.videojs.Flash=o.videojs.Flash||{},o.videojs.Flash.onReady=t.onReady,o.videojs.Flash.onEvent=t.onEvent,o.videojs.Flash.onError=t.onError,s.on("seeked",function(){this.lastSeekTarget_=undefined}),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.createEl=function(){var e=this.options_;e.swf||(e.swf="./resources/js/video-js.swf");var r=e.techId,n=p({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:e.autoplay,preload:e.preload,loop:e.loop,muted:e.muted},e.flashVars),o=p({wmode:"opaque",bgcolor:"#000000"},e.params),i=p({id:r,name:r,"class":"vjs-tech"},e.attributes);return this.el_=t.embed(e.swf,n,o,i),this.el_.tech=this,this.el_},t.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},t.prototype.pause=function(){this.el_.vjs_pause()},t.prototype.src=function(e){return e===undefined?this.currentSrc():this.setSrc(e)},t.prototype.setSrc=function(e){var t=this;e=u.getAbsoluteURL(e),this.el_.vjs_src(e),this.autoplay()&&this.setTimeout(function(){return t.play()},0)},t.prototype.seeking=function(){return this.lastSeekTarget_!==undefined},t.prototype.setCurrentTime=function(t){var r=this.seekable();r.length&&(t=(t=t>r.start(0)?t:r.start(0))<r.end(r.length-1)?t:r.end(r.length-1),this.lastSeekTarget_=t,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",t),e.prototype.setCurrentTime.call(this))},t.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},t.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},t.prototype.duration=function(){if(0===this.readyState())return NaN;var e=this.el_.vjs_getProperty("duration");return e>=0?e:Infinity},t.prototype.load=function(){this.el_.vjs_load()},t.prototype.poster=function(){this.el_.vjs_getProperty("poster")},t.prototype.setPoster=function(){},t.prototype.seekable=function(){var e=this.duration();return 0===e?l():l(0,e)},t.prototype.buffered=function(){var e=this.el_.vjs_getProperty("buffered");return 0===e.length?l():l(e[0][0],e[0][1])},t.prototype.supportsFullScreen=function(){return!1},t.prototype.enterFullScreen=function(){return!1},t.prototype.getVideoPlaybackQuality=function(){var e=this.el_.vjs_getProperty("getVideoPlaybackQuality");return o.performance&&"function"==typeof o.performance.now?e.creationTime=o.performance.now():o.performance&&o.performance.timing&&"number"==typeof o.performance.timing.nav
|