xgplayer 2.31.0 → 2.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/controls.js.map +1 -0
- package/browser/core_player.js +1 -1
- package/browser/core_player.js.map +1 -1
- package/browser/index.js +2 -2
- package/browser/index.js.map +1 -1
- package/browser/player.js.map +1 -0
- package/browser/simple_player.js +1 -1
- package/browser/simple_player.js.map +1 -1
- package/dist/controls.js.map +1 -0
- package/dist/core_player.js +4032 -1
- package/dist/core_player.js.map +1 -1
- package/dist/index.js +13672 -9
- package/dist/index.js.map +1 -1
- package/dist/player.js.map +1 -0
- package/dist/simple_player.js +5410 -1
- package/dist/simple_player.js.map +1 -1
- package/es/controls/danmu.js +1 -1
- package/es/controls/errorRetry.js +1 -1
- package/es/controls/nativeTextTrack.js +1 -1
- package/es/controls/playbackRate.js +1 -1
- package/es/controls/volume.js +1 -1
- package/es/core_player.js +1 -1
- package/es/core_player.js.map +1 -1
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/simple_player.js +1 -1
- package/es/simple_player.js.map +1 -1
- package/package.json +1 -1
- package/src/controls/volume.js +4 -1
- package/src/proxy.js +1 -1
- package/src/skin/controls/playbackRate.js +5 -1
- package/version.json +1 -1
- package/webpack.config.js +1 -1
package/dist/core_player.js
CHANGED
|
@@ -1,2 +1,4033 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xgplayer=t():e.xgplayer=t()}(this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=175)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.util=t.PresentationMode=void 0,t.createDom=a,t.hasClass=s,t.addClass=l,t.removeClass=c,t.toggleClass=u,t.findDom=f,t.padStart=d,t.format=p,t.event=h,t.typeOf=v,t.deepCopy=y,t.getBgImage=g,t.copyDom=m,t._setInterval=x,t._clearInterval=E,t.createImgBtn=b,t.isWeiXin=T,t.isUc=_,t.computeWatchDur=k,t.offInDestroy=O,t.on=S,t.once=R,t.getBuffered2=w,t.checkIsBrowser=A,t.setStyle=P,t.checkWebkitSetPresentationMode=function(e){return"function"==typeof e.webkitSetPresentationMode};var i,o=n(7),r=(i=o)&&i.__esModule?i:{default:i};function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(e);return o.className=i,o.innerHTML=t,Object.keys(n).forEach((function(t){var i=t,r=n[t];"video"===e||"audio"===e?r&&o.setAttribute(i,r):o.setAttribute(i,r)})),o}function s(e,t){return!!e&&(e.classList?Array.prototype.some.call(e.classList,(function(e){return e===t})):!!e.className&&!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)")))}function l(e,t){e&&(e.classList?t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)})):s(e,t)||(e.className+=" "+t))}function c(e,t){e&&(e.classList?t.split(/\s+/g).forEach((function(t){e.classList.remove(t)})):s(e,t)&&t.split(/\s+/g).forEach((function(t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")})))}function u(e,t){e&&t.split(/\s+/g).forEach((function(t){s(e,t)?c(e,t):l(e,t)}))}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments[1],n=void 0;try{n=e.querySelector(t)}catch(i){0===t.indexOf("#")&&(n=e.getElementById(t.slice(1)))}return n}function d(e,t,n){for(var i=String(n),o=t>>0,r=Math.ceil(o/i.length),a=[],s=String(e);r--;)a.push(i);return a.join("").substring(0,o-s.length)+s}function p(e){if(window.isNaN(e))return"";var t=d(Math.floor(e/3600),2,0),n=d(Math.floor((e-3600*t)/60),2,0),i=d(Math.floor(e-3600*t-60*n),2,0);return("00"===t?[n,i]:[t,n,i]).join(":")}function h(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement}function v(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function y(e,t){if("Object"===v(t)&&"Object"===v(e))return Object.keys(t).forEach((function(n){"Object"!==v(t[n])||t[n]instanceof Node?"Array"===v(t[n])?e[n]="Array"===v(e[n])?e[n].concat(t[n]):t[n]:e[n]=t[n]:e[n]?y(e[n],t[n]):e[n]=t[n]})),e}function g(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var n=document.createElement("a");return n.href=t.replace(/url\("|"\)/g,""),n.href}function m(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""}function x(e,t,n,i){e._interval[t]||(e._interval[t]=setInterval(n.bind(e),i))}function E(e,t){clearInterval(e._interval[t]),e._interval[t]=null}function b(e,t,n,i){var o=a("xg-"+e,"",{},"xgplayer-"+e+"-img");if(o.style.backgroundImage='url("'+t+'")',n&&i){var r=void 0,s=void 0,l=void 0;["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){return!(n.indexOf(e)>-1&&i.indexOf(e)>-1)||(r=Number(n.slice(0,n.indexOf(e)).trim()),s=Number(i.slice(0,i.indexOf(e)).trim()),l=e,!1)})),o.style.width=""+r+l,o.style.height=""+s+l,o.style.backgroundSize=""+r+l+" "+s+l,o.style.margin="start"===e?"-"+s/2+l+" auto auto -"+r/2+l:"auto 5px auto 5px"}return o}function T(){return window.navigator.userAgent.toLowerCase().indexOf("micromessenger")>-1}function _(){return window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")>-1}function k(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],n=0;n<e.length;n++)if(!(!e[n].end||e[n].begin<0||e[n].end<0||e[n].end<e[n].begin))if(t.length<1)t.push({begin:e[n].begin,end:e[n].end});else for(var i=0;i<t.length;i++){var o=e[n].begin,r=e[n].end;if(r<t[i].begin){t.splice(i,0,{begin:o,end:r});break}if(!(o>t[i].end)){var a=t[i].begin,s=t[i].end;t[i].begin=Math.min(o,a),t[i].end=Math.max(r,s);break}if(i>t.length-2){t.push({begin:o,end:r});break}}for(var l=0,c=0;c<t.length;c++)l+=t[c].end-t[c].begin;return l}function O(e,t,n,i){e.once(i,(function o(){e.off(t,n),e.off(i,o)}))}function S(e,t,n,i){if(i)e.on(t,n),O(e,t,n,i);else{e.on(t,(function i(o){n(o),e.off(t,i)}))}}function R(e,t,n,i){if(i)e.once(t,n),O(e,t,n,i);else{e.once(t,(function i(o){n(o),e.off(t,i)}))}}function w(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=[],i=0;i<e.length;i++)n.push({start:e.start(i)<.5?0:e.start(i),end:e.end(i)});n.sort((function(e,t){var n=e.start-t.start;return n||t.end-e.end}));var o=[];if(t)for(var a=0;a<n.length;a++){var s=o.length;if(s){var l=o[s-1].end;n[a].start-l<t?n[a].end>l&&(o[s-1].end=n[a].end):o.push(n[a])}else o.push(n[a])}else o=n;return new r.default(o)}function A(){return!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)}function P(e,t,n){var i=e.style;try{i[t]=n}catch(e){i.setProperty(t,n)}}t.PresentationMode={PIP:"picture-in-picture",INLINE:"inline",FULLSCREEN:"fullscreen"};t.util={createDom:a,hasClass:s,addClass:l,removeClass:c,toggleClass:u,findDom:f,padStart:d,format:p,event:h,typeOf:v,deepCopy:y,getBgImage:g,copyDom:m,setInterval:x,clearInterval:E,createImgBtn:b,isWeiXin:T,isUc:_,computeWatchDur:k,offInDestroy:O,on:S,once:R,getBuffered2:w,checkIsBrowser:A,setStyle:P}},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var n=s.call(this,e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}}(),c=null,u=0,f=[],d=n(36);function p(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(x(i.parts[a],t))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(x(i.parts[a],t));r[i.id]={id:i.id,refs:1,parts:s}}}}function h(e,t){for(var n=[],i={},o=0;o<e.length;o++){var r=e[o],a=t.base?r[0]+t.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};i[a]?i[a].parts.push(s):n.push(i[a]={id:a,parts:[s]})}return n}function v(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=f[f.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),f.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,o)}}function y(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=f.indexOf(e);t>=0&&f.splice(t,1)}function g(e){var t=document.createElement("style");return e.attrs.type="text/css",m(t,e.attrs),v(e,t),t}function m(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function x(e,t){var n,i,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var a=u++;n=c||(c=g(t)),i=T.bind(null,n,a,!1),o=T.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",m(t,e.attrs),v(e,t),t}(t),i=k.bind(null,n,t),o=function(){y(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(t),i=_.bind(null,n),o=function(){y(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=h(e,t);return p(n,t),function(e){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}e&&p(h(e,t),t);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete r[s.id]}}}};var E,b=(E=[],function(e,t){return E[e]=t,E.filter(Boolean).join("\n")});function T(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=b(t,o);else{var r=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(r,a[t]):e.appendChild(r)}}function _(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function k(e,t,n){var i=n.css,o=n.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(i=d(i)),o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}},function(e,t,n){"use strict";var i=n(24)();e.exports=function(e){return e!==i&&null!==e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(8);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r={network:{code:1,msg:"视频下载错误",remark:"只要视频下载错误就使用此类型,无论是video本身的超时还是xhr的分段请求超时或者资源不存在"},mse:{code:2,msg:"流追加错误",remark:"追加流的时候如果类型不对、无法被正确解码则会触发此类错误"},parse:{code:3,msg:"解析错误",remark:"mp4、hls、flv我们都是使用js进行格式解析,如果解析失败则会触发此类错误"},format:{code:4,msg:"格式错误",remark:"如果浏览器不支持的格式导致播放错误"},decoder:{code:5,msg:"解码错误",remark:"浏览器解码异常会抛出此类型错误"},runtime:{code:6,msg:"语法错误",remark:"播放器语法错误"},timeout:{code:7,msg:"播放超时",remark:"播放过程中无法正常请求下一个分段导致播放中断"},other:{code:8,msg:"其他错误",remark:"不可知的错误或被忽略的错误类型"}};t.default=function e(t,n,a,s,l,c,u,f){var d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{line:"",handle:"",msg:"",version:""},p=arguments[9],h=arguments[10];o(this,e);var v={};if(arguments.length>1)v.playerVersion=i.version,v.errorType=t,v.domain=document.domain,v.duration=a,v.currentTime=n,v.networkState=s,v.readyState=l,v.currentSrc=u,v.src=c,v.ended=f,v.errd=d,v.ex=(r[t]||{}).msg,v.errorCode=p,v.mediaError=h;else{var y=arguments[0];Object.keys(y).map((function(e){v[e]=y[e]})),v.ex=(y.type&&r[y.type]||{}).msg}return v},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={};Object.defineProperty(i,"device",{get:function(){return i.os.isPc?"pc":"mobile"}}),Object.defineProperty(i,"browser",{get:function(){var e=navigator.userAgent.toLowerCase(),t={ie:/rv:([\d.]+)\) like gecko/,firfox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(t).filter((function(n){return t[n].test(e)})))[0]||""}}),Object.defineProperty(i,"os",{get:function(){var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),n=/(?:SymbianOS)/.test(e)||t,i=/(?:Android)/.test(e),o=/(?:Firefox)/.test(e),r=/(?:iPad|PlayBook)/.test(e)||i&&!/(?:Mobile)/.test(e)||o&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!r;return{isTablet:r,isPhone:a,isAndroid:i,isPc:!(a||i||n||r),isSymbian:n,isWindowsPhone:t,isFireFox:o}}}),t.default=i,e.exports=t.default},function(e,t,n){"use strict";e.exports=function(e){return null!=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bufferedList=t}return i(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}();t.default=o,e.exports=t.default},function(e){e.exports=JSON.parse('{"version":"2.31.0"}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function e(t,n,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,i)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(i):void 0},r=p(n(11)),a=n(0),s=p(n(5)),l=p(n(7)),c=p(n(4)),u=p(n(31)),f=p(n(10));n(34);var d=n(8);function p(e){return e&&e.__esModule?e:{default:e}}function h(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}var v=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));if(n.config=(0,a.deepCopy)({width:600,height:337.5,ignores:[],whitelist:[],lang:(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase(),inactive:3e3,volume:.6,controls:!0,controlsList:["nodownload"]},e),n.version=d.version,n.userTimer=null,n.waitTimer=null,n.history=[],n.isProgressMoving=!1,n.root=(0,a.findDom)(document,"#"+n.config.id),n.controls=(0,a.createDom)("xg-controls","",{unselectable:"on",onselectstart:"return false"},"xgplayer-controls"),n.config.isShowControl&&(n.controls.style.display="none"),!n.root){var i=n.config.el;if(!i||1!==i.nodeType)return n.emit("error",new c.default({type:"use",errd:{line:45,handle:"Constructor",msg:"container id can't be empty"},vid:n.config.vid})),console.error("container id can't be empty"),!1,h(n,!1);n.root=i}if((0,a.addClass)(n.root,"xgplayer xgplayer-"+s.default.device+" xgplayer-nostart xgplayer-pause "+(n.config.controls?"":"xgplayer-no-controls")),n.root.appendChild(n.controls),n.config.fluid?(n.root.style["max-width"]="100%",n.root.style.width="100%",n.root.style.height="0",n.root.style["padding-top"]=100*n.config.height/n.config.width+"%",n.video.style.position="absolute",n.video.style.top="0",n.video.style.left="0"):(n.config.width&&("number"!=typeof n.config.width?n.root.style.width=n.config.width:n.root.style.width=n.config.width+"px"),n.config.height&&("number"!=typeof n.config.height?n.root.style.height=n.config.height:n.root.style.height=n.config.height+"px")),n.config.execBeforePluginsCall&&n.config.execBeforePluginsCall.forEach((function(e){e.call(n,n)})),n.config.closeI18n||t.install(f.default.name,f.default.method),n.config.controlStyle&&"String"===(0,a.typeOf)(n.config.controlStyle)){var o=n;fetch(o.config.controlStyle,{method:"GET",headers:{Accept:"application/json"}}).then((function(e){e.ok&&e.json().then((function(e){for(var t in e)e.hasOwnProperty(t)&&(o.config[t]=e[t]);o.pluginsCall()}))})).catch((function(e){console.log("Fetch错误:"+e)}))}else n.pluginsCall();n.config.controlPlugins&&t.controlsRun(n.config.controlPlugins,n),n.ev.forEach((function(e){var t=Object.keys(e)[0],i=n[e[t]];i&&n.on(t,i)})),["focus","blur"].forEach((function(e){n.on(e,n["on"+e.charAt(0).toUpperCase()+e.slice(1)])}));var r=n;return n.mousemoveFunc=function(){r.emit("focus"),r.config.closeFocusVideoFocus||r.video.focus()},n.root.addEventListener("mousemove",n.mousemoveFunc),n.playFunc=function(){r.emit("focus"),r.config.closePlayVideoFocus||r.video.focus()},r.once("play",n.playFunc),n.getVideoSize=function(){if(this.video.videoWidth&&this.video.videoHeight){var e=r.root.getBoundingClientRect();"auto"===r.config.fitVideoSize?e.width/e.height>this.video.videoWidth/this.video.videoHeight?r.root.style.height=this.video.videoHeight/this.video.videoWidth*e.width+"px":r.root.style.width=this.video.videoWidth/this.video.videoHeight*e.height+"px":"fixWidth"===r.config.fitVideoSize?r.root.style.height=this.video.videoHeight/this.video.videoWidth*e.width+"px":"fixHeight"===r.config.fitVideoSize&&(r.root.style.width=this.video.videoWidth/this.video.videoHeight*e.height+"px")}},r.once("loadeddata",n.getVideoSize),setTimeout((function(){n.emit("ready"),n.isReady=!0}),0),n.config.videoInit&&(0,a.hasClass)(n.root,"xgplayer-nostart")&&n.start(),r.config.rotate&&(r.on("requestFullscreen",n.updateRotateDeg),r.on("exitFullscreen",n.updateRotateDeg)),r.once("destroy",(function e(){r.root.removeEventListener("mousemove",r.mousemoveFunc),r.off("destroy",e)})),n}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),i(t,[{key:"attachVideo",value:function(){var e=this;this.video&&1===this.video.nodeType&&this.root.insertBefore(this.video,this.root.firstChild),setTimeout((function(){e.emit("complete"),e.danmu&&"function"==typeof e.danmu.resize&&e.danmu.resize()}),1)}},{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.url;if(this.video){var n=this;t&&""!==t?(this.canPlayFunc=function(){n.off("canplay",n.canPlayFunc);var e=n.video.play();void 0!==e&&e&&e.then((function(){n.emit("autoplay started")})).catch((function(){n.emit("autoplay was prevented"),(0,a.addClass)(n.root,"xgplayer-is-autoplay")}))},"Array"!==(0,a.typeOf)(t)?"String"===(0,a.typeOf)(t)&&t.indexOf("blob:")>-1&&t===this.video.src||(this.video.src=t):t.forEach((function(t){e.video.appendChild((0,a.createDom)("source","",{src:""+t.src,type:""+(t.type||"")}))})),this.config.autoplay&&(s.default.os.isPhone?this.canPlayFunc():this.on("canplay",this.canPlayFunc)),this.config.disableStartLoad||this.video.load(),this.attachVideo()):this.emit("urlNull")}}},{key:"reload",value:function(){this.video.load(),this.reloadFunc=function(){var e=this.play();void 0!==e&&e&&e.catch((function(e){}))},this.once("loadeddata",this.reloadFunc)}},{key:"destroy",value:function(){var e=this,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=this;for(var r in clearInterval(this.bulletResizeTimer),this._interval)clearInterval(this._interval[r]),this._interval[r]=null;function a(){if(this.emit("destroy"),this.video.removeAttribute("src"),this.video.load(),n){this.root.innerHTML="";var e=this.root.className.split(" ");e.length>0?this.root.className=e.filter((function(e){return e.indexOf("xgplayer")<0})).join(" "):this.root.className=""}for(var t in this)delete this[t];(0,u.default)(this)}this.checkTimer&&clearInterval(this.checkTimer),this.waitTimer&&clearTimeout(this.waitTimer),this.ev.forEach((function(t){var n=Object.keys(t)[0],i=e[t[n]];i&&e.off(n,i)})),this.loadeddataFunc&&this.off("loadeddata",this.loadeddataFunc),this.reloadFunc&&this.off("loadeddata",this.reloadFunc),this.replayFunc&&this.off("play",this.replayFunc),this.playFunc&&this.off("play",this.playFunc),this.getVideoSize&&this.off("loadeddata",this.getVideoSize),["focus","blur"].forEach((function(t){e.off(t,e["on"+t.charAt(0).toUpperCase()+t.slice(1)])})),this.config.keyShortcut&&"on"!==this.config.keyShortcut||["video","controls"].forEach((function(t){e[t]&&e[t].removeEventListener("keydown",(function(e){i.onKeydown(e,i)}))})),this.paused?a.call(this):(this.pause(),this.once("pause",a)),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"replay",value:function(){var e=this._replay;if((0,a.removeClass)(this.root,"xgplayer-ended"),s.default.browser.indexOf("ie")>-1&&(this.emit("play"),this.emit("playing")),e&&e instanceof Function)e();else{this.currentTime=0;var t=this.play();void 0!==t&&t&&t.catch((function(e){}))}}},{key:"userGestureTrigEvent",value:function(e,t){var n=this,i=function(e,t){n.emit(e,t)};this.config.userGestureEventMiddleware&&"function"==typeof this.config.userGestureEventMiddleware[e]?this.config.userGestureEventMiddleware[e].call(this,this,e,t,i):i.call(this,e,t)}},{key:"pluginsCall",value:function(){var e=this;t.plugins.s_i18n&&t.plugins.s_i18n.call(this,this);var n=this;if(t.plugins){var i=this.config.ignores;Object.keys(t.plugins).forEach((function(o){var r=t.plugins[o];r&&"function"==typeof r?i.some((function(e){return o===e||o==="s_"+e}))||"s_i18n"===o||(["pc","tablet","mobile"].some((function(e){return e===o}))?o===s.default.device&&setTimeout((function(){n.video&&r.call(n,n)}),0):r.call(e,e)):console.warn("plugin name",o,"is invalid")}))}}},{key:"onFocus",value:function(){var e=this;(0,a.hasClass)(this.root,"xgplayer-inactive")&&e.emit("controlShow"),(0,a.removeClass)(this.root,"xgplayer-inactive"),e.userTimer&&clearTimeout(e.userTimer),e.userTimer=setTimeout((function(){e.emit("blur")}),e.config.inactive)}},{key:"onBlur",value:function(){!this.config.enablePausedInactive&&this.paused||this.ended||this.config.closeInactive||((0,a.hasClass)(this.root,"xgplayer-inactive")||this.emit("controlHide"),(0,a.addClass)(this.root,"xgplayer-inactive"))}},{key:"onPlay",value:function(){(0,a.addClass)(this.root,"xgplayer-isloading"),(0,a.addClass)(this.root,"xgplayer-playing"),(0,a.removeClass)(this.root,"xgplayer-pause")}},{key:"onPause",value:function(){(0,a.addClass)(this.root,"xgplayer-pause"),this.userTimer&&clearTimeout(this.userTimer),this.emit("focus")}},{key:"onEnded",value:function(){(0,a.addClass)(this.root,"xgplayer-ended"),(0,a.removeClass)(this.root,"xgplayer-playing")}},{key:"onSeeking",value:function(){this.isSeeking=!0,this.onWaiting()}},{key:"onSeeked",value:function(){var e=this;this.once("timeupdate",(function(){e.isSeeking=!1})),this.waitTimer&&clearTimeout(this.waitTimer),(0,a.removeClass)(this.root,"xgplayer-isloading")}},{key:"onWaiting",value:function(){var e=this;e.waitTimer&&clearTimeout(e.waitTimer),e.checkTimer&&(clearInterval(e.checkTimer),e.checkTimer=null);var t=e.currentTime;e.waitTimer=setTimeout((function(){(0,a.addClass)(e.root,"xgplayer-isloading"),e.checkTimer=setInterval((function(){e.currentTime!==t&&((0,a.removeClass)(e.root,"xgplayer-isloading"),clearInterval(e.checkTimer),e.checkTimer=null)}),1e3)}),500)}},{key:"onPlaying",value:function(){this.paused||(this.isSeeking=!1,this.waitTimer&&clearTimeout(this.waitTimer),(0,a.removeClass)(this.root,"xgplayer-isloading xgplayer-nostart xgplayer-pause xgplayer-ended xgplayer-is-error xgplayer-replay"),(0,a.addClass)(this.root,"xgplayer-playing"))}}],[{key:"install",value:function(e,n){(0,a.checkIsBrowser)()&&(t.plugins||(t.plugins={}),t.plugins[e]||(t.plugins[e]=n))}},{key:"installAll",value:function(e){for(var n=0;n<e.length;n++)t.install(e[n].name,e[n].method)}},{key:"use",value:function(e,n){t.plugins||(t.plugins={}),t.plugins[e]=n}},{key:"useAll",value:function(e){for(var n in e)t.use(e[n].name,e[n].method)}},{key:"controlsRun",value:function(e,t){e.forEach((function(e){e.method.call(t)}))}}]),t}(r.default);v.util=a.util,v.sniffer=s.default,v.Errors=c.default,v.XgplayerTimeRange=l.default,t.default=v,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0);t.default={name:"s_i18n",method:function(){var e=this,t={en:{HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"Pip",MINIPLAYER:"Miniplayer",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",MINIPLAYER_DRAG:"Click and hold to drag",AIRPLAY_TIPS:"Airplay"},"zh-cn":{HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"当下载时发生错误",MEDIA_ERR_DECODE:"当解码时发生错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",MINIPLAYER:"迷你播放器",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",MINIPLAYER_DRAG:"点击按住可拖动视频",AIRPLAY_TIPS:"隔空播放"},"zh-hk":{HAVE_NOTHING:"沒有關於音頻/視頻是否就緒的信息",HAVE_METADATA:"音頻/視頻的元數據已就緒",HAVE_CURRENT_DATA:"關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒",HAVE_FUTURE_DATA:"當前及至少下壹幀的數據是可用的",HAVE_ENOUGH_DATA:"可用數據足以開始播放",NETWORK_EMPTY:"音頻/視頻尚未初始化",NETWORK_IDLE:"音頻/視頻是活動的且已選取資源,但並未使用網絡",NETWORK_LOADING:"瀏覽器正在下載數據",NETWORK_NO_SOURCE:"未找到音頻/視頻來源",MEDIA_ERR_ABORTED:"取回過程被用戶中止",MEDIA_ERR_NETWORK:"當下載時發生錯誤",MEDIA_ERR_DECODE:"當解碼時發生錯誤",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音頻/視頻格式",REPLAY:"重播",ERROR:"網絡連接似乎出現了問題",PLAY_TIPS:"播放",PAUSE_TIPS:"暫停",PLAYNEXT_TIPS:"下壹集",DOWNLOAD_TIPS:"下載",ROTATE_TIPS:"旋轉",RELOAD_TIPS:"重新載入",FULLSCREEN_TIPS:"進入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"進入樣式全屏",EXITCSSFULLSCREEN_TIPS:"退出樣式全屏",TEXTTRACK:"字幕",PIP:"畫中畫",MINIPLAYER:"迷妳播放器",SCREENSHOT:"截圖",LIVE:"正在直播",OFF:"關閉",MINIPLAYER_DRAG:"點擊按住可拖動視頻",AIRPLAY_TIPS:"隔空播放"},jp:{HAVE_NOTHING:"オーディオ/ビデオが準備できているか情報がありません",HAVE_METADATA:"オーディオ/ビデオのメタデータは準備できています",HAVE_CURRENT_DATA:"現在の再生位置に関するデータは利用可能ですが、次のフレーム/ミリ秒を再生するのに十分なデータがありません",HAVE_FUTURE_DATA:"現在、少なくとも次のフレームのデータが利用可能です",HAVE_ENOUGH_DATA:"利用可能なデータは再生を開始するのに十分です",NETWORK_EMPTY:"オーディオ/ビデオが初期化されていません",NETWORK_IDLE:"オーディオ/ビデオはアクティブでリソースが選択されていますが、ネットワークが使用されていません",NETWORK_LOADING:"ブラウザーはデータをダウンロードしています",NETWORK_NO_SOURCE:"オーディオ/ビデオ のソースが見つかりません",MEDIA_ERR_ABORTED:"ユーザーによってフェッチプロセスが中止されました",MEDIA_ERR_NETWORK:"ダウンロード中にエラーが発生しました",MEDIA_ERR_DECODE:"デコード中にエラーが発生しました",MEDIA_ERR_SRC_NOT_SUPPORTED:"オーディオ/ビデオ の形式がサポートされていません",REPLAY:"リプレイ",ERROR:"ネットワークの接続に問題が発生しました",PLAY_TIPS:"プレイ",PAUSE_TIPS:"一時停止",PLAYNEXT_TIPS:"次をプレイ",DOWNLOAD_TIPS:"ダウンロード",ROTATE_TIPS:"回転",RELOAD_TIPS:"再読み込み",FULLSCREEN_TIPS:"フルスクリーン",EXITFULLSCREEN_TIPS:"フルスクリーンを終了",CSSFULLSCREEN_TIPS:"シアターモード",EXITCSSFULLSCREEN_TIPS:"シアターモードを終了",TEXTTRACK:"字幕",PIP:"ミニプレーヤー",MINIPLAYER:"ミニプレーヤー",SCREENSHOT:"スクリーンショット",LIVE:"生放送",OFF:"オフ",MINIPLAYER_DRAG:"ボタンを押して働画をドラッグする",AIRPLAY_TIPS:"隔空放送"}};Object.defineProperty(e,"lang",{get:function(){return e.config&&t[e.config.lang]||t.en},set:function(e){"Object"===(0,i.typeOf)(e)&&Object.keys(e).forEach((function(n){t[n]=e[n]}))}})}},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=s(n(12)),r=n(0),a=s(n(4));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._hasStart=!1,this.videoConfig={controls:!!t.isShowControl,autoplay:t.autoplay,playsinline:t.playsinline,"webkit-playsinline":t.playsinline,"x5-playsinline":t.playsinline,"x5-video-player-type":t["x5-video-player-type"]||t.x5VideoPlayerType,"x5-video-player-fullscreen":t["x5-video-player-fullscreen"]||t.x5VideoPlayerFullscreen,"x5-video-orientation":t["x5-video-orientation"]||t.x5VideoOrientation,airplay:t.airplay,"webkit-airplay":t.airplay,tabindex:2,mediaType:t.mediaType||"video"},t.muted&&(this.videoConfig.muted="muted"),t.loop&&(this.videoConfig.loop="loop");var i="";if(this.textTrackShowDefault=!0,t.nativeTextTrack&&Array.isArray(t.nativeTextTrack)&&(t.nativeTextTrack.length>0&&!t.nativeTextTrack.some((function(e){return e.default}))&&(t.nativeTextTrack[0].default=!0,this.textTrackShowDefault=!1),t.nativeTextTrack.some((function(e){if(e.src&&e.label&&e.default)return i+='<track src="'+e.src+'" ',e.kind&&(i+='kind="'+e.kind+'" '),i+='label="'+e.label+'" ',e.srclang&&(i+='srclang="'+e.srclang+'" '),i+=(e.default?"default":"")+">",!0})),this.videoConfig.crossorigin="anonymous"),t.textTrackStyle){var a=document.createElement("style");this.textTrackStyle=a,document.head.appendChild(a);var s="";for(var l in t.textTrackStyle)s+=l+": "+t.textTrackStyle[l]+";";var c=t.id?"#"+t.id:t.el.id?"#"+t.el.id:"."+t.el.className;a.sheet.insertRule?a.sheet.insertRule(c+" video::cue { "+s+" }",0):a.sheet.addRule&&a.sheet.addRule(c+" video::cue",s)}var u=t.el?t.el:(0,r.findDom)(document,"#"+t.id),f=this.constructor.XgVideoProxy;(f&&this.videoConfig.mediaType===f.mediaType?this.video=new f(u,t):this.video=(0,r.createDom)(this.videoConfig.mediaType,i,this.videoConfig,""),t.videoStyle&&Object.keys(t.videoStyle).forEach((function(e){(0,r.setStyle)(n.video,e,t.videoStyle[e])})),!this.textTrackShowDefault&&i)&&(this.video.getElementsByTagName("Track")[0].track.mode="hidden");t.autoplay&&(this.video.autoplay=!0,t.autoplayMuted&&(this.video.muted=!0)),this.ev=["play","playing","pause","ended","error","seeking","seeked","progress","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart"].map((function(e){return t={},n=e,i="on"+e.charAt(0).toUpperCase()+e.slice(1),n in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t;var t,n,i})),(0,o.default)(this),this._interval={};var d="0,0",p=this,h=function(e){n&&("play"===e?n.hasStart=!0:"canplay"===e?(0,r.removeClass)(n.root,"xgplayer-is-enter"):"waiting"===e?n.inWaitingStart=(new Date).getTime():"playing"===e&&((0,r.removeClass)(n.root,"xgplayer-is-enter"),n.inWaitingStart&&(n.inWaitingStart=void 0)),"error"===e?n._onError(e):n.emit(e,n),n.hasOwnProperty("_interval")&&(["ended","error","timeupdate"].indexOf(e)<0?((0,r._clearInterval)(n,"bufferedChange"),(0,r._setInterval)(n,"bufferedChange",(function(){if(this.video&&this.video.buffered){for(var e=[],t=0,n=this.video.buffered.length;t<n;t++)e.push([this.video.buffered.start(t),this.video.buffered.end(t)]);e.toString()!==d&&(d=e.toString(),this.emit("bufferedChange",e))}}),200)):"timeupdate"!==e&&(0,r._clearInterval)(n,"bufferedChange")))},v=function(e){t.videoEventMiddleware&&"function"==typeof t.videoEventMiddleware[e]?t.videoEventMiddleware[e].call(n,n,e,h):h.call(n,e)};this.ev.forEach((function(e){p.evItem=Object.keys(e)[0];var t=Object.keys(e)[0];p.video.addEventListener(Object.keys(e)[0],v.bind(p,t))}))}return i(e,[{key:"_onError",value:function(e){this.video&&this.video.error&&this.emit(e,new a.default("other",this.currentTime,this.duration,this.networkState,this.readyState,this.currentSrc,this.src,this.ended,{line:162,msg:this.error,handle:"Constructor"},this.video.error.code,this.video.error))}},{key:"destroy",value:function(){this.textTrackStyle&&this.textTrackStyle.parentNode.removeChild(this.textTrackStyle)}},{key:"play",value:function(){return this.video.play()}},{key:"pause",value:function(){this.video.pause()}},{key:"canPlayType",value:function(e){return this.video.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0],n=this.video;e||(e=n.buffered);var i=n.currentTime;if(e)for(var o=0,r=e.length;o<r&&(t[0]=e.start(o),t[1]=e.end(o),!(t[0]<=i&&i<=t[1]));o++);return t[0]-i<=0&&i-t[1]<=0?t:[0,0]}},{key:"proxyOn",value:function(e,t){(0,r.on)(this,e,t,"destroy")}},{key:"proxyOnce",value:function(e,t){(0,r.once)(this,e,t,"destroy")}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"!=typeof e||!0!==e||this._hasStart||(this._hasStart=!0,this.emit("hasstart"))}},{key:"autoplay",set:function(e){this.video&&(this.video.autoplay=e)},get:function(){return!!this.video&&this.video.autoplay}},{key:"buffered",get:function(){return this.video?this.video.buffered:void 0}},{key:"buffered2",get:function(){return(0,r.getBuffered2)(this.video.buffered)}},{key:"crossOrigin",get:function(){return!!this.video&&this.video.crossOrigin},set:function(e){this.video&&(this.video.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.video?this.video.currentSrc:void 0}},{key:"currentTime",get:function(){return this.video&&this.video.currentTime||0},set:function(e){var t=this;("function"!=typeof isFinite||isFinite(e))&&((0,r.hasClass)(this.root,"xgplayer-ended")?(this.once("playing",(function(){t.video.currentTime=e})),this.replay()):this.video.currentTime=e,this.emit("currentTimeChange",e))}},{key:"defaultMuted",get:function(){return!!this.video&&this.video.defaultMuted},set:function(e){this.video&&(this.video.defaultMuted=e)}},{key:"duration",get:function(){return this.config.duration?this.video?Math.min(this.config.duration,this.video.duration):this.config.duration:this.video?this.video.duration:null}},{key:"ended",get:function(){return!this.video||(this.video.ended||!1)}},{key:"error",get:function(){var e=this.video.error;if(!e)return null;var t=[{en:"MEDIA_ERR_ABORTED",cn:"取回过程被用户中止"},{en:"MEDIA_ERR_NETWORK",cn:"当下载时发生错误"},{en:"MEDIA_ERR_DECODE",cn:"当解码时发生错误"},{en:"MEDIA_ERR_SRC_NOT_SUPPORTED",cn:"不支持音频/视频"}];return this.lang?this.lang[t[e.code-1].en]:t[e.code-1].en}},{key:"loop",get:function(){return!!this.video&&this.video.loop},set:function(e){this.video&&(this.video.loop=e)}},{key:"muted",get:function(){return!!this.video&&this.video.muted},set:function(e){this.video&&(this.video.muted=e)}},{key:"networkState",get:function(){var e=[{en:"NETWORK_EMPTY",cn:"音频/视频尚未初始化"},{en:"NETWORK_IDLE",cn:"音频/视频是活动的且已选取资源,但并未使用网络"},{en:"NETWORK_LOADING",cn:"浏览器正在下载数据"},{en:"NETWORK_NO_SOURCE",cn:"未找到音频/视频来源"}];return this.lang?this.lang[e[this.video.networkState].en]:e[this.video.networkState].en}},{key:"paused",get:function(){return(0,r.hasClass)(this.root,"xgplayer-pause")}},{key:"playbackRate",get:function(){return this.video?this.video.playbackRate:1},set:function(e){this.video&&(this.video.playbackRate=e)}},{key:"played",get:function(){return this.video?this.video.played:void 0}},{key:"preload",get:function(){return!!this.video&&this.video.preload},set:function(e){this.video&&(this.video.preload=e)}},{key:"readyState",get:function(){var e=[{en:"HAVE_NOTHING",cn:"没有关于音频/视频是否就绪的信息"},{en:"HAVE_METADATA",cn:"关于音频/视频就绪的元数据"},{en:"HAVE_CURRENT_DATA",cn:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒"},{en:"HAVE_FUTURE_DATA",cn:"当前及至少下一帧的数据是可用的"},{en:"HAVE_ENOUGH_DATA",cn:"可用数据足以开始播放"}];return this.lang?this.lang[e[this.video.readyState].en]:e[this.video.readyState]}},{key:"seekable",get:function(){return!!this.video&&this.video.seekable}},{key:"seeking",get:function(){return!!this.video&&this.video.seeking}},{key:"src",get:function(){return this.video?this.video.src:void 0},set:function(e){(0,r.hasClass)(this.root,"xgplayer-ended")||this.emit("urlchange",this.video.src),(0,r.removeClass)(this.root,"xgplayer-ended xgplayer-is-replay xgplayer-is-error"),this.video.pause(),this.emit("pause"),this.video.src=e,this.emit("srcChange")}},{key:"poster",set:function(e){var t=(0,r.findDom)(this.root,".xgplayer-poster");t&&(t.style.backgroundImage="url("+e+")")}},{key:"volume",get:function(){return this.video?this.video.volume:1},set:function(e){this.video&&(this.video.volume=e)}},{key:"fullscreen",get:function(){return(0,r.hasClass)(this.root,"xgplayer-is-fullscreen")||(0,r.hasClass)(this.root,"xgplayer-fullscreen-active")}},{key:"bullet",get:function(){return!!(0,r.findDom)(this.root,"xg-danmu")&&(0,r.hasClass)((0,r.findDom)(this.root,"xg-danmu"),"xgplayer-has-danmu")}},{key:"textTrack",get:function(){return(0,r.hasClass)(this.root,"xgplayer-is-textTrack")}},{key:"pip",get:function(){return(0,r.hasClass)(this.root,"xgplayer-pip-active")}}]),e}();t.default=l,e.exports=t.default},function(e,t,n){"use strict";var i,o,r,a,s,l,c,u=n(13),f=n(30),d=Function.prototype.apply,p=Function.prototype.call,h=Object.create,v=Object.defineProperty,y=Object.defineProperties,g=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};o=function(e,t){var n,o;return f(t),o=this,i.call(this,e,n=function(){r.call(o,e,n),d.call(t,this,arguments)}),n.__eeOnceListener__=t,this},s={on:i=function(e,t){var n;return f(t),g.call(this,"__ee__")?n=this.__ee__:(n=m.value=h(null),v(this,"__ee__",m),m.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:o,off:r=function(e,t){var n,i,o,r;if(f(t),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(i=n[e]))for(r=0;o=i[r];++r)o!==t&&o.__eeOnceListener__!==t||(2===i.length?n[e]=i[r?0:1]:i.splice(r,1));else i!==t&&i.__eeOnceListener__!==t||delete n[e];return this},emit:a=function(e){var t,n,i,o,r;if(g.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];for(o=o.slice(),t=0;i=o[t];++t)d.call(i,this,r)}else switch(arguments.length){case 1:p.call(o,this);break;case 2:p.call(o,this,arguments[1]);break;case 3:p.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),t=1;t<n;++t)r[t-1]=arguments[t];d.call(o,this,r)}}},l={on:u(i),once:u(o),off:u(r),emit:u(a)},c=y({},l),e.exports=t=function(e){return null==e?h(c):y(Object(e),l)},t.methods=s},function(e,t,n){"use strict";var i=n(6),o=n(14),r=n(18),a=n(26),s=n(27);(e.exports=function(e,t){var n,o,l,c,u;return arguments.length<2||"string"!=typeof e?(c=t,t=e,e=null):c=arguments[2],i(e)?(n=s.call(e,"c"),o=s.call(e,"e"),l=s.call(e,"w")):(n=l=!0,o=!1),u={value:t,configurable:n,enumerable:o,writable:l},c?r(a(c),u):u}).gs=function(e,t,n){var l,c,u,f;return"string"!=typeof e?(u=n,n=t,t=e,e=null):u=arguments[3],i(t)?o(t)?i(n)?o(n)||(u=n,n=void 0):n=void 0:(u=t,t=n=void 0):t=void 0,i(e)?(l=s.call(e,"c"),c=s.call(e,"e")):(l=!0,c=!1),f={get:t,set:n,configurable:l,enumerable:c},u?r(a(u),f):f}},function(e,t,n){"use strict";var i=n(15),o=/^\s*class[\s{/}]/,r=Function.prototype.toString;e.exports=function(e){return!!i(e)&&!o.test(r.call(e))}},function(e,t,n){"use strict";var i=n(16);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!i(e)}},function(e,t,n){"use strict";var i=n(17);e.exports=function(e){if(!i(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(6),o={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!i(e)&&hasOwnProperty.call(o,typeof e)}},function(e,t,n){"use strict";e.exports=n(19)()?Object.assign:n(20)},function(e,t,n){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,n){"use strict";var i=n(21),o=n(25),r=Math.max;e.exports=function(e,t){var n,a,s,l=r(arguments.length,2);for(e=Object(o(e)),s=function(i){try{e[i]=t[i]}catch(e){n||(n=e)}},a=1;a<l;++a)i(t=arguments[a]).forEach(s);if(void 0!==n)throw n;return e}},function(e,t,n){"use strict";e.exports=n(22)()?Object.keys:n(23)},function(e,t,n){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,n){"use strict";var i=n(3),o=Object.keys;e.exports=function(e){return o(i(e)?Object(e):e)}},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";var i=n(3);e.exports=function(e){if(!i(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){"use strict";var i=n(3),o=Array.prototype.forEach,r=Object.create,a=function(e,t){var n;for(n in e)t[n]=e[n]};e.exports=function(e){var t=r(null);return o.call(arguments,(function(e){i(e)&&a(Object(e),t)})),t}},function(e,t,n){"use strict";e.exports=n(28)()?String.prototype.contains:n(29)},function(e,t,n){"use strict";var i="razdwatrzy";e.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(e,t,n){"use strict";var i=String.prototype.indexOf;e.exports=function(e){return i.call(this,e,arguments[1])>-1}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,n){"use strict";var i=n(32),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t,n=arguments[1];if(i(e),void 0===n)o.call(e,"__ee__")&&delete e.__ee__;else{if(!(t=o.call(e,"__ee__")&&e.__ee__))return;t[n]&&delete t[n]}}},function(e,t,n){"use strict";var i=n(33);e.exports=function(e){if(!i(e))throw new TypeError(e+" is not an Object");return e}},function(e,t,n){"use strict";var i=n(3),o={function:!0,object:!0};e.exports=function(e){return i(e)&&o[typeof e]||!1}},function(e,t,n){var i=n(35);"string"==typeof i&&(i=[[e.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(2)(i,o);i.locals&&(e.exports=i.locals)},function(e,t,n){(e.exports=n(1)(!1)).push([e.i,".xgplayer-skin-default{background:#000;width:100%;height:100%;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.xgplayer-skin-default *{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}.xgplayer-skin-default.xgplayer-rotate-fullscreen{position:absolute;top:0;left:100%;bottom:0;right:0;height:100vw!important;width:100vh!important;-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.xgplayer-skin-default.xgplayer-is-fullscreen{width:100%!important;height:100%!important;padding-top:0!important;z-index:9999}.xgplayer-skin-default.xgplayer-is-fullscreen.xgplayer-inactive{cursor:none}.xgplayer-skin-default video{width:100%;height:100%;outline:none}.xgplayer-skin-default .xgplayer-none{display:none}@-webkit-keyframes loadingRotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loadingRotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes loadingDashOffset{0%{stroke-dashoffset:236}to{stroke-dashoffset:0}}@keyframes loadingDashOffset{0%{stroke-dashoffset:236}to{stroke-dashoffset:0}}.xgplayer-skin-default .xgplayer-controls{display:-webkit-flex;display:-moz-box;display:flex;position:absolute;bottom:0;left:0;right:0;height:40px;background-image:linear-gradient(180deg,transparent,rgba(0,0,0,.37),rgba(0,0,0,.75),rgba(0,0,0,.75));z-index:10}.xgplayer-skin-default.xgplayer-inactive .xgplayer-controls,.xgplayer-skin-default.xgplayer-is-live .xgplayer-controls .xgplayer-progress,.xgplayer-skin-default.xgplayer-is-live .xgplayer-controls .xgplayer-time,.xgplayer-skin-default.xgplayer-no-controls .xgplayer-controls,.xgplayer-skin-default.xgplayer-nostart .xgplayer-controls{display:none}.xgplayer-skin-default.xgplayer-is-live .xgplayer-controls .xgplayer-live{display:block}.xgplayer-skin-default .xgplayer-live{display:block;font-size:12px;color:#fff;line-height:40px;-webkit-order:1;-moz-box-ordinal-group:2;order:1}.xgplayer-skin-default .xgplayer-icon{display:block;width:40px;height:40px;overflow:hidden;fill:#fff}.xgplayer-skin-default .xgplayer-icon svg{position:absolute}.xgplayer-skin-default .xgplayer-tips{background:rgba(0,0,0,.54);border-radius:1px;display:none;position:absolute;font-family:PingFangSC-Regular;font-size:11px;color:#fff;padding:2px 4px;text-align:center;top:-30px;left:50%;margin-left:-16px;width:auto;white-space:nowrap}.xgplayer-skin-default.xgplayer-mobile .xgplayer-tips{display:none!important}.xgplayer-skin-default .xgplayer-screen-container{display:block;width:100%}",""])},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,i=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0);t.default={name:"mobile",method:function(){var e=this,t=e.root,n=0,o=void 0,r={first:"",second:""};function a(t){e.video.addEventListener("touchend",(function(t){e.onElementTouchend(t,e.video)})),e.video.addEventListener("touchstart",(function(){e.isTouchMove=!1})),e.video.addEventListener("touchmove",(function(){e.isTouchMove=!0})),e.config.autoplay&&e.start()}e.onElementTouchend=function(e,a){this.config.closeVideoPreventDefault||e.preventDefault(),this.config.closeVideoStopPropagation||e.stopPropagation();var s=this;if((0,i.hasClass)(t,"xgplayer-inactive")?s.emit("focus"):s.emit("blur"),!s.config.closeVideoTouch&&!s.isTouchMove){var l=function(){o=setTimeout((function(){if((0,i.hasClass)(s.root,"xgplayer-nostart"))return!1;if(!s.ended)if(s.paused){var e=s.play();void 0!==e&&e&&e.catch((function(e){}))}else s.pause();n=0}),200)};s.config.closeVideoClick||(n++,o&&clearTimeout(o),1===n?s.config.enableVideoDbltouch?r.first=new Date:l():2===n&&s.config.enableVideoDbltouch?(r.second=new Date,Math.abs(r.first-r.second)<400?l():(r.first=new Date,n=1)):n=0)}},e.once("ready",a),e.once("destroy",(function t(){e.off("ready",a),e.off("destroy",t)}))}},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0);t.default={name:"pc",method:function(){var e=this;if(e.controls&&e.video){var t=e.controls,n=e.root,o=0,r=void 0;e.onElementClick=function(e,t){this.config.closeVideoPreventDefault||e.preventDefault(),this.config.closeVideoStopPropagation||e.stopPropagation();var n=this;n.config.closeVideoClick||(o++,r&&clearTimeout(r),1===o?r=setTimeout((function(){if((0,i.hasClass)(n.root,"xgplayer-nostart"))return!1;if(!n.ended)if(n.paused){var e=n.play();void 0!==e&&e&&e.catch((function(e){}))}else n.pause();o=0}),200):o=0)},e.video.addEventListener("click",(function(t){e.onElementClick(t,e.video)}),!1),e.onElementDblclick=function(e,n){this.config.closeVideoPreventDefault||e.preventDefault(),this.config.closeVideoStopPropagation||e.stopPropagation();if(!this.config.closeVideoDblclick){var i=t.querySelector(".xgplayer-fullscreen");if(i){var o=void 0;document.createEvent?(o=document.createEvent("Event")).initEvent("click",!0,!0):o=new Event("click"),i.dispatchEvent(o)}}},e.video.addEventListener("dblclick",(function(t){e.onElementDblclick(t,e.video)}),!1),n.addEventListener("mouseenter",a),n.addEventListener("mouseleave",s),t.addEventListener("mouseenter",(function(t){e.userTimer&&clearTimeout(e.userTimer)})),t.addEventListener("mouseleave",(function(t){e.config.closeControlsBlur||e.emit("focus",e)})),t.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation()})),e.once("ready",l),e.once("destroy",(function t(){n.removeEventListener("mouseenter",a),n.removeEventListener("mouseleave",s),e.off("ready",l),e.off("destroy",t)}))}function a(){clearTimeout(e.leavePlayerTimer),e.emit("focus",e)}function s(){e.config.closePlayerBlur||(e.leavePlayerTimer=setTimeout((function(){e.emit("blur",e)}),e.config.leavePlayerTime||0))}function l(t){e.config.autoplay&&e.start()}}},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0);t.default={name:"start",method:function(){var e=this,t=e.root;function n(){e.off("canplay",n);var t=e.play();void 0!==t&&t&&t.catch((function(e){}))}function o(){(0,i.hasClass)(t,"xgplayer-nostart")?((0,i.removeClass)(t,"xgplayer-nostart"),(0,i.addClass)(t,"xgplayer-is-enter"),"function"==typeof t.contains?e.video&&1===e.video.nodeType&&!t.contains(e.video)||e.video&&1!==e.video.nodeType&&void 0===e.video.mediaSource?(e.once("canplay",n),e.start()):n():e.video&&1===e.video.nodeType&&!t.querySelector(this.videoConfig.mediaType)||e.video&&1!==e.video.nodeType&&void 0===e.video.mediaSource?(e.once("canplay",n),e.start()):n()):e.paused&&((0,i.removeClass)(t,"xgplayer-nostart xgplayer-isloading"),setTimeout((function(){var t=e.play();void 0!==t&&t&&t.catch((function(e){}))}),10))}e.on("startBtnClick",o),e.once("destroy",(function t(){e.off("startBtnClick",o),e.off("canplay",n),e.off("destroy",t)}))}},e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),o=a(n(41)),r=a(n(42));function a(e){return e&&e.__esModule?e:{default:e}}n(43);t.default={name:"s_start",method:function(){var e=this,t=e.root,n=(0,i.createDom)("xg-start",'<div class="xgplayer-icon-play">'+o.default+'</div>\n <div class="xgplayer-icon-pause">'+r.default+"</div>",{},"xgplayer-start");function a(e){(0,i.addClass)(e.root,"xgplayer-skin-default"),e.config&&(e.config.autoplay&&!(0,i.isWeiXin)()&&!(0,i.isUc)()&&(0,i.addClass)(e.root,"xgplayer-is-enter"),e.config.lang&&"en"===e.config.lang?(0,i.addClass)(e.root,"xgplayer-lang-is-en"):"jp"===e.config.lang&&(0,i.addClass)(e.root,"xgplayer-lang-is-jp"),e.config.enableContextmenu||e.video.addEventListener("contextmenu",(function(e){e.preventDefault(),e.stopPropagation()})))}e.config&&e.config.hideStartBtn&&(0,i.addClass)(t,"xgplayer-start-hide"),e.isReady?(t.appendChild(n),a(e)):e.once("ready",(function(){t.appendChild(n),a(e)})),e.once("autoplay was prevented",(function(){(0,i.removeClass)(e.root,"xgplayer-is-enter"),(0,i.addClass)(e.root,"xgplayer-nostart")})),e.once("canplay",(function(){(0,i.removeClass)(e.root,"xgplayer-is-enter")})),n.onclick=function(t){t.preventDefault(),t.stopPropagation(),e.userGestureTrigEvent("startBtnClick")}}},e.exports=t.default},function(e,t,n){"use strict";n.r(t),t.default='<svg xmlns="http://www.w3.org/2000/svg" width="70" height="70" viewBox="0 0 70 70">\n <path transform="translate(15,15) scale(0.04,0.04)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n'},function(e,t,n){"use strict";n.r(t),t.default='<svg xmlns="http://www.w3.org/2000/svg" width="70" height="70" viewBox="0 0 70 70">\n <path transform="translate(15,15) scale(0.04 0.04)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n'},function(e,t,n){var i=n(44);"string"==typeof i&&(i=[[e.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(2)(i,o);i.locals&&(e.exports=i.locals)},function(e,t,n){(e.exports=n(1)(!1)).push([e.i,".xgplayer-skin-default .xgplayer-start{border-radius:50%;display:inline-block;width:70px;height:70px;background:rgba(0,0,0,.38);overflow:hidden;text-align:center;line-height:70px;vertical-align:middle;position:absolute;left:50%;top:50%;z-index:115;margin:-35px auto auto -35px;cursor:pointer}.xgplayer-skin-default .xgplayer-start div{position:absolute}.xgplayer-skin-default .xgplayer-start div svg{fill:hsla(0,0%,100%,.7)}.xgplayer-skin-default .xgplayer-start .xgplayer-icon-play{display:block}.xgplayer-skin-default .xgplayer-start .xgplayer-icon-pause{display:none}.xgplayer-skin-default .xgplayer-start:hover{opacity:.85}.xgplayer-skin-default.xgplayer-pause.xgplayer-start-hide .xgplayer-start,.xgplayer-skin-default.xgplayer-playing .xgplayer-start,.xgplayer-skin-default.xgplayer-playing .xgplayer-start .xgplayer-icon-play,.xgplayer-skin-default.xgplayer-start-hide .xgplayer-start{display:none}.xgplayer-skin-default.xgplayer-playing .xgplayer-start .xgplayer-icon-pause{display:block}.xgplayer-skin-default.xgplayer-pause .xgplayer-start{display:inline-block}.xgplayer-skin-default.xgplayer-pause .xgplayer-start .xgplayer-icon-play{display:block}.xgplayer-skin-default.xgplayer-is-replay .xgplayer-start,.xgplayer-skin-default.xgplayer-pause .xgplayer-start .xgplayer-icon-pause{display:none}.xgplayer-skin-default.xgplayer-is-replay .xgplayer-start .xgplayer-icon-play{display:block}.xgplayer-skin-default.xgplayer-is-replay .xgplayer-start .xgplayer-icon-pause{display:none}",""])},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(176)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=l(n(9)),o=l(n(37)),r=l(n(38)),a=l(n(39)),s=l(n(40));function l(e){return e&&e.__esModule?e:{default:e}}[o.default,r.default,a.default,s.default].forEach((function(e){i.default.install(e.name,e.method)})),t.default=i.default,e.exports=t.default}])}));
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["xgplayer"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["xgplayer"] = factory();
|
|
10
|
+
})(this, function() {
|
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
12
|
+
/******/ // The module cache
|
|
13
|
+
/******/ var installedModules = {};
|
|
14
|
+
/******/
|
|
15
|
+
/******/ // The require function
|
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
|
17
|
+
/******/
|
|
18
|
+
/******/ // Check if module is in cache
|
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
|
21
|
+
/******/ }
|
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
|
24
|
+
/******/ i: moduleId,
|
|
25
|
+
/******/ l: false,
|
|
26
|
+
/******/ exports: {}
|
|
27
|
+
/******/ };
|
|
28
|
+
/******/
|
|
29
|
+
/******/ // Execute the module function
|
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
+
/******/
|
|
32
|
+
/******/ // Flag the module as loaded
|
|
33
|
+
/******/ module.l = true;
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // Return the exports of the module
|
|
36
|
+
/******/ return module.exports;
|
|
37
|
+
/******/ }
|
|
38
|
+
/******/
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
+
/******/ __webpack_require__.m = modules;
|
|
42
|
+
/******/
|
|
43
|
+
/******/ // expose the module cache
|
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
|
45
|
+
/******/
|
|
46
|
+
/******/ // define getter function for harmony exports
|
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
+
/******/ }
|
|
51
|
+
/******/ };
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // define __esModule on exports
|
|
54
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
+
/******/ };
|
|
60
|
+
/******/
|
|
61
|
+
/******/ // create a fake namespace object
|
|
62
|
+
/******/ // mode & 1: value is a module id, require it
|
|
63
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
+
/******/ // mode & 4: return value when already ns object
|
|
65
|
+
/******/ // mode & 8|1: behave like require
|
|
66
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
+
/******/ if(mode & 8) return value;
|
|
69
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
+
/******/ var ns = Object.create(null);
|
|
71
|
+
/******/ __webpack_require__.r(ns);
|
|
72
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
+
/******/ return ns;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
+
/******/ __webpack_require__.n = function(module) {
|
|
79
|
+
/******/ var getter = module && module.__esModule ?
|
|
80
|
+
/******/ function getDefault() { return module['default']; } :
|
|
81
|
+
/******/ function getModuleExports() { return module; };
|
|
82
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
+
/******/ return getter;
|
|
84
|
+
/******/ };
|
|
85
|
+
/******/
|
|
86
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // __webpack_public_path__
|
|
90
|
+
/******/ __webpack_require__.p = "";
|
|
91
|
+
/******/
|
|
92
|
+
/******/
|
|
93
|
+
/******/ // Load entry module and return exports
|
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = 175);
|
|
95
|
+
/******/ })
|
|
96
|
+
/************************************************************************/
|
|
97
|
+
/******/ ([
|
|
98
|
+
/* 0 */
|
|
99
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
100
|
+
|
|
101
|
+
"use strict";
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
Object.defineProperty(exports, "__esModule", {
|
|
105
|
+
value: true
|
|
106
|
+
});
|
|
107
|
+
exports.util = exports.PresentationMode = undefined;
|
|
108
|
+
exports.createDom = createDom;
|
|
109
|
+
exports.hasClass = hasClass;
|
|
110
|
+
exports.addClass = addClass;
|
|
111
|
+
exports.removeClass = removeClass;
|
|
112
|
+
exports.toggleClass = toggleClass;
|
|
113
|
+
exports.findDom = findDom;
|
|
114
|
+
exports.padStart = padStart;
|
|
115
|
+
exports.format = format;
|
|
116
|
+
exports.event = event;
|
|
117
|
+
exports.typeOf = typeOf;
|
|
118
|
+
exports.deepCopy = deepCopy;
|
|
119
|
+
exports.getBgImage = getBgImage;
|
|
120
|
+
exports.copyDom = copyDom;
|
|
121
|
+
exports._setInterval = _setInterval;
|
|
122
|
+
exports._clearInterval = _clearInterval;
|
|
123
|
+
exports.createImgBtn = createImgBtn;
|
|
124
|
+
exports.isWeiXin = isWeiXin;
|
|
125
|
+
exports.isUc = isUc;
|
|
126
|
+
exports.computeWatchDur = computeWatchDur;
|
|
127
|
+
exports.offInDestroy = offInDestroy;
|
|
128
|
+
exports.on = on;
|
|
129
|
+
exports.once = once;
|
|
130
|
+
exports.getBuffered2 = getBuffered2;
|
|
131
|
+
exports.checkIsBrowser = checkIsBrowser;
|
|
132
|
+
exports.setStyle = setStyle;
|
|
133
|
+
exports.checkWebkitSetPresentationMode = checkWebkitSetPresentationMode;
|
|
134
|
+
|
|
135
|
+
var _xgplayerTimeRange = __webpack_require__(7);
|
|
136
|
+
|
|
137
|
+
var _xgplayerTimeRange2 = _interopRequireDefault(_xgplayerTimeRange);
|
|
138
|
+
|
|
139
|
+
function _interopRequireDefault(obj) {
|
|
140
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function createDom() {
|
|
144
|
+
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
|
|
145
|
+
var tpl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
146
|
+
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
147
|
+
var cname = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
148
|
+
|
|
149
|
+
var dom = document.createElement(el);
|
|
150
|
+
dom.className = cname;
|
|
151
|
+
dom.innerHTML = tpl;
|
|
152
|
+
Object.keys(attrs).forEach(function (item) {
|
|
153
|
+
var key = item;
|
|
154
|
+
var value = attrs[item];
|
|
155
|
+
if (el === 'video' || el === 'audio') {
|
|
156
|
+
if (value) {
|
|
157
|
+
dom.setAttribute(key, value);
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
dom.setAttribute(key, value);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return dom;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function hasClass(el, className) {
|
|
167
|
+
if (!el) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (el.classList) {
|
|
172
|
+
return Array.prototype.some.call(el.classList, function (item) {
|
|
173
|
+
return item === className;
|
|
174
|
+
});
|
|
175
|
+
} else if (el.className) {
|
|
176
|
+
return !!el.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
|
|
177
|
+
} else {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function addClass(el, className) {
|
|
183
|
+
if (!el) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (el.classList) {
|
|
188
|
+
className.replace(/(^\s+|\s+$)/g, '').split(/\s+/g).forEach(function (item) {
|
|
189
|
+
item && el.classList.add(item);
|
|
190
|
+
});
|
|
191
|
+
} else if (!hasClass(el, className)) {
|
|
192
|
+
el.className += ' ' + className;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function removeClass(el, className) {
|
|
197
|
+
if (!el) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (el.classList) {
|
|
202
|
+
className.split(/\s+/g).forEach(function (item) {
|
|
203
|
+
el.classList.remove(item);
|
|
204
|
+
});
|
|
205
|
+
} else if (hasClass(el, className)) {
|
|
206
|
+
className.split(/\s+/g).forEach(function (item) {
|
|
207
|
+
var reg = new RegExp('(\\s|^)' + item + '(\\s|$)');
|
|
208
|
+
el.className = el.className.replace(reg, ' ');
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function toggleClass(el, className) {
|
|
214
|
+
if (!el) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
className.split(/\s+/g).forEach(function (item) {
|
|
219
|
+
if (hasClass(el, item)) {
|
|
220
|
+
removeClass(el, item);
|
|
221
|
+
} else {
|
|
222
|
+
addClass(el, item);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function findDom() {
|
|
228
|
+
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
229
|
+
var sel = arguments[1];
|
|
230
|
+
|
|
231
|
+
var dom = void 0;
|
|
232
|
+
// fix querySelector IDs that start with a digit
|
|
233
|
+
// https://stackoverflow.com/questions/37270787/uncaught-syntaxerror-failed-to-execute-queryselector-on-document
|
|
234
|
+
try {
|
|
235
|
+
dom = el.querySelector(sel);
|
|
236
|
+
} catch (e) {
|
|
237
|
+
if (sel.indexOf('#') === 0) {
|
|
238
|
+
dom = el.getElementById(sel.slice(1));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return dom;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function padStart(str, length, pad) {
|
|
245
|
+
var charstr = String(pad);
|
|
246
|
+
var len = length >> 0;
|
|
247
|
+
var maxlen = Math.ceil(len / charstr.length);
|
|
248
|
+
var chars = [];
|
|
249
|
+
var r = String(str);
|
|
250
|
+
while (maxlen--) {
|
|
251
|
+
chars.push(charstr);
|
|
252
|
+
}
|
|
253
|
+
return chars.join('').substring(0, len - r.length) + r;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function format(time) {
|
|
257
|
+
if (window.isNaN(time)) {
|
|
258
|
+
return '';
|
|
259
|
+
}
|
|
260
|
+
var hour = padStart(Math.floor(time / 3600), 2, 0);
|
|
261
|
+
var minute = padStart(Math.floor((time - hour * 3600) / 60), 2, 0);
|
|
262
|
+
var second = padStart(Math.floor(time - hour * 3600 - minute * 60), 2, 0);
|
|
263
|
+
return (hour === '00' ? [minute, second] : [hour, minute, second]).join(':');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function event(e) {
|
|
267
|
+
if (e.touches) {
|
|
268
|
+
var touch = e.touches[0] || e.changedTouches[0];
|
|
269
|
+
e.clientX = touch.clientX || 0;
|
|
270
|
+
e.clientY = touch.clientY || 0;
|
|
271
|
+
e.offsetX = touch.pageX - touch.target.offsetLeft;
|
|
272
|
+
e.offsetY = touch.pageY - touch.target.offsetTop;
|
|
273
|
+
}
|
|
274
|
+
e._target = e.target || e.srcElement;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function typeOf(obj) {
|
|
278
|
+
return Object.prototype.toString.call(obj).match(/([^\s.*]+)(?=]$)/g)[0];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function deepCopy(dst, src) {
|
|
282
|
+
if (typeOf(src) === 'Object' && typeOf(dst) === 'Object') {
|
|
283
|
+
Object.keys(src).forEach(function (key) {
|
|
284
|
+
if (typeOf(src[key]) === 'Object' && !(src[key] instanceof Node)) {
|
|
285
|
+
if (!dst[key]) {
|
|
286
|
+
dst[key] = src[key];
|
|
287
|
+
} else {
|
|
288
|
+
deepCopy(dst[key], src[key]);
|
|
289
|
+
}
|
|
290
|
+
} else if (typeOf(src[key]) === 'Array') {
|
|
291
|
+
dst[key] = typeOf(dst[key]) === 'Array' ? dst[key].concat(src[key]) : src[key];
|
|
292
|
+
} else {
|
|
293
|
+
dst[key] = src[key];
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
return dst;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function getBgImage(el) {
|
|
300
|
+
// fix: return current page url when url is none
|
|
301
|
+
var url = (el.currentStyle || window.getComputedStyle(el, null)).backgroundImage;
|
|
302
|
+
if (!url || url === 'none') {
|
|
303
|
+
return '';
|
|
304
|
+
}
|
|
305
|
+
var a = document.createElement('a');
|
|
306
|
+
a.href = url.replace(/url\("|"\)/g, '');
|
|
307
|
+
return a.href;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function copyDom(dom) {
|
|
311
|
+
if (dom && dom.nodeType === 1) {
|
|
312
|
+
var back = document.createElement(dom.tagName);
|
|
313
|
+
Array.prototype.forEach.call(dom.attributes, function (node) {
|
|
314
|
+
back.setAttribute(node.name, node.value);
|
|
315
|
+
});
|
|
316
|
+
if (dom.innerHTML) {
|
|
317
|
+
back.innerHTML = dom.innerHTML;
|
|
318
|
+
}
|
|
319
|
+
return back;
|
|
320
|
+
} else {
|
|
321
|
+
return '';
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function _setInterval(context, eventName, intervalFunc, frequency) {
|
|
326
|
+
if (!context._interval[eventName]) {
|
|
327
|
+
context._interval[eventName] = setInterval(intervalFunc.bind(context), frequency);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function _clearInterval(context, eventName) {
|
|
332
|
+
clearInterval(context._interval[eventName]);
|
|
333
|
+
context._interval[eventName] = null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function createImgBtn(name, imgUrl, width, height) {
|
|
337
|
+
var btn = createDom('xg-' + name, '', {}, 'xgplayer-' + name + '-img');
|
|
338
|
+
btn.style.backgroundImage = 'url("' + imgUrl + '")';
|
|
339
|
+
if (width && height) {
|
|
340
|
+
var w = void 0,
|
|
341
|
+
h = void 0,
|
|
342
|
+
unit = void 0;
|
|
343
|
+
['px', 'rem', 'em', 'pt', 'dp', 'vw', 'vh', 'vm', '%'].every(function (item) {
|
|
344
|
+
if (width.indexOf(item) > -1 && height.indexOf(item) > -1) {
|
|
345
|
+
w = Number(width.slice(0, width.indexOf(item)).trim());
|
|
346
|
+
h = Number(height.slice(0, height.indexOf(item)).trim());
|
|
347
|
+
unit = item;
|
|
348
|
+
return false;
|
|
349
|
+
} else {
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
btn.style.width = '' + w + unit;
|
|
354
|
+
btn.style.height = '' + h + unit;
|
|
355
|
+
btn.style.backgroundSize = '' + w + unit + ' ' + h + unit;
|
|
356
|
+
if (name === 'start') {
|
|
357
|
+
btn.style.margin = '-' + h / 2 + unit + ' auto auto -' + w / 2 + unit;
|
|
358
|
+
} else {
|
|
359
|
+
btn.style.margin = 'auto 5px auto 5px';
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return btn;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function isWeiXin() {
|
|
366
|
+
var ua = window.navigator.userAgent.toLowerCase();
|
|
367
|
+
return ua.indexOf('micromessenger') > -1;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function isUc() {
|
|
371
|
+
var ua = window.navigator.userAgent.toLowerCase();
|
|
372
|
+
return ua.indexOf('ucbrowser') > -1;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function computeWatchDur() {
|
|
376
|
+
var played = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
377
|
+
|
|
378
|
+
var arr = [];
|
|
379
|
+
for (var i = 0; i < played.length; i++) {
|
|
380
|
+
if (!played[i].end || played[i].begin < 0 || played[i].end < 0 || played[i].end < played[i].begin) {
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
if (arr.length < 1) {
|
|
384
|
+
arr.push({ begin: played[i].begin, end: played[i].end });
|
|
385
|
+
} else {
|
|
386
|
+
for (var j = 0; j < arr.length; j++) {
|
|
387
|
+
var begin = played[i].begin;
|
|
388
|
+
var end = played[i].end;
|
|
389
|
+
if (end < arr[j].begin) {
|
|
390
|
+
arr.splice(j, 0, { begin: begin, end: end });
|
|
391
|
+
break;
|
|
392
|
+
} else if (begin > arr[j].end) {
|
|
393
|
+
if (j > arr.length - 2) {
|
|
394
|
+
arr.push({ begin: begin, end: end });
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
var b = arr[j].begin;
|
|
399
|
+
var e = arr[j].end;
|
|
400
|
+
arr[j].begin = Math.min(begin, b);
|
|
401
|
+
arr[j].end = Math.max(end, e);
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
var watch_dur = 0;
|
|
408
|
+
for (var _i = 0; _i < arr.length; _i++) {
|
|
409
|
+
watch_dur += arr[_i].end - arr[_i].begin;
|
|
410
|
+
}
|
|
411
|
+
return watch_dur;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function offInDestroy(object, event, fn, offEvent) {
|
|
415
|
+
function onDestroy() {
|
|
416
|
+
object.off(event, fn);
|
|
417
|
+
object.off(offEvent, onDestroy);
|
|
418
|
+
}
|
|
419
|
+
object.once(offEvent, onDestroy);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function on(object, event, fn, offEvent) {
|
|
423
|
+
if (offEvent) {
|
|
424
|
+
object.on(event, fn);
|
|
425
|
+
offInDestroy(object, event, fn, offEvent);
|
|
426
|
+
} else {
|
|
427
|
+
var _fn = function _fn(data) {
|
|
428
|
+
fn(data);
|
|
429
|
+
object.off(event, _fn);
|
|
430
|
+
};
|
|
431
|
+
object.on(event, _fn);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function once(object, event, fn, offEvent) {
|
|
436
|
+
if (offEvent) {
|
|
437
|
+
object.once(event, fn);
|
|
438
|
+
offInDestroy(object, event, fn, offEvent);
|
|
439
|
+
} else {
|
|
440
|
+
var _fn = function _fn(data) {
|
|
441
|
+
fn(data);
|
|
442
|
+
object.off(event, _fn);
|
|
443
|
+
};
|
|
444
|
+
object.once(event, _fn);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getBuffered2(vbuffered) {
|
|
449
|
+
var maxHoleDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;
|
|
450
|
+
//ref: hls.js
|
|
451
|
+
var buffered = [];
|
|
452
|
+
for (var i = 0; i < vbuffered.length; i++) {
|
|
453
|
+
buffered.push({ start: vbuffered.start(i) < 0.5 ? 0 : vbuffered.start(i), end: vbuffered.end(i) });
|
|
454
|
+
}
|
|
455
|
+
buffered.sort(function (a, b) {
|
|
456
|
+
var diff = a.start - b.start;
|
|
457
|
+
if (diff) {
|
|
458
|
+
return diff;
|
|
459
|
+
} else {
|
|
460
|
+
return b.end - a.end;
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
var buffered_2 = [];
|
|
464
|
+
if (maxHoleDuration) {
|
|
465
|
+
for (var _i2 = 0; _i2 < buffered.length; _i2++) {
|
|
466
|
+
var buf2len = buffered_2.length;
|
|
467
|
+
if (buf2len) {
|
|
468
|
+
var buf2end = buffered_2[buf2len - 1].end;
|
|
469
|
+
if (buffered[_i2].start - buf2end < maxHoleDuration) {
|
|
470
|
+
if (buffered[_i2].end > buf2end) {
|
|
471
|
+
buffered_2[buf2len - 1].end = buffered[_i2].end;
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
buffered_2.push(buffered[_i2]);
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
buffered_2.push(buffered[_i2]);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
} else {
|
|
481
|
+
buffered_2 = buffered;
|
|
482
|
+
}
|
|
483
|
+
return new _xgplayerTimeRange2.default(buffered_2);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function checkIsBrowser() {
|
|
487
|
+
return !(typeof window === 'undefined' || typeof window.document === 'undefined' || typeof window.document.createElement === 'undefined');
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function setStyle(elem, name, value) {
|
|
491
|
+
var style = elem.style;
|
|
492
|
+
try {
|
|
493
|
+
style[name] = value;
|
|
494
|
+
} catch (error) {
|
|
495
|
+
style.setProperty(name, value);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
var PresentationMode = exports.PresentationMode = {
|
|
500
|
+
PIP: 'picture-in-picture',
|
|
501
|
+
INLINE: 'inline',
|
|
502
|
+
FULLSCREEN: 'fullscreen'
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
function checkWebkitSetPresentationMode(video) {
|
|
506
|
+
return typeof video.webkitSetPresentationMode === 'function';
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
var util = exports.util = {
|
|
510
|
+
createDom: createDom, hasClass: hasClass, addClass: addClass, removeClass: removeClass, toggleClass: toggleClass, findDom: findDom, padStart: padStart, format: format, event: event, typeOf: typeOf,
|
|
511
|
+
deepCopy: deepCopy, getBgImage: getBgImage, copyDom: copyDom, setInterval: _setInterval, clearInterval: _clearInterval, createImgBtn: createImgBtn, isWeiXin: isWeiXin, isUc: isUc, computeWatchDur: computeWatchDur,
|
|
512
|
+
offInDestroy: offInDestroy, on: on, once: once, getBuffered2: getBuffered2, checkIsBrowser: checkIsBrowser, setStyle: setStyle
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
/***/ }),
|
|
516
|
+
/* 1 */
|
|
517
|
+
/***/ (function(module, exports) {
|
|
518
|
+
|
|
519
|
+
/*
|
|
520
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
521
|
+
Author Tobias Koppers @sokra
|
|
522
|
+
*/
|
|
523
|
+
// css base code, injected by the css-loader
|
|
524
|
+
module.exports = function (useSourceMap) {
|
|
525
|
+
var list = [];
|
|
526
|
+
|
|
527
|
+
// return the list of modules as css string
|
|
528
|
+
list.toString = function toString() {
|
|
529
|
+
return this.map(function (item) {
|
|
530
|
+
var content = cssWithMappingToString(item, useSourceMap);
|
|
531
|
+
if (item[2]) {
|
|
532
|
+
return "@media " + item[2] + "{" + content + "}";
|
|
533
|
+
} else {
|
|
534
|
+
return content;
|
|
535
|
+
}
|
|
536
|
+
}).join("");
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
// import a list of modules into the list
|
|
540
|
+
list.i = function (modules, mediaQuery) {
|
|
541
|
+
if (typeof modules === "string") modules = [[null, modules, ""]];
|
|
542
|
+
var alreadyImportedModules = {};
|
|
543
|
+
for (var i = 0; i < this.length; i++) {
|
|
544
|
+
var id = this[i][0];
|
|
545
|
+
if (typeof id === "number") alreadyImportedModules[id] = true;
|
|
546
|
+
}
|
|
547
|
+
for (i = 0; i < modules.length; i++) {
|
|
548
|
+
var item = modules[i];
|
|
549
|
+
// skip already imported module
|
|
550
|
+
// this implementation is not 100% perfect for weird media query combinations
|
|
551
|
+
// when a module is imported multiple times with different media queries.
|
|
552
|
+
// I hope this will never occur (Hey this way we have smaller bundles)
|
|
553
|
+
if (typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
|
554
|
+
if (mediaQuery && !item[2]) {
|
|
555
|
+
item[2] = mediaQuery;
|
|
556
|
+
} else if (mediaQuery) {
|
|
557
|
+
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
|
558
|
+
}
|
|
559
|
+
list.push(item);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
return list;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
function cssWithMappingToString(item, useSourceMap) {
|
|
567
|
+
var content = item[1] || '';
|
|
568
|
+
var cssMapping = item[3];
|
|
569
|
+
if (!cssMapping) {
|
|
570
|
+
return content;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (useSourceMap && typeof btoa === 'function') {
|
|
574
|
+
var sourceMapping = toComment(cssMapping);
|
|
575
|
+
var sourceURLs = cssMapping.sources.map(function (source) {
|
|
576
|
+
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return [content].join('\n');
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Adapted from convert-source-map (MIT)
|
|
586
|
+
function toComment(sourceMap) {
|
|
587
|
+
// eslint-disable-next-line no-undef
|
|
588
|
+
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
|
|
589
|
+
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
|
|
590
|
+
|
|
591
|
+
return '/*# ' + data + ' */';
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/***/ }),
|
|
595
|
+
/* 2 */
|
|
596
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
597
|
+
|
|
598
|
+
/*
|
|
599
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
600
|
+
Author Tobias Koppers @sokra
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
var stylesInDom = {};
|
|
604
|
+
|
|
605
|
+
var memoize = function (fn) {
|
|
606
|
+
var memo;
|
|
607
|
+
|
|
608
|
+
return function () {
|
|
609
|
+
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
|
|
610
|
+
return memo;
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
var isOldIE = memoize(function () {
|
|
615
|
+
// Test for IE <= 9 as proposed by Browserhacks
|
|
616
|
+
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
|
|
617
|
+
// Tests for existence of standard globals is to allow style-loader
|
|
618
|
+
// to operate correctly into non-standard environments
|
|
619
|
+
// @see https://github.com/webpack-contrib/style-loader/issues/177
|
|
620
|
+
return window && document && document.all && !window.atob;
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
var getTarget = function (target) {
|
|
624
|
+
return document.querySelector(target);
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
var getElement = (function (fn) {
|
|
628
|
+
var memo = {};
|
|
629
|
+
|
|
630
|
+
return function(target) {
|
|
631
|
+
// If passing function in options, then use it for resolve "head" element.
|
|
632
|
+
// Useful for Shadow Root style i.e
|
|
633
|
+
// {
|
|
634
|
+
// insertInto: function () { return document.querySelector("#foo").shadowRoot }
|
|
635
|
+
// }
|
|
636
|
+
if (typeof target === 'function') {
|
|
637
|
+
return target();
|
|
638
|
+
}
|
|
639
|
+
if (typeof memo[target] === "undefined") {
|
|
640
|
+
var styleTarget = getTarget.call(this, target);
|
|
641
|
+
// Special case to return head of iframe instead of iframe itself
|
|
642
|
+
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
|
|
643
|
+
try {
|
|
644
|
+
// This will throw an exception if access to iframe is blocked
|
|
645
|
+
// due to cross-origin restrictions
|
|
646
|
+
styleTarget = styleTarget.contentDocument.head;
|
|
647
|
+
} catch(e) {
|
|
648
|
+
styleTarget = null;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
memo[target] = styleTarget;
|
|
652
|
+
}
|
|
653
|
+
return memo[target]
|
|
654
|
+
};
|
|
655
|
+
})();
|
|
656
|
+
|
|
657
|
+
var singleton = null;
|
|
658
|
+
var singletonCounter = 0;
|
|
659
|
+
var stylesInsertedAtTop = [];
|
|
660
|
+
|
|
661
|
+
var fixUrls = __webpack_require__(36);
|
|
662
|
+
|
|
663
|
+
module.exports = function(list, options) {
|
|
664
|
+
if (typeof DEBUG !== "undefined" && DEBUG) {
|
|
665
|
+
if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
options = options || {};
|
|
669
|
+
|
|
670
|
+
options.attrs = typeof options.attrs === "object" ? options.attrs : {};
|
|
671
|
+
|
|
672
|
+
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
|
673
|
+
// tags it will allow on a page
|
|
674
|
+
if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
|
|
675
|
+
|
|
676
|
+
// By default, add <style> tags to the <head> element
|
|
677
|
+
if (!options.insertInto) options.insertInto = "head";
|
|
678
|
+
|
|
679
|
+
// By default, add <style> tags to the bottom of the target
|
|
680
|
+
if (!options.insertAt) options.insertAt = "bottom";
|
|
681
|
+
|
|
682
|
+
var styles = listToStyles(list, options);
|
|
683
|
+
|
|
684
|
+
addStylesToDom(styles, options);
|
|
685
|
+
|
|
686
|
+
return function update (newList) {
|
|
687
|
+
var mayRemove = [];
|
|
688
|
+
|
|
689
|
+
for (var i = 0; i < styles.length; i++) {
|
|
690
|
+
var item = styles[i];
|
|
691
|
+
var domStyle = stylesInDom[item.id];
|
|
692
|
+
|
|
693
|
+
domStyle.refs--;
|
|
694
|
+
mayRemove.push(domStyle);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if(newList) {
|
|
698
|
+
var newStyles = listToStyles(newList, options);
|
|
699
|
+
addStylesToDom(newStyles, options);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
for (var i = 0; i < mayRemove.length; i++) {
|
|
703
|
+
var domStyle = mayRemove[i];
|
|
704
|
+
|
|
705
|
+
if(domStyle.refs === 0) {
|
|
706
|
+
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
|
|
707
|
+
|
|
708
|
+
delete stylesInDom[domStyle.id];
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
function addStylesToDom (styles, options) {
|
|
715
|
+
for (var i = 0; i < styles.length; i++) {
|
|
716
|
+
var item = styles[i];
|
|
717
|
+
var domStyle = stylesInDom[item.id];
|
|
718
|
+
|
|
719
|
+
if(domStyle) {
|
|
720
|
+
domStyle.refs++;
|
|
721
|
+
|
|
722
|
+
for(var j = 0; j < domStyle.parts.length; j++) {
|
|
723
|
+
domStyle.parts[j](item.parts[j]);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
for(; j < item.parts.length; j++) {
|
|
727
|
+
domStyle.parts.push(addStyle(item.parts[j], options));
|
|
728
|
+
}
|
|
729
|
+
} else {
|
|
730
|
+
var parts = [];
|
|
731
|
+
|
|
732
|
+
for(var j = 0; j < item.parts.length; j++) {
|
|
733
|
+
parts.push(addStyle(item.parts[j], options));
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function listToStyles (list, options) {
|
|
742
|
+
var styles = [];
|
|
743
|
+
var newStyles = {};
|
|
744
|
+
|
|
745
|
+
for (var i = 0; i < list.length; i++) {
|
|
746
|
+
var item = list[i];
|
|
747
|
+
var id = options.base ? item[0] + options.base : item[0];
|
|
748
|
+
var css = item[1];
|
|
749
|
+
var media = item[2];
|
|
750
|
+
var sourceMap = item[3];
|
|
751
|
+
var part = {css: css, media: media, sourceMap: sourceMap};
|
|
752
|
+
|
|
753
|
+
if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
|
|
754
|
+
else newStyles[id].parts.push(part);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
return styles;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function insertStyleElement (options, style) {
|
|
761
|
+
var target = getElement(options.insertInto)
|
|
762
|
+
|
|
763
|
+
if (!target) {
|
|
764
|
+
throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
|
|
768
|
+
|
|
769
|
+
if (options.insertAt === "top") {
|
|
770
|
+
if (!lastStyleElementInsertedAtTop) {
|
|
771
|
+
target.insertBefore(style, target.firstChild);
|
|
772
|
+
} else if (lastStyleElementInsertedAtTop.nextSibling) {
|
|
773
|
+
target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
|
|
774
|
+
} else {
|
|
775
|
+
target.appendChild(style);
|
|
776
|
+
}
|
|
777
|
+
stylesInsertedAtTop.push(style);
|
|
778
|
+
} else if (options.insertAt === "bottom") {
|
|
779
|
+
target.appendChild(style);
|
|
780
|
+
} else if (typeof options.insertAt === "object" && options.insertAt.before) {
|
|
781
|
+
var nextSibling = getElement(options.insertInto + " " + options.insertAt.before);
|
|
782
|
+
target.insertBefore(style, nextSibling);
|
|
783
|
+
} else {
|
|
784
|
+
throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
function removeStyleElement (style) {
|
|
789
|
+
if (style.parentNode === null) return false;
|
|
790
|
+
style.parentNode.removeChild(style);
|
|
791
|
+
|
|
792
|
+
var idx = stylesInsertedAtTop.indexOf(style);
|
|
793
|
+
if(idx >= 0) {
|
|
794
|
+
stylesInsertedAtTop.splice(idx, 1);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function createStyleElement (options) {
|
|
799
|
+
var style = document.createElement("style");
|
|
800
|
+
|
|
801
|
+
options.attrs.type = "text/css";
|
|
802
|
+
|
|
803
|
+
addAttrs(style, options.attrs);
|
|
804
|
+
insertStyleElement(options, style);
|
|
805
|
+
|
|
806
|
+
return style;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function createLinkElement (options) {
|
|
810
|
+
var link = document.createElement("link");
|
|
811
|
+
|
|
812
|
+
options.attrs.type = "text/css";
|
|
813
|
+
options.attrs.rel = "stylesheet";
|
|
814
|
+
|
|
815
|
+
addAttrs(link, options.attrs);
|
|
816
|
+
insertStyleElement(options, link);
|
|
817
|
+
|
|
818
|
+
return link;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
function addAttrs (el, attrs) {
|
|
822
|
+
Object.keys(attrs).forEach(function (key) {
|
|
823
|
+
el.setAttribute(key, attrs[key]);
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
function addStyle (obj, options) {
|
|
828
|
+
var style, update, remove, result;
|
|
829
|
+
|
|
830
|
+
// If a transform function was defined, run it on the css
|
|
831
|
+
if (options.transform && obj.css) {
|
|
832
|
+
result = options.transform(obj.css);
|
|
833
|
+
|
|
834
|
+
if (result) {
|
|
835
|
+
// If transform returns a value, use that instead of the original css.
|
|
836
|
+
// This allows running runtime transformations on the css.
|
|
837
|
+
obj.css = result;
|
|
838
|
+
} else {
|
|
839
|
+
// If the transform function returns a falsy value, don't add this css.
|
|
840
|
+
// This allows conditional loading of css
|
|
841
|
+
return function() {
|
|
842
|
+
// noop
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
if (options.singleton) {
|
|
848
|
+
var styleIndex = singletonCounter++;
|
|
849
|
+
|
|
850
|
+
style = singleton || (singleton = createStyleElement(options));
|
|
851
|
+
|
|
852
|
+
update = applyToSingletonTag.bind(null, style, styleIndex, false);
|
|
853
|
+
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
|
|
854
|
+
|
|
855
|
+
} else if (
|
|
856
|
+
obj.sourceMap &&
|
|
857
|
+
typeof URL === "function" &&
|
|
858
|
+
typeof URL.createObjectURL === "function" &&
|
|
859
|
+
typeof URL.revokeObjectURL === "function" &&
|
|
860
|
+
typeof Blob === "function" &&
|
|
861
|
+
typeof btoa === "function"
|
|
862
|
+
) {
|
|
863
|
+
style = createLinkElement(options);
|
|
864
|
+
update = updateLink.bind(null, style, options);
|
|
865
|
+
remove = function () {
|
|
866
|
+
removeStyleElement(style);
|
|
867
|
+
|
|
868
|
+
if(style.href) URL.revokeObjectURL(style.href);
|
|
869
|
+
};
|
|
870
|
+
} else {
|
|
871
|
+
style = createStyleElement(options);
|
|
872
|
+
update = applyToTag.bind(null, style);
|
|
873
|
+
remove = function () {
|
|
874
|
+
removeStyleElement(style);
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
update(obj);
|
|
879
|
+
|
|
880
|
+
return function updateStyle (newObj) {
|
|
881
|
+
if (newObj) {
|
|
882
|
+
if (
|
|
883
|
+
newObj.css === obj.css &&
|
|
884
|
+
newObj.media === obj.media &&
|
|
885
|
+
newObj.sourceMap === obj.sourceMap
|
|
886
|
+
) {
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
update(obj = newObj);
|
|
891
|
+
} else {
|
|
892
|
+
remove();
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
var replaceText = (function () {
|
|
898
|
+
var textStore = [];
|
|
899
|
+
|
|
900
|
+
return function (index, replacement) {
|
|
901
|
+
textStore[index] = replacement;
|
|
902
|
+
|
|
903
|
+
return textStore.filter(Boolean).join('\n');
|
|
904
|
+
};
|
|
905
|
+
})();
|
|
906
|
+
|
|
907
|
+
function applyToSingletonTag (style, index, remove, obj) {
|
|
908
|
+
var css = remove ? "" : obj.css;
|
|
909
|
+
|
|
910
|
+
if (style.styleSheet) {
|
|
911
|
+
style.styleSheet.cssText = replaceText(index, css);
|
|
912
|
+
} else {
|
|
913
|
+
var cssNode = document.createTextNode(css);
|
|
914
|
+
var childNodes = style.childNodes;
|
|
915
|
+
|
|
916
|
+
if (childNodes[index]) style.removeChild(childNodes[index]);
|
|
917
|
+
|
|
918
|
+
if (childNodes.length) {
|
|
919
|
+
style.insertBefore(cssNode, childNodes[index]);
|
|
920
|
+
} else {
|
|
921
|
+
style.appendChild(cssNode);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
function applyToTag (style, obj) {
|
|
927
|
+
var css = obj.css;
|
|
928
|
+
var media = obj.media;
|
|
929
|
+
|
|
930
|
+
if(media) {
|
|
931
|
+
style.setAttribute("media", media)
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
if(style.styleSheet) {
|
|
935
|
+
style.styleSheet.cssText = css;
|
|
936
|
+
} else {
|
|
937
|
+
while(style.firstChild) {
|
|
938
|
+
style.removeChild(style.firstChild);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
style.appendChild(document.createTextNode(css));
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
function updateLink (link, options, obj) {
|
|
946
|
+
var css = obj.css;
|
|
947
|
+
var sourceMap = obj.sourceMap;
|
|
948
|
+
|
|
949
|
+
/*
|
|
950
|
+
If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
|
|
951
|
+
and there is no publicPath defined then lets turn convertToAbsoluteUrls
|
|
952
|
+
on by default. Otherwise default to the convertToAbsoluteUrls option
|
|
953
|
+
directly
|
|
954
|
+
*/
|
|
955
|
+
var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
|
|
956
|
+
|
|
957
|
+
if (options.convertToAbsoluteUrls || autoFixUrls) {
|
|
958
|
+
css = fixUrls(css);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
if (sourceMap) {
|
|
962
|
+
// http://stackoverflow.com/a/26603875
|
|
963
|
+
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
var blob = new Blob([css], { type: "text/css" });
|
|
967
|
+
|
|
968
|
+
var oldSrc = link.href;
|
|
969
|
+
|
|
970
|
+
link.href = URL.createObjectURL(blob);
|
|
971
|
+
|
|
972
|
+
if(oldSrc) URL.revokeObjectURL(oldSrc);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
/***/ }),
|
|
977
|
+
/* 3 */
|
|
978
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
979
|
+
|
|
980
|
+
"use strict";
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
var _undefined = __webpack_require__(24)(); // Support ES3 engines
|
|
984
|
+
|
|
985
|
+
module.exports = function (val) {
|
|
986
|
+
return val !== _undefined && val !== null;
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
/***/ }),
|
|
990
|
+
/* 4 */
|
|
991
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
992
|
+
|
|
993
|
+
"use strict";
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
Object.defineProperty(exports, "__esModule", {
|
|
997
|
+
value: true
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
var _version = __webpack_require__(8);
|
|
1001
|
+
|
|
1002
|
+
function _classCallCheck(instance, Constructor) {
|
|
1003
|
+
if (!(instance instanceof Constructor)) {
|
|
1004
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
var ErrorTypes = {
|
|
1009
|
+
network: {
|
|
1010
|
+
code: 1,
|
|
1011
|
+
msg: '视频下载错误',
|
|
1012
|
+
remark: '只要视频下载错误就使用此类型,无论是video本身的超时还是xhr的分段请求超时或者资源不存在'
|
|
1013
|
+
},
|
|
1014
|
+
mse: {
|
|
1015
|
+
code: 2,
|
|
1016
|
+
msg: '流追加错误',
|
|
1017
|
+
remark: '追加流的时候如果类型不对、无法被正确解码则会触发此类错误'
|
|
1018
|
+
},
|
|
1019
|
+
parse: {
|
|
1020
|
+
code: 3,
|
|
1021
|
+
msg: '解析错误',
|
|
1022
|
+
remark: 'mp4、hls、flv我们都是使用js进行格式解析,如果解析失败则会触发此类错误'
|
|
1023
|
+
},
|
|
1024
|
+
format: {
|
|
1025
|
+
code: 4,
|
|
1026
|
+
msg: '格式错误',
|
|
1027
|
+
remark: '如果浏览器不支持的格式导致播放错误'
|
|
1028
|
+
},
|
|
1029
|
+
decoder: {
|
|
1030
|
+
code: 5,
|
|
1031
|
+
msg: '解码错误',
|
|
1032
|
+
remark: '浏览器解码异常会抛出此类型错误'
|
|
1033
|
+
},
|
|
1034
|
+
runtime: {
|
|
1035
|
+
code: 6,
|
|
1036
|
+
msg: '语法错误',
|
|
1037
|
+
remark: '播放器语法错误'
|
|
1038
|
+
},
|
|
1039
|
+
timeout: {
|
|
1040
|
+
code: 7,
|
|
1041
|
+
msg: '播放超时',
|
|
1042
|
+
remark: '播放过程中无法正常请求下一个分段导致播放中断'
|
|
1043
|
+
},
|
|
1044
|
+
other: {
|
|
1045
|
+
code: 8,
|
|
1046
|
+
msg: '其他错误',
|
|
1047
|
+
remark: '不可知的错误或被忽略的错误类型'
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
var Errors = function Errors(type, currentTime, duration, networkState, readyState, src, currentSrc, ended) {
|
|
1052
|
+
var errd = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : { line: '', handle: '', msg: '', version: '' };
|
|
1053
|
+
var errorCode = arguments[9];
|
|
1054
|
+
var mediaError = arguments[10];
|
|
1055
|
+
|
|
1056
|
+
_classCallCheck(this, Errors);
|
|
1057
|
+
|
|
1058
|
+
var r = {};
|
|
1059
|
+
if (arguments.length > 1) {
|
|
1060
|
+
r.playerVersion = _version.version; // 播放器版本
|
|
1061
|
+
r.errorType = type;
|
|
1062
|
+
r.domain = document.domain; // domain
|
|
1063
|
+
r.duration = duration; // 视频时长
|
|
1064
|
+
r.currentTime = currentTime;
|
|
1065
|
+
r.networkState = networkState;
|
|
1066
|
+
r.readyState = readyState;
|
|
1067
|
+
r.currentSrc = currentSrc;
|
|
1068
|
+
r.src = src;
|
|
1069
|
+
r.ended = ended;
|
|
1070
|
+
r.errd = errd; // 错误详情
|
|
1071
|
+
r.ex = (ErrorTypes[type] || {}).msg; // 补充信息
|
|
1072
|
+
r.errorCode = errorCode;
|
|
1073
|
+
r.mediaError = mediaError;
|
|
1074
|
+
} else {
|
|
1075
|
+
var arg = arguments[0];
|
|
1076
|
+
Object.keys(arg).map(function (key) {
|
|
1077
|
+
r[key] = arg[key];
|
|
1078
|
+
});
|
|
1079
|
+
r.ex = (arg.type && ErrorTypes[arg.type] || {}).msg;
|
|
1080
|
+
}
|
|
1081
|
+
return r;
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
exports.default = Errors;
|
|
1085
|
+
module.exports = exports['default'];
|
|
1086
|
+
|
|
1087
|
+
/***/ }),
|
|
1088
|
+
/* 5 */
|
|
1089
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1090
|
+
|
|
1091
|
+
"use strict";
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1095
|
+
value: true
|
|
1096
|
+
});
|
|
1097
|
+
var sniffer = {};
|
|
1098
|
+
|
|
1099
|
+
Object.defineProperty(sniffer, 'device', {
|
|
1100
|
+
get: function get() {
|
|
1101
|
+
var r = sniffer.os;
|
|
1102
|
+
return r.isPc ? 'pc' : 'mobile';
|
|
1103
|
+
// return r.isPc ? 'pc' : r.isTablet ? 'tablet' : 'mobile'
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
Object.defineProperty(sniffer, 'browser', {
|
|
1108
|
+
get: function get() {
|
|
1109
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
1110
|
+
var reg = {
|
|
1111
|
+
ie: /rv:([\d.]+)\) like gecko/,
|
|
1112
|
+
firfox: /firefox\/([\d.]+)/,
|
|
1113
|
+
chrome: /chrome\/([\d.]+)/,
|
|
1114
|
+
opera: /opera.([\d.]+)/,
|
|
1115
|
+
safari: /version\/([\d.]+).*safari/
|
|
1116
|
+
};
|
|
1117
|
+
return [].concat(Object.keys(reg).filter(function (key) {
|
|
1118
|
+
return reg[key].test(ua);
|
|
1119
|
+
}))[0] || '';
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
Object.defineProperty(sniffer, 'os', {
|
|
1124
|
+
get: function get() {
|
|
1125
|
+
var ua = navigator.userAgent;
|
|
1126
|
+
var isWindowsPhone = /(?:Windows Phone)/.test(ua);
|
|
1127
|
+
var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
|
|
1128
|
+
var isAndroid = /(?:Android)/.test(ua);
|
|
1129
|
+
var isFireFox = /(?:Firefox)/.test(ua);
|
|
1130
|
+
var isTablet = /(?:iPad|PlayBook)/.test(ua) || isAndroid && !/(?:Mobile)/.test(ua) || isFireFox && /(?:Tablet)/.test(ua);
|
|
1131
|
+
var isPhone = /(?:iPhone)/.test(ua) && !isTablet;
|
|
1132
|
+
var isPc = !isPhone && !isAndroid && !isSymbian && !isTablet;
|
|
1133
|
+
return {
|
|
1134
|
+
isTablet: isTablet,
|
|
1135
|
+
isPhone: isPhone,
|
|
1136
|
+
isAndroid: isAndroid,
|
|
1137
|
+
isPc: isPc,
|
|
1138
|
+
isSymbian: isSymbian,
|
|
1139
|
+
isWindowsPhone: isWindowsPhone,
|
|
1140
|
+
isFireFox: isFireFox
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
|
|
1145
|
+
exports.default = sniffer;
|
|
1146
|
+
module.exports = exports['default'];
|
|
1147
|
+
|
|
1148
|
+
/***/ }),
|
|
1149
|
+
/* 6 */
|
|
1150
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1151
|
+
|
|
1152
|
+
"use strict";
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
// ES3 safe
|
|
1156
|
+
|
|
1157
|
+
var _undefined = void 0;
|
|
1158
|
+
|
|
1159
|
+
module.exports = function (value) {
|
|
1160
|
+
return value !== _undefined && value !== null;
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
/***/ }),
|
|
1164
|
+
/* 7 */
|
|
1165
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1166
|
+
|
|
1167
|
+
"use strict";
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1171
|
+
value: true
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
var _createClass = function () {
|
|
1175
|
+
function defineProperties(target, props) {
|
|
1176
|
+
for (var i = 0; i < props.length; i++) {
|
|
1177
|
+
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
|
|
1178
|
+
}
|
|
1179
|
+
}return function (Constructor, protoProps, staticProps) {
|
|
1180
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
|
|
1181
|
+
};
|
|
1182
|
+
}();
|
|
1183
|
+
|
|
1184
|
+
function _classCallCheck(instance, Constructor) {
|
|
1185
|
+
if (!(instance instanceof Constructor)) {
|
|
1186
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
var XgplayerTimeRange = function () {
|
|
1191
|
+
function XgplayerTimeRange(bufferedList) {
|
|
1192
|
+
_classCallCheck(this, XgplayerTimeRange);
|
|
1193
|
+
|
|
1194
|
+
this.bufferedList = bufferedList;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
_createClass(XgplayerTimeRange, [{
|
|
1198
|
+
key: "start",
|
|
1199
|
+
value: function start(index) {
|
|
1200
|
+
return this.bufferedList[index].start;
|
|
1201
|
+
}
|
|
1202
|
+
}, {
|
|
1203
|
+
key: "end",
|
|
1204
|
+
value: function end(index) {
|
|
1205
|
+
return this.bufferedList[index].end;
|
|
1206
|
+
}
|
|
1207
|
+
}, {
|
|
1208
|
+
key: "length",
|
|
1209
|
+
get: function get() {
|
|
1210
|
+
return this.bufferedList.length;
|
|
1211
|
+
}
|
|
1212
|
+
}]);
|
|
1213
|
+
|
|
1214
|
+
return XgplayerTimeRange;
|
|
1215
|
+
}();
|
|
1216
|
+
|
|
1217
|
+
exports.default = XgplayerTimeRange;
|
|
1218
|
+
module.exports = exports["default"];
|
|
1219
|
+
|
|
1220
|
+
/***/ }),
|
|
1221
|
+
/* 8 */
|
|
1222
|
+
/***/ (function(module) {
|
|
1223
|
+
|
|
1224
|
+
module.exports = JSON.parse("{\"version\":\"2.31.3\"}");
|
|
1225
|
+
|
|
1226
|
+
/***/ }),
|
|
1227
|
+
/* 9 */
|
|
1228
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1229
|
+
|
|
1230
|
+
"use strict";
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1234
|
+
value: true
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
var _createClass = function () {
|
|
1238
|
+
function defineProperties(target, props) {
|
|
1239
|
+
for (var i = 0; i < props.length; i++) {
|
|
1240
|
+
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
|
|
1241
|
+
}
|
|
1242
|
+
}return function (Constructor, protoProps, staticProps) {
|
|
1243
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
|
|
1244
|
+
};
|
|
1245
|
+
}();
|
|
1246
|
+
|
|
1247
|
+
var _get = function get(object, property, receiver) {
|
|
1248
|
+
if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
|
|
1249
|
+
var parent = Object.getPrototypeOf(object);if (parent === null) {
|
|
1250
|
+
return undefined;
|
|
1251
|
+
} else {
|
|
1252
|
+
return get(parent, property, receiver);
|
|
1253
|
+
}
|
|
1254
|
+
} else if ("value" in desc) {
|
|
1255
|
+
return desc.value;
|
|
1256
|
+
} else {
|
|
1257
|
+
var getter = desc.get;if (getter === undefined) {
|
|
1258
|
+
return undefined;
|
|
1259
|
+
}return getter.call(receiver);
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
var _proxy = __webpack_require__(11);
|
|
1264
|
+
|
|
1265
|
+
var _proxy2 = _interopRequireDefault(_proxy);
|
|
1266
|
+
|
|
1267
|
+
var _util = __webpack_require__(0);
|
|
1268
|
+
|
|
1269
|
+
var _sniffer = __webpack_require__(5);
|
|
1270
|
+
|
|
1271
|
+
var _sniffer2 = _interopRequireDefault(_sniffer);
|
|
1272
|
+
|
|
1273
|
+
var _xgplayerTimeRange = __webpack_require__(7);
|
|
1274
|
+
|
|
1275
|
+
var _xgplayerTimeRange2 = _interopRequireDefault(_xgplayerTimeRange);
|
|
1276
|
+
|
|
1277
|
+
var _error = __webpack_require__(4);
|
|
1278
|
+
|
|
1279
|
+
var _error2 = _interopRequireDefault(_error);
|
|
1280
|
+
|
|
1281
|
+
var _allOff = __webpack_require__(31);
|
|
1282
|
+
|
|
1283
|
+
var _allOff2 = _interopRequireDefault(_allOff);
|
|
1284
|
+
|
|
1285
|
+
var _i18n = __webpack_require__(10);
|
|
1286
|
+
|
|
1287
|
+
var _i18n2 = _interopRequireDefault(_i18n);
|
|
1288
|
+
|
|
1289
|
+
__webpack_require__(34);
|
|
1290
|
+
|
|
1291
|
+
var _version = __webpack_require__(8);
|
|
1292
|
+
|
|
1293
|
+
function _interopRequireDefault(obj) {
|
|
1294
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
function _classCallCheck(instance, Constructor) {
|
|
1298
|
+
if (!(instance instanceof Constructor)) {
|
|
1299
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
function _possibleConstructorReturn(self, call) {
|
|
1304
|
+
if (!self) {
|
|
1305
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1306
|
+
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
function _inherits(subClass, superClass) {
|
|
1310
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1311
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1312
|
+
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
var Player = function (_Proxy) {
|
|
1316
|
+
_inherits(Player, _Proxy);
|
|
1317
|
+
|
|
1318
|
+
function Player(options) {
|
|
1319
|
+
_classCallCheck(this, Player);
|
|
1320
|
+
|
|
1321
|
+
var _this = _possibleConstructorReturn(this, (Player.__proto__ || Object.getPrototypeOf(Player)).call(this, options));
|
|
1322
|
+
|
|
1323
|
+
_this.config = (0, _util.deepCopy)({
|
|
1324
|
+
width: 600,
|
|
1325
|
+
height: 337.5,
|
|
1326
|
+
ignores: [],
|
|
1327
|
+
whitelist: [],
|
|
1328
|
+
lang: (document.documentElement.getAttribute('lang') || navigator.language || 'zh-cn').toLocaleLowerCase(),
|
|
1329
|
+
inactive: 3000,
|
|
1330
|
+
volume: 0.6,
|
|
1331
|
+
controls: true,
|
|
1332
|
+
controlsList: ['nodownload']
|
|
1333
|
+
}, options);
|
|
1334
|
+
_this.version = _version.version;
|
|
1335
|
+
_this.userTimer = null;
|
|
1336
|
+
_this.waitTimer = null;
|
|
1337
|
+
_this.history = [];
|
|
1338
|
+
_this.isProgressMoving = false;
|
|
1339
|
+
_this.root = (0, _util.findDom)(document, '#' + _this.config.id);
|
|
1340
|
+
_this.controls = (0, _util.createDom)('xg-controls', '', {
|
|
1341
|
+
unselectable: 'on',
|
|
1342
|
+
onselectstart: 'return false'
|
|
1343
|
+
}, 'xgplayer-controls');
|
|
1344
|
+
if (_this.config.isShowControl) {
|
|
1345
|
+
_this.controls.style.display = 'none';
|
|
1346
|
+
}
|
|
1347
|
+
if (!_this.root) {
|
|
1348
|
+
var el = _this.config.el;
|
|
1349
|
+
if (el && el.nodeType === 1) {
|
|
1350
|
+
_this.root = el;
|
|
1351
|
+
} else {
|
|
1352
|
+
var _ret;
|
|
1353
|
+
|
|
1354
|
+
_this.emit('error', new _error2.default({
|
|
1355
|
+
type: 'use',
|
|
1356
|
+
errd: {
|
|
1357
|
+
line: 45,
|
|
1358
|
+
handle: 'Constructor',
|
|
1359
|
+
msg: 'container id can\'t be empty'
|
|
1360
|
+
},
|
|
1361
|
+
vid: _this.config.vid
|
|
1362
|
+
}));
|
|
1363
|
+
console.error('container id can\'t be empty');
|
|
1364
|
+
return _ret = false, _possibleConstructorReturn(_this, _ret);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
// this.rootBackup = copyDom(this.root)
|
|
1368
|
+
(0, _util.addClass)(_this.root, 'xgplayer xgplayer-' + _sniffer2.default.device + ' xgplayer-nostart xgplayer-pause ' + (_this.config.controls ? '' : 'xgplayer-no-controls'));
|
|
1369
|
+
_this.root.appendChild(_this.controls);
|
|
1370
|
+
if (_this.config.fluid) {
|
|
1371
|
+
_this.root.style['max-width'] = '100%';
|
|
1372
|
+
_this.root.style['width'] = '100%';
|
|
1373
|
+
_this.root.style['height'] = '0';
|
|
1374
|
+
_this.root.style['padding-top'] = _this.config.height * 100 / _this.config.width + '%';
|
|
1375
|
+
|
|
1376
|
+
_this.video.style['position'] = 'absolute';
|
|
1377
|
+
_this.video.style['top'] = '0';
|
|
1378
|
+
_this.video.style['left'] = '0';
|
|
1379
|
+
} else {
|
|
1380
|
+
// this.root.style.width = `${this.config.width}px`
|
|
1381
|
+
// this.root.style.height = `${this.config.height}px`
|
|
1382
|
+
if (_this.config.width) {
|
|
1383
|
+
if (typeof _this.config.width !== 'number') {
|
|
1384
|
+
_this.root.style.width = _this.config.width;
|
|
1385
|
+
} else {
|
|
1386
|
+
_this.root.style.width = _this.config.width + 'px';
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
if (_this.config.height) {
|
|
1390
|
+
if (typeof _this.config.height !== 'number') {
|
|
1391
|
+
_this.root.style.height = _this.config.height;
|
|
1392
|
+
} else {
|
|
1393
|
+
_this.root.style.height = _this.config.height + 'px';
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
if (_this.config.execBeforePluginsCall) {
|
|
1398
|
+
_this.config.execBeforePluginsCall.forEach(function (item) {
|
|
1399
|
+
item.call(_this, _this);
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
if (!_this.config.closeI18n) {
|
|
1403
|
+
Player.install(_i18n2.default.name, _i18n2.default.method);
|
|
1404
|
+
}
|
|
1405
|
+
if (_this.config.controlStyle && (0, _util.typeOf)(_this.config.controlStyle) === 'String') {
|
|
1406
|
+
var self = _this;
|
|
1407
|
+
fetch(self.config.controlStyle, {
|
|
1408
|
+
method: 'GET',
|
|
1409
|
+
headers: {
|
|
1410
|
+
Accept: 'application/json'
|
|
1411
|
+
}
|
|
1412
|
+
}).then(function (res) {
|
|
1413
|
+
if (res.ok) {
|
|
1414
|
+
res.json().then(function (obj) {
|
|
1415
|
+
for (var prop in obj) {
|
|
1416
|
+
if (obj.hasOwnProperty(prop)) {
|
|
1417
|
+
self.config[prop] = obj[prop];
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
self.pluginsCall();
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
}).catch(function (err) {
|
|
1424
|
+
console.log('Fetch错误:' + err);
|
|
1425
|
+
});
|
|
1426
|
+
} else {
|
|
1427
|
+
_this.pluginsCall();
|
|
1428
|
+
}
|
|
1429
|
+
if (_this.config.controlPlugins) {
|
|
1430
|
+
Player.controlsRun(_this.config.controlPlugins, _this);
|
|
1431
|
+
}
|
|
1432
|
+
_this.ev.forEach(function (item) {
|
|
1433
|
+
var evName = Object.keys(item)[0];
|
|
1434
|
+
var evFunc = _this[item[evName]];
|
|
1435
|
+
if (evFunc) {
|
|
1436
|
+
_this.on(evName, evFunc);
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
['focus', 'blur'].forEach(function (item) {
|
|
1441
|
+
_this.on(item, _this['on' + item.charAt(0).toUpperCase() + item.slice(1)]);
|
|
1442
|
+
});
|
|
1443
|
+
var player = _this;
|
|
1444
|
+
_this.mousemoveFunc = function () {
|
|
1445
|
+
player.emit('focus');
|
|
1446
|
+
if (!player.config.closeFocusVideoFocus) {
|
|
1447
|
+
player.video.focus();
|
|
1448
|
+
}
|
|
1449
|
+
};
|
|
1450
|
+
_this.root.addEventListener('mousemove', _this.mousemoveFunc);
|
|
1451
|
+
_this.playFunc = function () {
|
|
1452
|
+
player.emit('focus');
|
|
1453
|
+
if (!player.config.closePlayVideoFocus) {
|
|
1454
|
+
player.video.focus();
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
player.once('play', _this.playFunc);
|
|
1458
|
+
|
|
1459
|
+
_this.getVideoSize = function () {
|
|
1460
|
+
if (this.video.videoWidth && this.video.videoHeight) {
|
|
1461
|
+
var containerSize = player.root.getBoundingClientRect();
|
|
1462
|
+
if (player.config.fitVideoSize === 'auto') {
|
|
1463
|
+
if (containerSize.width / containerSize.height > this.video.videoWidth / this.video.videoHeight) {
|
|
1464
|
+
player.root.style.height = this.video.videoHeight / this.video.videoWidth * containerSize.width + 'px';
|
|
1465
|
+
} else {
|
|
1466
|
+
player.root.style.width = this.video.videoWidth / this.video.videoHeight * containerSize.height + 'px';
|
|
1467
|
+
}
|
|
1468
|
+
} else if (player.config.fitVideoSize === 'fixWidth') {
|
|
1469
|
+
player.root.style.height = this.video.videoHeight / this.video.videoWidth * containerSize.width + 'px';
|
|
1470
|
+
} else if (player.config.fitVideoSize === 'fixHeight') {
|
|
1471
|
+
player.root.style.width = this.video.videoWidth / this.video.videoHeight * containerSize.height + 'px';
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
player.once('loadeddata', _this.getVideoSize);
|
|
1476
|
+
|
|
1477
|
+
setTimeout(function () {
|
|
1478
|
+
_this.emit('ready');
|
|
1479
|
+
_this.isReady = true;
|
|
1480
|
+
}, 0);
|
|
1481
|
+
|
|
1482
|
+
if (_this.config.videoInit) {
|
|
1483
|
+
if ((0, _util.hasClass)(_this.root, 'xgplayer-nostart')) {
|
|
1484
|
+
_this.start();
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
if (player.config.rotate) {
|
|
1488
|
+
player.on('requestFullscreen', _this.updateRotateDeg);
|
|
1489
|
+
player.on('exitFullscreen', _this.updateRotateDeg);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function onDestroy() {
|
|
1493
|
+
player.root.removeEventListener('mousemove', player.mousemoveFunc);
|
|
1494
|
+
player.off('destroy', onDestroy);
|
|
1495
|
+
}
|
|
1496
|
+
player.once('destroy', onDestroy);
|
|
1497
|
+
return _this;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
_createClass(Player, [{
|
|
1501
|
+
key: 'attachVideo',
|
|
1502
|
+
value: function attachVideo() {
|
|
1503
|
+
var _this2 = this;
|
|
1504
|
+
|
|
1505
|
+
if (this.video && this.video.nodeType === 1) {
|
|
1506
|
+
this.root.insertBefore(this.video, this.root.firstChild);
|
|
1507
|
+
}
|
|
1508
|
+
setTimeout(function () {
|
|
1509
|
+
_this2.emit('complete');
|
|
1510
|
+
if (_this2.danmu && typeof _this2.danmu.resize === 'function') {
|
|
1511
|
+
_this2.danmu.resize();
|
|
1512
|
+
}
|
|
1513
|
+
}, 1);
|
|
1514
|
+
}
|
|
1515
|
+
}, {
|
|
1516
|
+
key: 'start',
|
|
1517
|
+
value: function start() {
|
|
1518
|
+
var _this3 = this;
|
|
1519
|
+
|
|
1520
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.config.url;
|
|
1521
|
+
|
|
1522
|
+
if (!this.video) return;
|
|
1523
|
+
var player = this;
|
|
1524
|
+
if (!url || url === '') {
|
|
1525
|
+
this.emit('urlNull');
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
this.canPlayFunc = function () {
|
|
1529
|
+
player.off('canplay', player.canPlayFunc);
|
|
1530
|
+
var playPromise = player.video.play();
|
|
1531
|
+
if (playPromise !== undefined && playPromise) {
|
|
1532
|
+
playPromise.then(function () {
|
|
1533
|
+
player.emit('autoplay started');
|
|
1534
|
+
}).catch(function () {
|
|
1535
|
+
player.emit('autoplay was prevented');
|
|
1536
|
+
(0, _util.addClass)(player.root, 'xgplayer-is-autoplay');
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
if ((0, _util.typeOf)(url) !== 'Array') {
|
|
1541
|
+
if ((0, _util.typeOf)(url) === 'String' && url.indexOf('blob:') > -1 && url === this.video.src) {
|
|
1542
|
+
// 在Chromium环境下用mse url给video二次赋值会导致错误
|
|
1543
|
+
} else {
|
|
1544
|
+
this.video.src = url;
|
|
1545
|
+
}
|
|
1546
|
+
} else {
|
|
1547
|
+
url.forEach(function (item) {
|
|
1548
|
+
_this3.video.appendChild((0, _util.createDom)('source', '', {
|
|
1549
|
+
src: '' + item.src,
|
|
1550
|
+
type: '' + (item.type || '')
|
|
1551
|
+
}));
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
if (this.config.autoplay) {
|
|
1555
|
+
if (_sniffer2.default.os.isPhone) {
|
|
1556
|
+
this.canPlayFunc();
|
|
1557
|
+
} else {
|
|
1558
|
+
this.on('canplay', this.canPlayFunc);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
if (!this.config.disableStartLoad) {
|
|
1562
|
+
this.video.load();
|
|
1563
|
+
}
|
|
1564
|
+
this.attachVideo();
|
|
1565
|
+
}
|
|
1566
|
+
}, {
|
|
1567
|
+
key: 'reload',
|
|
1568
|
+
value: function reload() {
|
|
1569
|
+
this.video.load();
|
|
1570
|
+
this.reloadFunc = function () {
|
|
1571
|
+
// eslint-disable-next-line handle-callback-err
|
|
1572
|
+
var playPromise = this.play();
|
|
1573
|
+
if (playPromise !== undefined && playPromise) {
|
|
1574
|
+
playPromise.catch(function (err) {});
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
this.once('loadeddata', this.reloadFunc);
|
|
1578
|
+
}
|
|
1579
|
+
}, {
|
|
1580
|
+
key: 'destroy',
|
|
1581
|
+
value: function destroy() {
|
|
1582
|
+
var _this4 = this;
|
|
1583
|
+
|
|
1584
|
+
var isDelDom = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1585
|
+
|
|
1586
|
+
var player = this;
|
|
1587
|
+
clearInterval(this.bulletResizeTimer);
|
|
1588
|
+
for (var k in this._interval) {
|
|
1589
|
+
clearInterval(this._interval[k]);
|
|
1590
|
+
this._interval[k] = null;
|
|
1591
|
+
}
|
|
1592
|
+
if (this.checkTimer) {
|
|
1593
|
+
clearInterval(this.checkTimer);
|
|
1594
|
+
}
|
|
1595
|
+
if (this.waitTimer) {
|
|
1596
|
+
clearTimeout(this.waitTimer);
|
|
1597
|
+
}
|
|
1598
|
+
this.ev.forEach(function (item) {
|
|
1599
|
+
var evName = Object.keys(item)[0];
|
|
1600
|
+
var evFunc = _this4[item[evName]];
|
|
1601
|
+
if (evFunc) {
|
|
1602
|
+
_this4.off(evName, evFunc);
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
if (this.loadeddataFunc) {
|
|
1606
|
+
this.off('loadeddata', this.loadeddataFunc);
|
|
1607
|
+
}
|
|
1608
|
+
if (this.reloadFunc) {
|
|
1609
|
+
this.off('loadeddata', this.reloadFunc);
|
|
1610
|
+
}
|
|
1611
|
+
if (this.replayFunc) {
|
|
1612
|
+
this.off('play', this.replayFunc);
|
|
1613
|
+
}
|
|
1614
|
+
if (this.playFunc) {
|
|
1615
|
+
this.off('play', this.playFunc);
|
|
1616
|
+
}
|
|
1617
|
+
if (this.getVideoSize) {
|
|
1618
|
+
this.off('loadeddata', this.getVideoSize);
|
|
1619
|
+
};
|
|
1620
|
+
['focus', 'blur'].forEach(function (item) {
|
|
1621
|
+
_this4.off(item, _this4['on' + item.charAt(0).toUpperCase() + item.slice(1)]);
|
|
1622
|
+
});
|
|
1623
|
+
if (!this.config.keyShortcut || this.config.keyShortcut === 'on') {
|
|
1624
|
+
['video', 'controls'].forEach(function (item) {
|
|
1625
|
+
if (_this4[item]) {
|
|
1626
|
+
_this4[item].removeEventListener('keydown', function (e) {
|
|
1627
|
+
player.onKeydown(e, player);
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
function destroyFunc() {
|
|
1634
|
+
this.emit('destroy');
|
|
1635
|
+
// this.root.id = this.root.id + '_del'
|
|
1636
|
+
// parentNode.insertBefore(this.rootBackup, this.root)
|
|
1637
|
+
|
|
1638
|
+
// fix video destroy https://stackoverflow.com/questions/3258587/how-to-properly-unload-destroy-a-video-element
|
|
1639
|
+
this.video.removeAttribute('src'); // empty source
|
|
1640
|
+
this.video.load();
|
|
1641
|
+
if (isDelDom) {
|
|
1642
|
+
// parentNode.removeChild(this.root)
|
|
1643
|
+
this.root.innerHTML = '';
|
|
1644
|
+
var classNameList = this.root.className.split(' ');
|
|
1645
|
+
if (classNameList.length > 0) {
|
|
1646
|
+
this.root.className = classNameList.filter(function (name) {
|
|
1647
|
+
return name.indexOf('xgplayer') < 0;
|
|
1648
|
+
}).join(' ');
|
|
1649
|
+
} else {
|
|
1650
|
+
this.root.className = '';
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
for (var _k in this) {
|
|
1655
|
+
// if (k !== 'config') {
|
|
1656
|
+
delete this[_k];
|
|
1657
|
+
// }
|
|
1658
|
+
}
|
|
1659
|
+
(0, _allOff2.default)(this);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
if (!this.paused) {
|
|
1663
|
+
this.pause();
|
|
1664
|
+
this.once('pause', destroyFunc);
|
|
1665
|
+
} else {
|
|
1666
|
+
destroyFunc.call(this);
|
|
1667
|
+
}
|
|
1668
|
+
_get(Player.prototype.__proto__ || Object.getPrototypeOf(Player.prototype), 'destroy', this).call(this);
|
|
1669
|
+
}
|
|
1670
|
+
}, {
|
|
1671
|
+
key: 'replay',
|
|
1672
|
+
value: function replay() {
|
|
1673
|
+
var self = this;
|
|
1674
|
+
var _replay = this._replay;
|
|
1675
|
+
// ie9 bugfix
|
|
1676
|
+
(0, _util.removeClass)(this.root, 'xgplayer-ended');
|
|
1677
|
+
if (_sniffer2.default.browser.indexOf('ie') > -1) {
|
|
1678
|
+
this.emit('play');
|
|
1679
|
+
this.emit('playing');
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
if (_replay && _replay instanceof Function) {
|
|
1683
|
+
_replay();
|
|
1684
|
+
} else {
|
|
1685
|
+
this.currentTime = 0;
|
|
1686
|
+
// eslint-disable-next-line handle-callback-err
|
|
1687
|
+
var playPromise = this.play();
|
|
1688
|
+
if (playPromise !== undefined && playPromise) {
|
|
1689
|
+
playPromise.catch(function (err) {});
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}, {
|
|
1694
|
+
key: 'userGestureTrigEvent',
|
|
1695
|
+
value: function userGestureTrigEvent(name, param) {
|
|
1696
|
+
var _this5 = this;
|
|
1697
|
+
|
|
1698
|
+
var defaultUserGestureEventHandler = function defaultUserGestureEventHandler(name, param) {
|
|
1699
|
+
_this5.emit(name, param);
|
|
1700
|
+
};
|
|
1701
|
+
if (this.config.userGestureEventMiddleware && typeof this.config.userGestureEventMiddleware[name] === 'function') {
|
|
1702
|
+
this.config.userGestureEventMiddleware[name].call(this, this, name, param, defaultUserGestureEventHandler);
|
|
1703
|
+
} else {
|
|
1704
|
+
defaultUserGestureEventHandler.call(this, name, param);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}, {
|
|
1708
|
+
key: 'pluginsCall',
|
|
1709
|
+
value: function pluginsCall() {
|
|
1710
|
+
var _this6 = this;
|
|
1711
|
+
|
|
1712
|
+
if (Player.plugins['s_i18n']) {
|
|
1713
|
+
Player.plugins['s_i18n'].call(this, this);
|
|
1714
|
+
}
|
|
1715
|
+
var self = this;
|
|
1716
|
+
if (Player.plugins) {
|
|
1717
|
+
var ignores = this.config.ignores;
|
|
1718
|
+
Object.keys(Player.plugins).forEach(function (name) {
|
|
1719
|
+
var descriptor = Player.plugins[name];
|
|
1720
|
+
if (!descriptor || typeof descriptor !== 'function') {
|
|
1721
|
+
console.warn('plugin name', name, 'is invalid');
|
|
1722
|
+
} else {
|
|
1723
|
+
if (!ignores.some(function (item) {
|
|
1724
|
+
return name === item || name === 's_' + item;
|
|
1725
|
+
}) && name !== 's_i18n') {
|
|
1726
|
+
if (['pc', 'tablet', 'mobile'].some(function (type) {
|
|
1727
|
+
return type === name;
|
|
1728
|
+
})) {
|
|
1729
|
+
if (name === _sniffer2.default.device) {
|
|
1730
|
+
setTimeout(function () {
|
|
1731
|
+
// if destroyed, skip
|
|
1732
|
+
if (!self.video) return;
|
|
1733
|
+
descriptor.call(self, self);
|
|
1734
|
+
}, 0);
|
|
1735
|
+
}
|
|
1736
|
+
} else {
|
|
1737
|
+
descriptor.call(_this6, _this6);
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}, {
|
|
1745
|
+
key: 'onFocus',
|
|
1746
|
+
value: function onFocus() {
|
|
1747
|
+
var player = this;
|
|
1748
|
+
if ((0, _util.hasClass)(this.root, 'xgplayer-inactive')) {
|
|
1749
|
+
player.emit('controlShow');
|
|
1750
|
+
}
|
|
1751
|
+
(0, _util.removeClass)(this.root, 'xgplayer-inactive');
|
|
1752
|
+
if (player.userTimer) {
|
|
1753
|
+
clearTimeout(player.userTimer);
|
|
1754
|
+
}
|
|
1755
|
+
player.userTimer = setTimeout(function () {
|
|
1756
|
+
player.emit('blur');
|
|
1757
|
+
}, player.config.inactive);
|
|
1758
|
+
}
|
|
1759
|
+
}, {
|
|
1760
|
+
key: 'onBlur',
|
|
1761
|
+
value: function onBlur() {
|
|
1762
|
+
// this.video.blur()
|
|
1763
|
+
if ((this.config.enablePausedInactive || !this.paused) && !this.ended && !this.config.closeInactive) {
|
|
1764
|
+
if (!(0, _util.hasClass)(this.root, 'xgplayer-inactive')) {
|
|
1765
|
+
this.emit('controlHide');
|
|
1766
|
+
}
|
|
1767
|
+
(0, _util.addClass)(this.root, 'xgplayer-inactive');
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
}, {
|
|
1771
|
+
key: 'onPlay',
|
|
1772
|
+
value: function onPlay() {
|
|
1773
|
+
(0, _util.addClass)(this.root, 'xgplayer-isloading');
|
|
1774
|
+
(0, _util.addClass)(this.root, 'xgplayer-playing');
|
|
1775
|
+
(0, _util.removeClass)(this.root, 'xgplayer-pause');
|
|
1776
|
+
}
|
|
1777
|
+
}, {
|
|
1778
|
+
key: 'onPause',
|
|
1779
|
+
value: function onPause() {
|
|
1780
|
+
(0, _util.addClass)(this.root, 'xgplayer-pause');
|
|
1781
|
+
if (this.userTimer) {
|
|
1782
|
+
clearTimeout(this.userTimer);
|
|
1783
|
+
}
|
|
1784
|
+
this.emit('focus');
|
|
1785
|
+
}
|
|
1786
|
+
}, {
|
|
1787
|
+
key: 'onEnded',
|
|
1788
|
+
value: function onEnded() {
|
|
1789
|
+
(0, _util.addClass)(this.root, 'xgplayer-ended');
|
|
1790
|
+
(0, _util.removeClass)(this.root, 'xgplayer-playing');
|
|
1791
|
+
}
|
|
1792
|
+
}, {
|
|
1793
|
+
key: 'onSeeking',
|
|
1794
|
+
value: function onSeeking() {
|
|
1795
|
+
this.isSeeking = true;
|
|
1796
|
+
// 兼容IE下无法触发waiting事件的问题 seeking的时候直接出发waiting
|
|
1797
|
+
this.onWaiting();
|
|
1798
|
+
// addClass(this.root, 'seeking');
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
// onTimeupdate () {
|
|
1802
|
+
// // for ie,playing fired before waiting
|
|
1803
|
+
// if (this.waitTimer) {
|
|
1804
|
+
// clearTimeout(this.waitTimer)
|
|
1805
|
+
// }
|
|
1806
|
+
// removeClass(this.root, 'xgplayer-isloading')
|
|
1807
|
+
|
|
1808
|
+
// }
|
|
1809
|
+
|
|
1810
|
+
}, {
|
|
1811
|
+
key: 'onSeeked',
|
|
1812
|
+
value: function onSeeked() {
|
|
1813
|
+
var _this7 = this;
|
|
1814
|
+
|
|
1815
|
+
// for ie,playing fired before waiting
|
|
1816
|
+
this.once('timeupdate', function () {
|
|
1817
|
+
_this7.isSeeking = false;
|
|
1818
|
+
});
|
|
1819
|
+
if (this.waitTimer) {
|
|
1820
|
+
clearTimeout(this.waitTimer);
|
|
1821
|
+
}
|
|
1822
|
+
(0, _util.removeClass)(this.root, 'xgplayer-isloading');
|
|
1823
|
+
}
|
|
1824
|
+
}, {
|
|
1825
|
+
key: 'onWaiting',
|
|
1826
|
+
value: function onWaiting() {
|
|
1827
|
+
var self = this;
|
|
1828
|
+
if (self.waitTimer) {
|
|
1829
|
+
clearTimeout(self.waitTimer);
|
|
1830
|
+
}
|
|
1831
|
+
if (self.checkTimer) {
|
|
1832
|
+
clearInterval(self.checkTimer);
|
|
1833
|
+
self.checkTimer = null;
|
|
1834
|
+
}
|
|
1835
|
+
var time = self.currentTime;
|
|
1836
|
+
self.waitTimer = setTimeout(function () {
|
|
1837
|
+
(0, _util.addClass)(self.root, 'xgplayer-isloading');
|
|
1838
|
+
self.checkTimer = setInterval(function () {
|
|
1839
|
+
if (self.currentTime !== time) {
|
|
1840
|
+
(0, _util.removeClass)(self.root, 'xgplayer-isloading');
|
|
1841
|
+
clearInterval(self.checkTimer);
|
|
1842
|
+
self.checkTimer = null;
|
|
1843
|
+
}
|
|
1844
|
+
}, 1000);
|
|
1845
|
+
}, 500);
|
|
1846
|
+
}
|
|
1847
|
+
}, {
|
|
1848
|
+
key: 'onPlaying',
|
|
1849
|
+
value: function onPlaying() {
|
|
1850
|
+
// 兼容safari下无法自动播放会触发该事件的场景
|
|
1851
|
+
if (this.paused) {
|
|
1852
|
+
return;
|
|
1853
|
+
}
|
|
1854
|
+
this.isSeeking = false;
|
|
1855
|
+
if (this.waitTimer) {
|
|
1856
|
+
clearTimeout(this.waitTimer);
|
|
1857
|
+
}
|
|
1858
|
+
(0, _util.removeClass)(this.root, 'xgplayer-isloading xgplayer-nostart xgplayer-pause xgplayer-ended xgplayer-is-error xgplayer-replay');
|
|
1859
|
+
(0, _util.addClass)(this.root, 'xgplayer-playing');
|
|
1860
|
+
}
|
|
1861
|
+
}], [{
|
|
1862
|
+
key: 'install',
|
|
1863
|
+
value: function install(name, descriptor) {
|
|
1864
|
+
if (!(0, _util.checkIsBrowser)()) {
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
if (!Player.plugins) {
|
|
1868
|
+
Player.plugins = {};
|
|
1869
|
+
}
|
|
1870
|
+
if (!Player.plugins[name]) {
|
|
1871
|
+
Player.plugins[name] = descriptor;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}, {
|
|
1875
|
+
key: 'installAll',
|
|
1876
|
+
value: function installAll(list) {
|
|
1877
|
+
for (var k = 0; k < list.length; k++) {
|
|
1878
|
+
Player.install(list[k].name, list[k].method);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
}, {
|
|
1882
|
+
key: 'use',
|
|
1883
|
+
value: function use(name, descriptor) {
|
|
1884
|
+
if (!Player.plugins) {
|
|
1885
|
+
Player.plugins = {};
|
|
1886
|
+
}
|
|
1887
|
+
Player.plugins[name] = descriptor;
|
|
1888
|
+
}
|
|
1889
|
+
}, {
|
|
1890
|
+
key: 'useAll',
|
|
1891
|
+
value: function useAll(list) {
|
|
1892
|
+
for (var k in list) {
|
|
1893
|
+
Player.use(list[k].name, list[k].method);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}, {
|
|
1897
|
+
key: 'controlsRun',
|
|
1898
|
+
value: function controlsRun(controlLst, context) {
|
|
1899
|
+
controlLst.forEach(function (control) {
|
|
1900
|
+
control.method.call(context);
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
}]);
|
|
1904
|
+
|
|
1905
|
+
return Player;
|
|
1906
|
+
}(_proxy2.default);
|
|
1907
|
+
|
|
1908
|
+
Player.util = _util.util;
|
|
1909
|
+
Player.sniffer = _sniffer2.default;
|
|
1910
|
+
Player.Errors = _error2.default;
|
|
1911
|
+
Player.XgplayerTimeRange = _xgplayerTimeRange2.default;
|
|
1912
|
+
|
|
1913
|
+
exports.default = Player;
|
|
1914
|
+
module.exports = exports['default'];
|
|
1915
|
+
|
|
1916
|
+
/***/ }),
|
|
1917
|
+
/* 10 */
|
|
1918
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1919
|
+
|
|
1920
|
+
"use strict";
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1924
|
+
value: true
|
|
1925
|
+
});
|
|
1926
|
+
|
|
1927
|
+
var _util = __webpack_require__(0);
|
|
1928
|
+
|
|
1929
|
+
var s_i18n = function s_i18n() {
|
|
1930
|
+
var player = this;var lang = {};
|
|
1931
|
+
lang.en = {
|
|
1932
|
+
HAVE_NOTHING: 'There is no information on whether audio/video is ready',
|
|
1933
|
+
HAVE_METADATA: 'Audio/video metadata is ready ',
|
|
1934
|
+
HAVE_CURRENT_DATA: 'Data about the current play location is available, but there is not enough data to play the next frame/millisecond',
|
|
1935
|
+
HAVE_FUTURE_DATA: 'Current and at least one frame of data is available',
|
|
1936
|
+
HAVE_ENOUGH_DATA: 'The available data is sufficient to start playing',
|
|
1937
|
+
NETWORK_EMPTY: 'Audio/video has not been initialized',
|
|
1938
|
+
NETWORK_IDLE: 'Audio/video is active and has been selected for resources, but no network is used',
|
|
1939
|
+
NETWORK_LOADING: 'The browser is downloading the data',
|
|
1940
|
+
NETWORK_NO_SOURCE: 'No audio/video source was found',
|
|
1941
|
+
MEDIA_ERR_ABORTED: 'The fetch process is aborted by the user',
|
|
1942
|
+
MEDIA_ERR_NETWORK: 'An error occurred while downloading',
|
|
1943
|
+
MEDIA_ERR_DECODE: 'An error occurred while decoding',
|
|
1944
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: 'Audio/video is not supported',
|
|
1945
|
+
REPLAY: 'Replay',
|
|
1946
|
+
ERROR: 'Network is offline',
|
|
1947
|
+
PLAY_TIPS: 'Play',
|
|
1948
|
+
PAUSE_TIPS: 'Pause',
|
|
1949
|
+
PLAYNEXT_TIPS: 'Play next',
|
|
1950
|
+
DOWNLOAD_TIPS: 'Download',
|
|
1951
|
+
ROTATE_TIPS: 'Rotate',
|
|
1952
|
+
RELOAD_TIPS: 'Reload',
|
|
1953
|
+
FULLSCREEN_TIPS: "Fullscreen",
|
|
1954
|
+
EXITFULLSCREEN_TIPS: 'Exit fullscreen',
|
|
1955
|
+
CSSFULLSCREEN_TIPS: 'Cssfullscreen',
|
|
1956
|
+
EXITCSSFULLSCREEN_TIPS: 'Exit cssfullscreen',
|
|
1957
|
+
TEXTTRACK: 'Caption',
|
|
1958
|
+
PIP: 'Pip',
|
|
1959
|
+
MINIPLAYER: 'Miniplayer',
|
|
1960
|
+
SCREENSHOT: 'Screenshot',
|
|
1961
|
+
LIVE: 'LIVE',
|
|
1962
|
+
OFF: 'Off',
|
|
1963
|
+
MINIPLAYER_DRAG: 'Click and hold to drag',
|
|
1964
|
+
AIRPLAY_TIPS: 'Airplay'
|
|
1965
|
+
};
|
|
1966
|
+
lang['zh-cn'] = {
|
|
1967
|
+
HAVE_NOTHING: '没有关于音频/视频是否就绪的信息',
|
|
1968
|
+
HAVE_METADATA: '音频/视频的元数据已就绪',
|
|
1969
|
+
HAVE_CURRENT_DATA: '关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒',
|
|
1970
|
+
HAVE_FUTURE_DATA: '当前及至少下一帧的数据是可用的',
|
|
1971
|
+
HAVE_ENOUGH_DATA: '可用数据足以开始播放',
|
|
1972
|
+
NETWORK_EMPTY: '音频/视频尚未初始化',
|
|
1973
|
+
NETWORK_IDLE: '音频/视频是活动的且已选取资源,但并未使用网络',
|
|
1974
|
+
NETWORK_LOADING: '浏览器正在下载数据',
|
|
1975
|
+
NETWORK_NO_SOURCE: '未找到音频/视频来源',
|
|
1976
|
+
MEDIA_ERR_ABORTED: '取回过程被用户中止',
|
|
1977
|
+
MEDIA_ERR_NETWORK: '当下载时发生错误',
|
|
1978
|
+
MEDIA_ERR_DECODE: '当解码时发生错误',
|
|
1979
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: '不支持的音频/视频格式',
|
|
1980
|
+
REPLAY: '重播',
|
|
1981
|
+
ERROR: '网络连接似乎出现了问题',
|
|
1982
|
+
PLAY_TIPS: '播放',
|
|
1983
|
+
PAUSE_TIPS: '暂停',
|
|
1984
|
+
PLAYNEXT_TIPS: '下一集',
|
|
1985
|
+
DOWNLOAD_TIPS: '下载',
|
|
1986
|
+
ROTATE_TIPS: '旋转',
|
|
1987
|
+
RELOAD_TIPS: '重新载入',
|
|
1988
|
+
FULLSCREEN_TIPS: "进入全屏",
|
|
1989
|
+
EXITFULLSCREEN_TIPS: '退出全屏',
|
|
1990
|
+
CSSFULLSCREEN_TIPS: '进入样式全屏',
|
|
1991
|
+
EXITCSSFULLSCREEN_TIPS: '退出样式全屏',
|
|
1992
|
+
TEXTTRACK: '字幕',
|
|
1993
|
+
PIP: '画中画',
|
|
1994
|
+
MINIPLAYER: '迷你播放器',
|
|
1995
|
+
SCREENSHOT: '截图',
|
|
1996
|
+
LIVE: '正在直播',
|
|
1997
|
+
OFF: '关闭',
|
|
1998
|
+
MINIPLAYER_DRAG: '点击按住可拖动视频',
|
|
1999
|
+
AIRPLAY_TIPS: '隔空播放'
|
|
2000
|
+
};
|
|
2001
|
+
lang['zh-hk'] = {
|
|
2002
|
+
HAVE_NOTHING: '沒有關於音頻/視頻是否就緒的信息',
|
|
2003
|
+
HAVE_METADATA: '音頻/視頻的元數據已就緒',
|
|
2004
|
+
HAVE_CURRENT_DATA: '關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒',
|
|
2005
|
+
HAVE_FUTURE_DATA: '當前及至少下壹幀的數據是可用的',
|
|
2006
|
+
HAVE_ENOUGH_DATA: '可用數據足以開始播放',
|
|
2007
|
+
NETWORK_EMPTY: '音頻/視頻尚未初始化',
|
|
2008
|
+
NETWORK_IDLE: '音頻/視頻是活動的且已選取資源,但並未使用網絡',
|
|
2009
|
+
NETWORK_LOADING: '瀏覽器正在下載數據',
|
|
2010
|
+
NETWORK_NO_SOURCE: '未找到音頻/視頻來源',
|
|
2011
|
+
MEDIA_ERR_ABORTED: '取回過程被用戶中止',
|
|
2012
|
+
MEDIA_ERR_NETWORK: '當下載時發生錯誤',
|
|
2013
|
+
MEDIA_ERR_DECODE: '當解碼時發生錯誤',
|
|
2014
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: '不支持的音頻/視頻格式',
|
|
2015
|
+
REPLAY: '重播',
|
|
2016
|
+
ERROR: '網絡連接似乎出現了問題',
|
|
2017
|
+
PLAY_TIPS: '播放',
|
|
2018
|
+
PAUSE_TIPS: '暫停',
|
|
2019
|
+
PLAYNEXT_TIPS: '下壹集',
|
|
2020
|
+
DOWNLOAD_TIPS: '下載',
|
|
2021
|
+
ROTATE_TIPS: '旋轉',
|
|
2022
|
+
RELOAD_TIPS: '重新載入',
|
|
2023
|
+
FULLSCREEN_TIPS: "進入全屏",
|
|
2024
|
+
EXITFULLSCREEN_TIPS: '退出全屏',
|
|
2025
|
+
CSSFULLSCREEN_TIPS: '進入樣式全屏',
|
|
2026
|
+
EXITCSSFULLSCREEN_TIPS: '退出樣式全屏',
|
|
2027
|
+
TEXTTRACK: '字幕',
|
|
2028
|
+
PIP: '畫中畫',
|
|
2029
|
+
MINIPLAYER: '迷妳播放器',
|
|
2030
|
+
SCREENSHOT: '截圖',
|
|
2031
|
+
LIVE: '正在直播',
|
|
2032
|
+
OFF: '關閉',
|
|
2033
|
+
MINIPLAYER_DRAG: '點擊按住可拖動視頻',
|
|
2034
|
+
AIRPLAY_TIPS: '隔空播放'
|
|
2035
|
+
};
|
|
2036
|
+
lang['jp'] = {
|
|
2037
|
+
HAVE_NOTHING: 'オーディオ/ビデオが準備できているか情報がありません',
|
|
2038
|
+
HAVE_METADATA: 'オーディオ/ビデオのメタデータは準備できています',
|
|
2039
|
+
HAVE_CURRENT_DATA: '現在の再生位置に関するデータは利用可能ですが、次のフレーム/ミリ秒を再生するのに十分なデータがありません',
|
|
2040
|
+
HAVE_FUTURE_DATA: '現在、少なくとも次のフレームのデータが利用可能です',
|
|
2041
|
+
HAVE_ENOUGH_DATA: '利用可能なデータは再生を開始するのに十分です',
|
|
2042
|
+
NETWORK_EMPTY: 'オーディオ/ビデオが初期化されていません',
|
|
2043
|
+
NETWORK_IDLE: 'オーディオ/ビデオはアクティブでリソースが選択されていますが、ネットワークが使用されていません',
|
|
2044
|
+
NETWORK_LOADING: 'ブラウザーはデータをダウンロードしています',
|
|
2045
|
+
NETWORK_NO_SOURCE: 'オーディオ/ビデオ のソースが見つかりません',
|
|
2046
|
+
MEDIA_ERR_ABORTED: 'ユーザーによってフェッチプロセスが中止されました',
|
|
2047
|
+
MEDIA_ERR_NETWORK: 'ダウンロード中にエラーが発生しました',
|
|
2048
|
+
MEDIA_ERR_DECODE: 'デコード中にエラーが発生しました',
|
|
2049
|
+
MEDIA_ERR_SRC_NOT_SUPPORTED: 'オーディオ/ビデオ の形式がサポートされていません',
|
|
2050
|
+
REPLAY: 'リプレイ',
|
|
2051
|
+
ERROR: 'ネットワークの接続に問題が発生しました',
|
|
2052
|
+
PLAY_TIPS: 'プレイ',
|
|
2053
|
+
PAUSE_TIPS: '一時停止',
|
|
2054
|
+
PLAYNEXT_TIPS: '次をプレイ',
|
|
2055
|
+
DOWNLOAD_TIPS: 'ダウンロード',
|
|
2056
|
+
ROTATE_TIPS: '回転',
|
|
2057
|
+
RELOAD_TIPS: '再読み込み',
|
|
2058
|
+
FULLSCREEN_TIPS: "フルスクリーン",
|
|
2059
|
+
EXITFULLSCREEN_TIPS: 'フルスクリーンを終了',
|
|
2060
|
+
CSSFULLSCREEN_TIPS: 'シアターモード',
|
|
2061
|
+
EXITCSSFULLSCREEN_TIPS: 'シアターモードを終了',
|
|
2062
|
+
TEXTTRACK: '字幕',
|
|
2063
|
+
PIP: 'ミニプレーヤー',
|
|
2064
|
+
MINIPLAYER: 'ミニプレーヤー',
|
|
2065
|
+
SCREENSHOT: 'スクリーンショット',
|
|
2066
|
+
LIVE: '生放送',
|
|
2067
|
+
OFF: 'オフ',
|
|
2068
|
+
MINIPLAYER_DRAG: 'ボタンを押して働画をドラッグする',
|
|
2069
|
+
AIRPLAY_TIPS: '隔空放送'
|
|
2070
|
+
};
|
|
2071
|
+
|
|
2072
|
+
Object.defineProperty(player, 'lang', {
|
|
2073
|
+
get: function get() {
|
|
2074
|
+
if (player.config) {
|
|
2075
|
+
return lang[player.config.lang] || lang['en'];
|
|
2076
|
+
} else {
|
|
2077
|
+
return lang['en'];
|
|
2078
|
+
}
|
|
2079
|
+
},
|
|
2080
|
+
set: function set(value) {
|
|
2081
|
+
if ((0, _util.typeOf)(value) === 'Object') {
|
|
2082
|
+
Object.keys(value).forEach(function (key) {
|
|
2083
|
+
lang[key] = value[key];
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
});
|
|
2088
|
+
};
|
|
2089
|
+
|
|
2090
|
+
exports.default = {
|
|
2091
|
+
name: 's_i18n',
|
|
2092
|
+
method: s_i18n
|
|
2093
|
+
};
|
|
2094
|
+
module.exports = exports['default'];
|
|
2095
|
+
|
|
2096
|
+
/***/ }),
|
|
2097
|
+
/* 11 */
|
|
2098
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2099
|
+
|
|
2100
|
+
"use strict";
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2104
|
+
value: true
|
|
2105
|
+
});
|
|
2106
|
+
|
|
2107
|
+
var _createClass = function () {
|
|
2108
|
+
function defineProperties(target, props) {
|
|
2109
|
+
for (var i = 0; i < props.length; i++) {
|
|
2110
|
+
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
|
|
2111
|
+
}
|
|
2112
|
+
}return function (Constructor, protoProps, staticProps) {
|
|
2113
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
|
|
2114
|
+
};
|
|
2115
|
+
}();
|
|
2116
|
+
|
|
2117
|
+
var _eventEmitter = __webpack_require__(12);
|
|
2118
|
+
|
|
2119
|
+
var _eventEmitter2 = _interopRequireDefault(_eventEmitter);
|
|
2120
|
+
|
|
2121
|
+
var _util = __webpack_require__(0);
|
|
2122
|
+
|
|
2123
|
+
var _error = __webpack_require__(4);
|
|
2124
|
+
|
|
2125
|
+
var _error2 = _interopRequireDefault(_error);
|
|
2126
|
+
|
|
2127
|
+
function _interopRequireDefault(obj) {
|
|
2128
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
function _defineProperty(obj, key, value) {
|
|
2132
|
+
if (key in obj) {
|
|
2133
|
+
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
|
|
2134
|
+
} else {
|
|
2135
|
+
obj[key] = value;
|
|
2136
|
+
}return obj;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
function _classCallCheck(instance, Constructor) {
|
|
2140
|
+
if (!(instance instanceof Constructor)) {
|
|
2141
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
var Proxy = function () {
|
|
2146
|
+
function Proxy(options) {
|
|
2147
|
+
var _this = this;
|
|
2148
|
+
|
|
2149
|
+
_classCallCheck(this, Proxy);
|
|
2150
|
+
|
|
2151
|
+
this._hasStart = false;
|
|
2152
|
+
this.videoConfig = {
|
|
2153
|
+
controls: !!options.isShowControl,
|
|
2154
|
+
autoplay: options.autoplay,
|
|
2155
|
+
playsinline: options.playsinline,
|
|
2156
|
+
'webkit-playsinline': options.playsinline,
|
|
2157
|
+
'x5-playsinline': options.playsinline,
|
|
2158
|
+
'x5-video-player-type': options['x5-video-player-type'] || options['x5VideoPlayerType'],
|
|
2159
|
+
'x5-video-player-fullscreen': options['x5-video-player-fullscreen'] || options['x5VideoPlayerFullscreen'],
|
|
2160
|
+
'x5-video-orientation': options['x5-video-orientation'] || options['x5VideoOrientation'],
|
|
2161
|
+
airplay: options['airplay'],
|
|
2162
|
+
'webkit-airplay': options['airplay'],
|
|
2163
|
+
tabindex: 2,
|
|
2164
|
+
mediaType: options.mediaType || 'video'
|
|
2165
|
+
};
|
|
2166
|
+
if (options.muted) {
|
|
2167
|
+
this.videoConfig.muted = 'muted';
|
|
2168
|
+
}
|
|
2169
|
+
if (options.loop) {
|
|
2170
|
+
this.videoConfig.loop = 'loop';
|
|
2171
|
+
}
|
|
2172
|
+
var textTrackDom = '';
|
|
2173
|
+
this.textTrackShowDefault = true;
|
|
2174
|
+
if (options.nativeTextTrack && Array.isArray(options.nativeTextTrack)) {
|
|
2175
|
+
if (options.nativeTextTrack.length > 0 && !options.nativeTextTrack.some(function (track) {
|
|
2176
|
+
return track.default;
|
|
2177
|
+
})) {
|
|
2178
|
+
options.nativeTextTrack[0].default = true;
|
|
2179
|
+
this.textTrackShowDefault = false;
|
|
2180
|
+
}
|
|
2181
|
+
options.nativeTextTrack.some(function (track) {
|
|
2182
|
+
if (track.src && track.label && track.default) {
|
|
2183
|
+
textTrackDom += '<track src="' + track.src + '" ';
|
|
2184
|
+
if (track.kind) {
|
|
2185
|
+
textTrackDom += 'kind="' + track.kind + '" ';
|
|
2186
|
+
}
|
|
2187
|
+
textTrackDom += 'label="' + track.label + '" ';
|
|
2188
|
+
if (track.srclang) {
|
|
2189
|
+
textTrackDom += 'srclang="' + track.srclang + '" ';
|
|
2190
|
+
}
|
|
2191
|
+
textTrackDom += (track.default ? 'default' : '') + '>';
|
|
2192
|
+
return true;
|
|
2193
|
+
}
|
|
2194
|
+
});
|
|
2195
|
+
this.videoConfig.crossorigin = 'anonymous';
|
|
2196
|
+
}
|
|
2197
|
+
if (options.textTrackStyle) {
|
|
2198
|
+
var style = document.createElement('style');
|
|
2199
|
+
this.textTrackStyle = style;
|
|
2200
|
+
document.head.appendChild(style);
|
|
2201
|
+
var styleStr = '';
|
|
2202
|
+
for (var index in options.textTrackStyle) {
|
|
2203
|
+
styleStr += index + ': ' + options.textTrackStyle[index] + ';';
|
|
2204
|
+
}
|
|
2205
|
+
var wrap = options.id ? '#' + options.id : options.el.id ? '#' + options.el.id : '.' + options.el.className;
|
|
2206
|
+
if (style.sheet.insertRule) {
|
|
2207
|
+
style.sheet.insertRule(wrap + ' video::cue { ' + styleStr + ' }', 0);
|
|
2208
|
+
} else if (style.sheet.addRule) {
|
|
2209
|
+
style.sheet.addRule(wrap + ' video::cue', styleStr);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
var el = options.el ? options.el : (0, _util.findDom)(document, '#' + options.id);
|
|
2213
|
+
var XgVideoProxy = this.constructor.XgVideoProxy;
|
|
2214
|
+
if (XgVideoProxy && this.videoConfig.mediaType === XgVideoProxy.mediaType) {
|
|
2215
|
+
this.video = new XgVideoProxy(el, options);
|
|
2216
|
+
} else {
|
|
2217
|
+
this.video = (0, _util.createDom)(this.videoConfig.mediaType, textTrackDom, this.videoConfig, '');
|
|
2218
|
+
}
|
|
2219
|
+
if (options.videoStyle) {
|
|
2220
|
+
Object.keys(options.videoStyle).forEach(function (key) {
|
|
2221
|
+
(0, _util.setStyle)(_this.video, key, options.videoStyle[key]);
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
if (!this.textTrackShowDefault && textTrackDom) {
|
|
2225
|
+
var trackDoms = this.video.getElementsByTagName('Track');
|
|
2226
|
+
trackDoms[0].track.mode = 'hidden';
|
|
2227
|
+
}
|
|
2228
|
+
if (options.autoplay) {
|
|
2229
|
+
this.video.autoplay = true;
|
|
2230
|
+
if (options.autoplayMuted) {
|
|
2231
|
+
this.video.muted = true;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
this.ev = ['play', 'playing', 'pause', 'ended', 'error', 'seeking', 'seeked', 'progress', 'timeupdate', 'waiting', 'canplay', 'canplaythrough', 'durationchange', 'volumechange', 'ratechange', 'loadedmetadata', 'loadeddata', 'loadstart'].map(function (item) {
|
|
2236
|
+
return _defineProperty({}, item, 'on' + item.charAt(0).toUpperCase() + item.slice(1));
|
|
2237
|
+
});
|
|
2238
|
+
(0, _eventEmitter2.default)(this);
|
|
2239
|
+
|
|
2240
|
+
this._interval = {};
|
|
2241
|
+
var lastBuffer = '0,0';
|
|
2242
|
+
var self = this;
|
|
2243
|
+
|
|
2244
|
+
var defaultVideoEventHandler = function defaultVideoEventHandler(name) {
|
|
2245
|
+
// fix when video destroy called and video reload
|
|
2246
|
+
if (!_this) {
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
if (name === 'play') {
|
|
2250
|
+
_this.hasStart = true;
|
|
2251
|
+
} else if (name === 'canplay') {
|
|
2252
|
+
(0, _util.removeClass)(_this.root, 'xgplayer-is-enter');
|
|
2253
|
+
} else if (name === 'waiting') {
|
|
2254
|
+
_this.inWaitingStart = new Date().getTime();
|
|
2255
|
+
} else if (name === 'playing') {
|
|
2256
|
+
(0, _util.removeClass)(_this.root, 'xgplayer-is-enter');
|
|
2257
|
+
if (_this.inWaitingStart) {
|
|
2258
|
+
_this.inWaitingStart = undefined;
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
if (name === 'error') {
|
|
2262
|
+
// process the error
|
|
2263
|
+
_this._onError(name);
|
|
2264
|
+
} else {
|
|
2265
|
+
_this.emit(name, _this);
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
if (_this.hasOwnProperty('_interval')) {
|
|
2269
|
+
if (['ended', 'error', 'timeupdate'].indexOf(name) < 0) {
|
|
2270
|
+
(0, _util._clearInterval)(_this, 'bufferedChange');
|
|
2271
|
+
(0, _util._setInterval)(_this, 'bufferedChange', function () {
|
|
2272
|
+
if (this.video && this.video.buffered) {
|
|
2273
|
+
var curBuffer = [];
|
|
2274
|
+
for (var i = 0, len = this.video.buffered.length; i < len; i++) {
|
|
2275
|
+
curBuffer.push([this.video.buffered.start(i), this.video.buffered.end(i)]);
|
|
2276
|
+
}
|
|
2277
|
+
if (curBuffer.toString() !== lastBuffer) {
|
|
2278
|
+
lastBuffer = curBuffer.toString();
|
|
2279
|
+
this.emit('bufferedChange', curBuffer);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
}, 200);
|
|
2283
|
+
} else {
|
|
2284
|
+
if (name !== 'timeupdate') {
|
|
2285
|
+
(0, _util._clearInterval)(_this, 'bufferedChange');
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2291
|
+
var videoEventHandler = function videoEventHandler(name) {
|
|
2292
|
+
if (options.videoEventMiddleware && typeof options.videoEventMiddleware[name] === 'function') {
|
|
2293
|
+
options.videoEventMiddleware[name].call(_this, _this, name, defaultVideoEventHandler);
|
|
2294
|
+
} else {
|
|
2295
|
+
defaultVideoEventHandler.call(_this, name);
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
|
|
2299
|
+
this.ev.forEach(function (item) {
|
|
2300
|
+
self.evItem = Object.keys(item)[0];
|
|
2301
|
+
var name = Object.keys(item)[0];
|
|
2302
|
+
self.video.addEventListener(Object.keys(item)[0], videoEventHandler.bind(self, name));
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* 错误监听处理逻辑抽离
|
|
2307
|
+
*/
|
|
2308
|
+
|
|
2309
|
+
_createClass(Proxy, [{
|
|
2310
|
+
key: '_onError',
|
|
2311
|
+
value: function _onError(name) {
|
|
2312
|
+
if (this.video && this.video.error) {
|
|
2313
|
+
this.emit(name, new _error2.default('other', this.currentTime, this.duration, this.networkState, this.readyState, this.currentSrc, this.src, this.ended, {
|
|
2314
|
+
line: 162,
|
|
2315
|
+
msg: this.error,
|
|
2316
|
+
handle: 'Constructor'
|
|
2317
|
+
}, this.video.error.code, this.video.error));
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}, {
|
|
2321
|
+
key: 'destroy',
|
|
2322
|
+
value: function destroy() {
|
|
2323
|
+
if (this.textTrackStyle) {
|
|
2324
|
+
this.textTrackStyle.parentNode.removeChild(this.textTrackStyle);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
}, {
|
|
2328
|
+
key: 'play',
|
|
2329
|
+
value: function play() {
|
|
2330
|
+
return this.video.play();
|
|
2331
|
+
}
|
|
2332
|
+
}, {
|
|
2333
|
+
key: 'pause',
|
|
2334
|
+
value: function pause() {
|
|
2335
|
+
this.video.pause();
|
|
2336
|
+
}
|
|
2337
|
+
}, {
|
|
2338
|
+
key: 'canPlayType',
|
|
2339
|
+
value: function canPlayType(type) {
|
|
2340
|
+
return this.video.canPlayType(type);
|
|
2341
|
+
}
|
|
2342
|
+
}, {
|
|
2343
|
+
key: 'getBufferedRange',
|
|
2344
|
+
value: function getBufferedRange(buffered) {
|
|
2345
|
+
var range = [0, 0];
|
|
2346
|
+
var video = this.video;
|
|
2347
|
+
if (!buffered) buffered = video.buffered;
|
|
2348
|
+
var currentTime = video.currentTime;
|
|
2349
|
+
if (buffered) {
|
|
2350
|
+
for (var i = 0, len = buffered.length; i < len; i++) {
|
|
2351
|
+
range[0] = buffered.start(i);
|
|
2352
|
+
range[1] = buffered.end(i);
|
|
2353
|
+
if (range[0] <= currentTime && currentTime <= range[1]) {
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
if (range[0] - currentTime <= 0 && currentTime - range[1] <= 0) {
|
|
2359
|
+
return range;
|
|
2360
|
+
} else {
|
|
2361
|
+
return [0, 0];
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}, {
|
|
2365
|
+
key: 'proxyOn',
|
|
2366
|
+
value: function proxyOn(event, fn) {
|
|
2367
|
+
(0, _util.on)(this, event, fn, 'destroy');
|
|
2368
|
+
}
|
|
2369
|
+
}, {
|
|
2370
|
+
key: 'proxyOnce',
|
|
2371
|
+
value: function proxyOnce(event, fn) {
|
|
2372
|
+
(0, _util.once)(this, event, fn, 'destroy');
|
|
2373
|
+
}
|
|
2374
|
+
}, {
|
|
2375
|
+
key: 'hasStart',
|
|
2376
|
+
get: function get() {
|
|
2377
|
+
return this._hasStart;
|
|
2378
|
+
},
|
|
2379
|
+
set: function set(bool) {
|
|
2380
|
+
if (typeof bool === 'boolean' && bool === true && !this._hasStart) {
|
|
2381
|
+
this._hasStart = true;
|
|
2382
|
+
this.emit('hasstart');
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}, {
|
|
2386
|
+
key: 'autoplay',
|
|
2387
|
+
set: function set(isTrue) {
|
|
2388
|
+
if (this.video) {
|
|
2389
|
+
this.video.autoplay = isTrue;
|
|
2390
|
+
}
|
|
2391
|
+
},
|
|
2392
|
+
get: function get() {
|
|
2393
|
+
if (this.video) {
|
|
2394
|
+
return this.video.autoplay;
|
|
2395
|
+
} else {
|
|
2396
|
+
return false;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
}, {
|
|
2400
|
+
key: 'buffered',
|
|
2401
|
+
get: function get() {
|
|
2402
|
+
if (this.video) {
|
|
2403
|
+
return this.video.buffered;
|
|
2404
|
+
} else {
|
|
2405
|
+
return undefined;
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
}, {
|
|
2409
|
+
key: 'buffered2',
|
|
2410
|
+
get: function get() {
|
|
2411
|
+
return (0, _util.getBuffered2)(this.video.buffered);
|
|
2412
|
+
}
|
|
2413
|
+
}, {
|
|
2414
|
+
key: 'crossOrigin',
|
|
2415
|
+
get: function get() {
|
|
2416
|
+
if (this.video) {
|
|
2417
|
+
return this.video.crossOrigin;
|
|
2418
|
+
} else {
|
|
2419
|
+
return false;
|
|
2420
|
+
}
|
|
2421
|
+
},
|
|
2422
|
+
set: function set(isTrue) {
|
|
2423
|
+
if (this.video) {
|
|
2424
|
+
this.video.crossOrigin = isTrue;
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
}, {
|
|
2428
|
+
key: 'currentSrc',
|
|
2429
|
+
get: function get() {
|
|
2430
|
+
if (this.video) {
|
|
2431
|
+
return this.video.currentSrc;
|
|
2432
|
+
} else {
|
|
2433
|
+
return undefined;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}, {
|
|
2437
|
+
key: 'currentTime',
|
|
2438
|
+
get: function get() {
|
|
2439
|
+
if (this.video) {
|
|
2440
|
+
return this.video.currentTime || 0;
|
|
2441
|
+
} else {
|
|
2442
|
+
return 0;
|
|
2443
|
+
}
|
|
2444
|
+
},
|
|
2445
|
+
set: function set(time) {
|
|
2446
|
+
var _this2 = this;
|
|
2447
|
+
|
|
2448
|
+
if (typeof isFinite === 'function' && !isFinite(time)) return;
|
|
2449
|
+
if ((0, _util.hasClass)(this.root, 'xgplayer-ended')) {
|
|
2450
|
+
this.once('playing', function () {
|
|
2451
|
+
_this2.video.currentTime = time;
|
|
2452
|
+
});
|
|
2453
|
+
this.replay();
|
|
2454
|
+
} else {
|
|
2455
|
+
this.video.currentTime = time;
|
|
2456
|
+
}
|
|
2457
|
+
this.emit('currentTimeChange', time);
|
|
2458
|
+
}
|
|
2459
|
+
}, {
|
|
2460
|
+
key: 'defaultMuted',
|
|
2461
|
+
get: function get() {
|
|
2462
|
+
if (this.video) {
|
|
2463
|
+
return this.video.defaultMuted;
|
|
2464
|
+
} else {
|
|
2465
|
+
return false;
|
|
2466
|
+
}
|
|
2467
|
+
},
|
|
2468
|
+
set: function set(isTrue) {
|
|
2469
|
+
if (this.video) {
|
|
2470
|
+
this.video.defaultMuted = isTrue;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
}, {
|
|
2474
|
+
key: 'duration',
|
|
2475
|
+
get: function get() {
|
|
2476
|
+
if (this.config.duration) {
|
|
2477
|
+
if (this.video) return Math.min(this.config.duration, this.video.duration);else return this.config.duration;
|
|
2478
|
+
}
|
|
2479
|
+
if (!this.video) return null;
|
|
2480
|
+
return this.video.duration;
|
|
2481
|
+
}
|
|
2482
|
+
}, {
|
|
2483
|
+
key: 'ended',
|
|
2484
|
+
get: function get() {
|
|
2485
|
+
if (this.video) {
|
|
2486
|
+
return this.video.ended || false;
|
|
2487
|
+
} else {
|
|
2488
|
+
return true;
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}, {
|
|
2492
|
+
key: 'error',
|
|
2493
|
+
get: function get() {
|
|
2494
|
+
var err = this.video.error;
|
|
2495
|
+
if (!err) {
|
|
2496
|
+
return null;
|
|
2497
|
+
}
|
|
2498
|
+
var status = [{
|
|
2499
|
+
en: 'MEDIA_ERR_ABORTED',
|
|
2500
|
+
cn: '取回过程被用户中止'
|
|
2501
|
+
}, {
|
|
2502
|
+
en: 'MEDIA_ERR_NETWORK',
|
|
2503
|
+
cn: '当下载时发生错误'
|
|
2504
|
+
}, {
|
|
2505
|
+
en: 'MEDIA_ERR_DECODE',
|
|
2506
|
+
cn: '当解码时发生错误'
|
|
2507
|
+
}, {
|
|
2508
|
+
en: 'MEDIA_ERR_SRC_NOT_SUPPORTED',
|
|
2509
|
+
cn: '不支持音频/视频'
|
|
2510
|
+
}];
|
|
2511
|
+
return this.lang ? this.lang[status[err.code - 1].en] : status[err.code - 1].en;
|
|
2512
|
+
}
|
|
2513
|
+
}, {
|
|
2514
|
+
key: 'loop',
|
|
2515
|
+
get: function get() {
|
|
2516
|
+
if (this.video) {
|
|
2517
|
+
return this.video.loop;
|
|
2518
|
+
} else {
|
|
2519
|
+
return false;
|
|
2520
|
+
}
|
|
2521
|
+
},
|
|
2522
|
+
set: function set(isTrue) {
|
|
2523
|
+
if (this.video) {
|
|
2524
|
+
this.video.loop = isTrue;
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}, {
|
|
2528
|
+
key: 'muted',
|
|
2529
|
+
get: function get() {
|
|
2530
|
+
if (this.video) {
|
|
2531
|
+
return this.video.muted;
|
|
2532
|
+
} else {
|
|
2533
|
+
return false;
|
|
2534
|
+
}
|
|
2535
|
+
},
|
|
2536
|
+
set: function set(isTrue) {
|
|
2537
|
+
if (this.video) {
|
|
2538
|
+
this.video.muted = isTrue;
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
}, {
|
|
2542
|
+
key: 'networkState',
|
|
2543
|
+
get: function get() {
|
|
2544
|
+
var status = [{
|
|
2545
|
+
en: 'NETWORK_EMPTY',
|
|
2546
|
+
cn: '音频/视频尚未初始化'
|
|
2547
|
+
}, {
|
|
2548
|
+
en: 'NETWORK_IDLE',
|
|
2549
|
+
cn: '音频/视频是活动的且已选取资源,但并未使用网络'
|
|
2550
|
+
}, {
|
|
2551
|
+
en: 'NETWORK_LOADING',
|
|
2552
|
+
cn: '浏览器正在下载数据'
|
|
2553
|
+
}, {
|
|
2554
|
+
en: 'NETWORK_NO_SOURCE',
|
|
2555
|
+
cn: '未找到音频/视频来源'
|
|
2556
|
+
}];
|
|
2557
|
+
return this.lang ? this.lang[status[this.video.networkState].en] : status[this.video.networkState].en;
|
|
2558
|
+
}
|
|
2559
|
+
}, {
|
|
2560
|
+
key: 'paused',
|
|
2561
|
+
get: function get() {
|
|
2562
|
+
// if(this.video) {
|
|
2563
|
+
// return this.video.paused
|
|
2564
|
+
// } else {
|
|
2565
|
+
// return false
|
|
2566
|
+
// }
|
|
2567
|
+
return (0, _util.hasClass)(this.root, 'xgplayer-pause');
|
|
2568
|
+
}
|
|
2569
|
+
}, {
|
|
2570
|
+
key: 'playbackRate',
|
|
2571
|
+
get: function get() {
|
|
2572
|
+
if (this.video) {
|
|
2573
|
+
return this.video.playbackRate;
|
|
2574
|
+
} else {
|
|
2575
|
+
return 1;
|
|
2576
|
+
}
|
|
2577
|
+
},
|
|
2578
|
+
set: function set(rate) {
|
|
2579
|
+
if (this.video) {
|
|
2580
|
+
this.video.playbackRate = rate;
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
}, {
|
|
2584
|
+
key: 'played',
|
|
2585
|
+
get: function get() {
|
|
2586
|
+
if (this.video) {
|
|
2587
|
+
return this.video.played;
|
|
2588
|
+
} else {
|
|
2589
|
+
return undefined;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
}, {
|
|
2593
|
+
key: 'preload',
|
|
2594
|
+
get: function get() {
|
|
2595
|
+
if (this.video) {
|
|
2596
|
+
return this.video.preload;
|
|
2597
|
+
} else {
|
|
2598
|
+
return false;
|
|
2599
|
+
}
|
|
2600
|
+
},
|
|
2601
|
+
set: function set(isTrue) {
|
|
2602
|
+
if (this.video) {
|
|
2603
|
+
this.video.preload = isTrue;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
}, {
|
|
2607
|
+
key: 'readyState',
|
|
2608
|
+
get: function get() {
|
|
2609
|
+
var status = [{
|
|
2610
|
+
en: 'HAVE_NOTHING',
|
|
2611
|
+
cn: '没有关于音频/视频是否就绪的信息'
|
|
2612
|
+
}, {
|
|
2613
|
+
en: 'HAVE_METADATA',
|
|
2614
|
+
cn: '关于音频/视频就绪的元数据'
|
|
2615
|
+
}, {
|
|
2616
|
+
en: 'HAVE_CURRENT_DATA',
|
|
2617
|
+
cn: '关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒'
|
|
2618
|
+
}, {
|
|
2619
|
+
en: 'HAVE_FUTURE_DATA',
|
|
2620
|
+
cn: '当前及至少下一帧的数据是可用的'
|
|
2621
|
+
}, {
|
|
2622
|
+
en: 'HAVE_ENOUGH_DATA',
|
|
2623
|
+
cn: '可用数据足以开始播放'
|
|
2624
|
+
}];
|
|
2625
|
+
return this.lang ? this.lang[status[this.video.readyState].en] : status[this.video.readyState];
|
|
2626
|
+
}
|
|
2627
|
+
}, {
|
|
2628
|
+
key: 'seekable',
|
|
2629
|
+
get: function get() {
|
|
2630
|
+
if (this.video) {
|
|
2631
|
+
return this.video.seekable;
|
|
2632
|
+
} else {
|
|
2633
|
+
return false;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}, {
|
|
2637
|
+
key: 'seeking',
|
|
2638
|
+
get: function get() {
|
|
2639
|
+
if (this.video) {
|
|
2640
|
+
return this.video.seeking;
|
|
2641
|
+
} else {
|
|
2642
|
+
return false;
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
}, {
|
|
2646
|
+
key: 'src',
|
|
2647
|
+
get: function get() {
|
|
2648
|
+
if (this.video) {
|
|
2649
|
+
return this.video.src;
|
|
2650
|
+
} else {
|
|
2651
|
+
return undefined;
|
|
2652
|
+
}
|
|
2653
|
+
},
|
|
2654
|
+
set: function set(url) {
|
|
2655
|
+
if (!(0, _util.hasClass)(this.root, 'xgplayer-ended')) {
|
|
2656
|
+
this.emit('urlchange', this.video.src);
|
|
2657
|
+
}
|
|
2658
|
+
(0, _util.removeClass)(this.root, 'xgplayer-ended xgplayer-is-replay xgplayer-is-error');
|
|
2659
|
+
this.video.pause();
|
|
2660
|
+
this.emit('pause');
|
|
2661
|
+
this.video.src = url;
|
|
2662
|
+
this.emit('srcChange');
|
|
2663
|
+
}
|
|
2664
|
+
}, {
|
|
2665
|
+
key: 'poster',
|
|
2666
|
+
set: function set(posterUrl) {
|
|
2667
|
+
var poster = (0, _util.findDom)(this.root, '.xgplayer-poster');
|
|
2668
|
+
if (poster) {
|
|
2669
|
+
poster.style.backgroundImage = 'url(' + posterUrl + ')';
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}, {
|
|
2673
|
+
key: 'volume',
|
|
2674
|
+
get: function get() {
|
|
2675
|
+
if (this.video) {
|
|
2676
|
+
return this.video.volume;
|
|
2677
|
+
} else {
|
|
2678
|
+
return 1;
|
|
2679
|
+
}
|
|
2680
|
+
},
|
|
2681
|
+
set: function set(vol) {
|
|
2682
|
+
if (this.video) {
|
|
2683
|
+
this.video.volume = vol;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
}, {
|
|
2687
|
+
key: 'fullscreen',
|
|
2688
|
+
get: function get() {
|
|
2689
|
+
return (0, _util.hasClass)(this.root, 'xgplayer-is-fullscreen') || (0, _util.hasClass)(this.root, 'xgplayer-fullscreen-active');
|
|
2690
|
+
}
|
|
2691
|
+
}, {
|
|
2692
|
+
key: 'bullet',
|
|
2693
|
+
get: function get() {
|
|
2694
|
+
return (0, _util.findDom)(this.root, 'xg-danmu') ? (0, _util.hasClass)((0, _util.findDom)(this.root, 'xg-danmu'), 'xgplayer-has-danmu') : false;
|
|
2695
|
+
}
|
|
2696
|
+
}, {
|
|
2697
|
+
key: 'textTrack',
|
|
2698
|
+
get: function get() {
|
|
2699
|
+
return (0, _util.hasClass)(this.root, 'xgplayer-is-textTrack');
|
|
2700
|
+
}
|
|
2701
|
+
}, {
|
|
2702
|
+
key: 'pip',
|
|
2703
|
+
get: function get() {
|
|
2704
|
+
return (0, _util.hasClass)(this.root, 'xgplayer-pip-active');
|
|
2705
|
+
}
|
|
2706
|
+
}]);
|
|
2707
|
+
|
|
2708
|
+
return Proxy;
|
|
2709
|
+
}();
|
|
2710
|
+
|
|
2711
|
+
exports.default = Proxy;
|
|
2712
|
+
module.exports = exports['default'];
|
|
2713
|
+
|
|
2714
|
+
/***/ }),
|
|
2715
|
+
/* 12 */
|
|
2716
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2717
|
+
|
|
2718
|
+
"use strict";
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
var d = __webpack_require__(13),
|
|
2722
|
+
callable = __webpack_require__(30),
|
|
2723
|
+
apply = Function.prototype.apply,
|
|
2724
|
+
call = Function.prototype.call,
|
|
2725
|
+
create = Object.create,
|
|
2726
|
+
defineProperty = Object.defineProperty,
|
|
2727
|
+
defineProperties = Object.defineProperties,
|
|
2728
|
+
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
2729
|
+
descriptor = { configurable: true, enumerable: false, writable: true },
|
|
2730
|
+
on,
|
|
2731
|
+
once,
|
|
2732
|
+
off,
|
|
2733
|
+
emit,
|
|
2734
|
+
methods,
|
|
2735
|
+
descriptors,
|
|
2736
|
+
base;
|
|
2737
|
+
|
|
2738
|
+
on = function (type, listener) {
|
|
2739
|
+
var data;
|
|
2740
|
+
|
|
2741
|
+
callable(listener);
|
|
2742
|
+
|
|
2743
|
+
if (!hasOwnProperty.call(this, '__ee__')) {
|
|
2744
|
+
data = descriptor.value = create(null);
|
|
2745
|
+
defineProperty(this, '__ee__', descriptor);
|
|
2746
|
+
descriptor.value = null;
|
|
2747
|
+
} else {
|
|
2748
|
+
data = this.__ee__;
|
|
2749
|
+
}
|
|
2750
|
+
if (!data[type]) data[type] = listener;else if (typeof data[type] === 'object') data[type].push(listener);else data[type] = [data[type], listener];
|
|
2751
|
+
|
|
2752
|
+
return this;
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
once = function (type, listener) {
|
|
2756
|
+
var once, self;
|
|
2757
|
+
|
|
2758
|
+
callable(listener);
|
|
2759
|
+
self = this;
|
|
2760
|
+
on.call(this, type, once = function () {
|
|
2761
|
+
off.call(self, type, once);
|
|
2762
|
+
apply.call(listener, this, arguments);
|
|
2763
|
+
});
|
|
2764
|
+
|
|
2765
|
+
once.__eeOnceListener__ = listener;
|
|
2766
|
+
return this;
|
|
2767
|
+
};
|
|
2768
|
+
|
|
2769
|
+
off = function (type, listener) {
|
|
2770
|
+
var data, listeners, candidate, i;
|
|
2771
|
+
|
|
2772
|
+
callable(listener);
|
|
2773
|
+
|
|
2774
|
+
if (!hasOwnProperty.call(this, '__ee__')) return this;
|
|
2775
|
+
data = this.__ee__;
|
|
2776
|
+
if (!data[type]) return this;
|
|
2777
|
+
listeners = data[type];
|
|
2778
|
+
|
|
2779
|
+
if (typeof listeners === 'object') {
|
|
2780
|
+
for (i = 0; candidate = listeners[i]; ++i) {
|
|
2781
|
+
if (candidate === listener || candidate.__eeOnceListener__ === listener) {
|
|
2782
|
+
if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];else listeners.splice(i, 1);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
} else {
|
|
2786
|
+
if (listeners === listener || listeners.__eeOnceListener__ === listener) {
|
|
2787
|
+
delete data[type];
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
return this;
|
|
2792
|
+
};
|
|
2793
|
+
|
|
2794
|
+
emit = function (type) {
|
|
2795
|
+
var i, l, listener, listeners, args;
|
|
2796
|
+
|
|
2797
|
+
if (!hasOwnProperty.call(this, '__ee__')) return;
|
|
2798
|
+
listeners = this.__ee__[type];
|
|
2799
|
+
if (!listeners) return;
|
|
2800
|
+
|
|
2801
|
+
if (typeof listeners === 'object') {
|
|
2802
|
+
l = arguments.length;
|
|
2803
|
+
args = new Array(l - 1);
|
|
2804
|
+
for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
|
|
2805
|
+
|
|
2806
|
+
listeners = listeners.slice();
|
|
2807
|
+
for (i = 0; listener = listeners[i]; ++i) {
|
|
2808
|
+
apply.call(listener, this, args);
|
|
2809
|
+
}
|
|
2810
|
+
} else {
|
|
2811
|
+
switch (arguments.length) {
|
|
2812
|
+
case 1:
|
|
2813
|
+
call.call(listeners, this);
|
|
2814
|
+
break;
|
|
2815
|
+
case 2:
|
|
2816
|
+
call.call(listeners, this, arguments[1]);
|
|
2817
|
+
break;
|
|
2818
|
+
case 3:
|
|
2819
|
+
call.call(listeners, this, arguments[1], arguments[2]);
|
|
2820
|
+
break;
|
|
2821
|
+
default:
|
|
2822
|
+
l = arguments.length;
|
|
2823
|
+
args = new Array(l - 1);
|
|
2824
|
+
for (i = 1; i < l; ++i) {
|
|
2825
|
+
args[i - 1] = arguments[i];
|
|
2826
|
+
}
|
|
2827
|
+
apply.call(listeners, this, args);
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
};
|
|
2831
|
+
|
|
2832
|
+
methods = {
|
|
2833
|
+
on: on,
|
|
2834
|
+
once: once,
|
|
2835
|
+
off: off,
|
|
2836
|
+
emit: emit
|
|
2837
|
+
};
|
|
2838
|
+
|
|
2839
|
+
descriptors = {
|
|
2840
|
+
on: d(on),
|
|
2841
|
+
once: d(once),
|
|
2842
|
+
off: d(off),
|
|
2843
|
+
emit: d(emit)
|
|
2844
|
+
};
|
|
2845
|
+
|
|
2846
|
+
base = defineProperties({}, descriptors);
|
|
2847
|
+
|
|
2848
|
+
module.exports = exports = function (o) {
|
|
2849
|
+
return o == null ? create(base) : defineProperties(Object(o), descriptors);
|
|
2850
|
+
};
|
|
2851
|
+
exports.methods = methods;
|
|
2852
|
+
|
|
2853
|
+
/***/ }),
|
|
2854
|
+
/* 13 */
|
|
2855
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2856
|
+
|
|
2857
|
+
"use strict";
|
|
2858
|
+
|
|
2859
|
+
|
|
2860
|
+
var isValue = __webpack_require__(6),
|
|
2861
|
+
isPlainFunction = __webpack_require__(14),
|
|
2862
|
+
assign = __webpack_require__(18),
|
|
2863
|
+
normalizeOpts = __webpack_require__(26),
|
|
2864
|
+
contains = __webpack_require__(27);
|
|
2865
|
+
|
|
2866
|
+
var d = module.exports = function (dscr, value /*, options*/) {
|
|
2867
|
+
var c, e, w, options, desc;
|
|
2868
|
+
if (arguments.length < 2 || typeof dscr !== "string") {
|
|
2869
|
+
options = value;
|
|
2870
|
+
value = dscr;
|
|
2871
|
+
dscr = null;
|
|
2872
|
+
} else {
|
|
2873
|
+
options = arguments[2];
|
|
2874
|
+
}
|
|
2875
|
+
if (isValue(dscr)) {
|
|
2876
|
+
c = contains.call(dscr, "c");
|
|
2877
|
+
e = contains.call(dscr, "e");
|
|
2878
|
+
w = contains.call(dscr, "w");
|
|
2879
|
+
} else {
|
|
2880
|
+
c = w = true;
|
|
2881
|
+
e = false;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
desc = { value: value, configurable: c, enumerable: e, writable: w };
|
|
2885
|
+
return !options ? desc : assign(normalizeOpts(options), desc);
|
|
2886
|
+
};
|
|
2887
|
+
|
|
2888
|
+
d.gs = function (dscr, get, set /*, options*/) {
|
|
2889
|
+
var c, e, options, desc;
|
|
2890
|
+
if (typeof dscr !== "string") {
|
|
2891
|
+
options = set;
|
|
2892
|
+
set = get;
|
|
2893
|
+
get = dscr;
|
|
2894
|
+
dscr = null;
|
|
2895
|
+
} else {
|
|
2896
|
+
options = arguments[3];
|
|
2897
|
+
}
|
|
2898
|
+
if (!isValue(get)) {
|
|
2899
|
+
get = undefined;
|
|
2900
|
+
} else if (!isPlainFunction(get)) {
|
|
2901
|
+
options = get;
|
|
2902
|
+
get = set = undefined;
|
|
2903
|
+
} else if (!isValue(set)) {
|
|
2904
|
+
set = undefined;
|
|
2905
|
+
} else if (!isPlainFunction(set)) {
|
|
2906
|
+
options = set;
|
|
2907
|
+
set = undefined;
|
|
2908
|
+
}
|
|
2909
|
+
if (isValue(dscr)) {
|
|
2910
|
+
c = contains.call(dscr, "c");
|
|
2911
|
+
e = contains.call(dscr, "e");
|
|
2912
|
+
} else {
|
|
2913
|
+
c = true;
|
|
2914
|
+
e = false;
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
desc = { get: get, set: set, configurable: c, enumerable: e };
|
|
2918
|
+
return !options ? desc : assign(normalizeOpts(options), desc);
|
|
2919
|
+
};
|
|
2920
|
+
|
|
2921
|
+
/***/ }),
|
|
2922
|
+
/* 14 */
|
|
2923
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2924
|
+
|
|
2925
|
+
"use strict";
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
var isFunction = __webpack_require__(15);
|
|
2929
|
+
|
|
2930
|
+
var classRe = /^\s*class[\s{/}]/,
|
|
2931
|
+
functionToString = Function.prototype.toString;
|
|
2932
|
+
|
|
2933
|
+
module.exports = function (value) {
|
|
2934
|
+
if (!isFunction(value)) return false;
|
|
2935
|
+
if (classRe.test(functionToString.call(value))) return false;
|
|
2936
|
+
return true;
|
|
2937
|
+
};
|
|
2938
|
+
|
|
2939
|
+
/***/ }),
|
|
2940
|
+
/* 15 */
|
|
2941
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2942
|
+
|
|
2943
|
+
"use strict";
|
|
2944
|
+
|
|
2945
|
+
|
|
2946
|
+
var isPrototype = __webpack_require__(16);
|
|
2947
|
+
|
|
2948
|
+
module.exports = function (value) {
|
|
2949
|
+
if (typeof value !== "function") return false;
|
|
2950
|
+
|
|
2951
|
+
if (!hasOwnProperty.call(value, "length")) return false;
|
|
2952
|
+
|
|
2953
|
+
try {
|
|
2954
|
+
if (typeof value.length !== "number") return false;
|
|
2955
|
+
if (typeof value.call !== "function") return false;
|
|
2956
|
+
if (typeof value.apply !== "function") return false;
|
|
2957
|
+
} catch (error) {
|
|
2958
|
+
return false;
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
return !isPrototype(value);
|
|
2962
|
+
};
|
|
2963
|
+
|
|
2964
|
+
/***/ }),
|
|
2965
|
+
/* 16 */
|
|
2966
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2967
|
+
|
|
2968
|
+
"use strict";
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
var isObject = __webpack_require__(17);
|
|
2972
|
+
|
|
2973
|
+
module.exports = function (value) {
|
|
2974
|
+
if (!isObject(value)) return false;
|
|
2975
|
+
try {
|
|
2976
|
+
if (!value.constructor) return false;
|
|
2977
|
+
return value.constructor.prototype === value;
|
|
2978
|
+
} catch (error) {
|
|
2979
|
+
return false;
|
|
2980
|
+
}
|
|
2981
|
+
};
|
|
2982
|
+
|
|
2983
|
+
/***/ }),
|
|
2984
|
+
/* 17 */
|
|
2985
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2986
|
+
|
|
2987
|
+
"use strict";
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
var isValue = __webpack_require__(6);
|
|
2991
|
+
|
|
2992
|
+
// prettier-ignore
|
|
2993
|
+
var possibleTypes = { "object": true, "function": true, "undefined": true /* document.all */ };
|
|
2994
|
+
|
|
2995
|
+
module.exports = function (value) {
|
|
2996
|
+
if (!isValue(value)) return false;
|
|
2997
|
+
return hasOwnProperty.call(possibleTypes, typeof value);
|
|
2998
|
+
};
|
|
2999
|
+
|
|
3000
|
+
/***/ }),
|
|
3001
|
+
/* 18 */
|
|
3002
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3003
|
+
|
|
3004
|
+
"use strict";
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
module.exports = __webpack_require__(19)() ? Object.assign : __webpack_require__(20);
|
|
3008
|
+
|
|
3009
|
+
/***/ }),
|
|
3010
|
+
/* 19 */
|
|
3011
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3012
|
+
|
|
3013
|
+
"use strict";
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
module.exports = function () {
|
|
3017
|
+
var assign = Object.assign,
|
|
3018
|
+
obj;
|
|
3019
|
+
if (typeof assign !== "function") return false;
|
|
3020
|
+
obj = { foo: "raz" };
|
|
3021
|
+
assign(obj, { bar: "dwa" }, { trzy: "trzy" });
|
|
3022
|
+
return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
|
|
3023
|
+
};
|
|
3024
|
+
|
|
3025
|
+
/***/ }),
|
|
3026
|
+
/* 20 */
|
|
3027
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3028
|
+
|
|
3029
|
+
"use strict";
|
|
3030
|
+
|
|
3031
|
+
|
|
3032
|
+
var keys = __webpack_require__(21),
|
|
3033
|
+
value = __webpack_require__(25),
|
|
3034
|
+
max = Math.max;
|
|
3035
|
+
|
|
3036
|
+
module.exports = function (dest, src /*, …srcn*/) {
|
|
3037
|
+
var error,
|
|
3038
|
+
i,
|
|
3039
|
+
length = max(arguments.length, 2),
|
|
3040
|
+
assign;
|
|
3041
|
+
dest = Object(value(dest));
|
|
3042
|
+
assign = function (key) {
|
|
3043
|
+
try {
|
|
3044
|
+
dest[key] = src[key];
|
|
3045
|
+
} catch (e) {
|
|
3046
|
+
if (!error) error = e;
|
|
3047
|
+
}
|
|
3048
|
+
};
|
|
3049
|
+
for (i = 1; i < length; ++i) {
|
|
3050
|
+
src = arguments[i];
|
|
3051
|
+
keys(src).forEach(assign);
|
|
3052
|
+
}
|
|
3053
|
+
if (error !== undefined) throw error;
|
|
3054
|
+
return dest;
|
|
3055
|
+
};
|
|
3056
|
+
|
|
3057
|
+
/***/ }),
|
|
3058
|
+
/* 21 */
|
|
3059
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3060
|
+
|
|
3061
|
+
"use strict";
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
module.exports = __webpack_require__(22)() ? Object.keys : __webpack_require__(23);
|
|
3065
|
+
|
|
3066
|
+
/***/ }),
|
|
3067
|
+
/* 22 */
|
|
3068
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3069
|
+
|
|
3070
|
+
"use strict";
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
module.exports = function () {
|
|
3074
|
+
try {
|
|
3075
|
+
Object.keys("primitive");
|
|
3076
|
+
return true;
|
|
3077
|
+
} catch (e) {
|
|
3078
|
+
return false;
|
|
3079
|
+
}
|
|
3080
|
+
};
|
|
3081
|
+
|
|
3082
|
+
/***/ }),
|
|
3083
|
+
/* 23 */
|
|
3084
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3085
|
+
|
|
3086
|
+
"use strict";
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
var isValue = __webpack_require__(3);
|
|
3090
|
+
|
|
3091
|
+
var keys = Object.keys;
|
|
3092
|
+
|
|
3093
|
+
module.exports = function (object) {
|
|
3094
|
+
return keys(isValue(object) ? Object(object) : object);
|
|
3095
|
+
};
|
|
3096
|
+
|
|
3097
|
+
/***/ }),
|
|
3098
|
+
/* 24 */
|
|
3099
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3100
|
+
|
|
3101
|
+
"use strict";
|
|
3102
|
+
|
|
3103
|
+
|
|
3104
|
+
// eslint-disable-next-line no-empty-function
|
|
3105
|
+
|
|
3106
|
+
module.exports = function () {};
|
|
3107
|
+
|
|
3108
|
+
/***/ }),
|
|
3109
|
+
/* 25 */
|
|
3110
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3111
|
+
|
|
3112
|
+
"use strict";
|
|
3113
|
+
|
|
3114
|
+
|
|
3115
|
+
var isValue = __webpack_require__(3);
|
|
3116
|
+
|
|
3117
|
+
module.exports = function (value) {
|
|
3118
|
+
if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
|
|
3119
|
+
return value;
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3122
|
+
/***/ }),
|
|
3123
|
+
/* 26 */
|
|
3124
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3125
|
+
|
|
3126
|
+
"use strict";
|
|
3127
|
+
|
|
3128
|
+
|
|
3129
|
+
var isValue = __webpack_require__(3);
|
|
3130
|
+
|
|
3131
|
+
var forEach = Array.prototype.forEach,
|
|
3132
|
+
create = Object.create;
|
|
3133
|
+
|
|
3134
|
+
var process = function (src, obj) {
|
|
3135
|
+
var key;
|
|
3136
|
+
for (key in src) obj[key] = src[key];
|
|
3137
|
+
};
|
|
3138
|
+
|
|
3139
|
+
// eslint-disable-next-line no-unused-vars
|
|
3140
|
+
module.exports = function (opts1 /*, …options*/) {
|
|
3141
|
+
var result = create(null);
|
|
3142
|
+
forEach.call(arguments, function (options) {
|
|
3143
|
+
if (!isValue(options)) return;
|
|
3144
|
+
process(Object(options), result);
|
|
3145
|
+
});
|
|
3146
|
+
return result;
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3149
|
+
/***/ }),
|
|
3150
|
+
/* 27 */
|
|
3151
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3152
|
+
|
|
3153
|
+
"use strict";
|
|
3154
|
+
|
|
3155
|
+
|
|
3156
|
+
module.exports = __webpack_require__(28)() ? String.prototype.contains : __webpack_require__(29);
|
|
3157
|
+
|
|
3158
|
+
/***/ }),
|
|
3159
|
+
/* 28 */
|
|
3160
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3161
|
+
|
|
3162
|
+
"use strict";
|
|
3163
|
+
|
|
3164
|
+
|
|
3165
|
+
var str = "razdwatrzy";
|
|
3166
|
+
|
|
3167
|
+
module.exports = function () {
|
|
3168
|
+
if (typeof str.contains !== "function") return false;
|
|
3169
|
+
return str.contains("dwa") === true && str.contains("foo") === false;
|
|
3170
|
+
};
|
|
3171
|
+
|
|
3172
|
+
/***/ }),
|
|
3173
|
+
/* 29 */
|
|
3174
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3175
|
+
|
|
3176
|
+
"use strict";
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
var indexOf = String.prototype.indexOf;
|
|
3180
|
+
|
|
3181
|
+
module.exports = function (searchString /*, position*/) {
|
|
3182
|
+
return indexOf.call(this, searchString, arguments[1]) > -1;
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3185
|
+
/***/ }),
|
|
3186
|
+
/* 30 */
|
|
3187
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3188
|
+
|
|
3189
|
+
"use strict";
|
|
3190
|
+
|
|
3191
|
+
|
|
3192
|
+
module.exports = function (fn) {
|
|
3193
|
+
if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
|
|
3194
|
+
return fn;
|
|
3195
|
+
};
|
|
3196
|
+
|
|
3197
|
+
/***/ }),
|
|
3198
|
+
/* 31 */
|
|
3199
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3200
|
+
|
|
3201
|
+
"use strict";
|
|
3202
|
+
|
|
3203
|
+
|
|
3204
|
+
var value = __webpack_require__(32),
|
|
3205
|
+
hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3206
|
+
|
|
3207
|
+
module.exports = function (emitter /*, type*/) {
|
|
3208
|
+
var type = arguments[1],
|
|
3209
|
+
data;
|
|
3210
|
+
|
|
3211
|
+
value(emitter);
|
|
3212
|
+
|
|
3213
|
+
if (type !== undefined) {
|
|
3214
|
+
data = hasOwnProperty.call(emitter, '__ee__') && emitter.__ee__;
|
|
3215
|
+
if (!data) return;
|
|
3216
|
+
if (data[type]) delete data[type];
|
|
3217
|
+
return;
|
|
3218
|
+
}
|
|
3219
|
+
if (hasOwnProperty.call(emitter, '__ee__')) delete emitter.__ee__;
|
|
3220
|
+
};
|
|
3221
|
+
|
|
3222
|
+
/***/ }),
|
|
3223
|
+
/* 32 */
|
|
3224
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3225
|
+
|
|
3226
|
+
"use strict";
|
|
3227
|
+
|
|
3228
|
+
|
|
3229
|
+
var isObject = __webpack_require__(33);
|
|
3230
|
+
|
|
3231
|
+
module.exports = function (value) {
|
|
3232
|
+
if (!isObject(value)) throw new TypeError(value + " is not an Object");
|
|
3233
|
+
return value;
|
|
3234
|
+
};
|
|
3235
|
+
|
|
3236
|
+
/***/ }),
|
|
3237
|
+
/* 33 */
|
|
3238
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3239
|
+
|
|
3240
|
+
"use strict";
|
|
3241
|
+
|
|
3242
|
+
|
|
3243
|
+
var isValue = __webpack_require__(3);
|
|
3244
|
+
|
|
3245
|
+
var map = { function: true, object: true };
|
|
3246
|
+
|
|
3247
|
+
module.exports = function (value) {
|
|
3248
|
+
return isValue(value) && map[typeof value] || false;
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3251
|
+
/***/ }),
|
|
3252
|
+
/* 34 */
|
|
3253
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3254
|
+
|
|
3255
|
+
|
|
3256
|
+
var content = __webpack_require__(35);
|
|
3257
|
+
|
|
3258
|
+
if(typeof content === 'string') content = [[module.i, content, '']];
|
|
3259
|
+
|
|
3260
|
+
var transform;
|
|
3261
|
+
var insertInto;
|
|
3262
|
+
|
|
3263
|
+
|
|
3264
|
+
|
|
3265
|
+
var options = {"hmr":true}
|
|
3266
|
+
|
|
3267
|
+
options.transform = transform
|
|
3268
|
+
options.insertInto = undefined;
|
|
3269
|
+
|
|
3270
|
+
var update = __webpack_require__(2)(content, options);
|
|
3271
|
+
|
|
3272
|
+
if(content.locals) module.exports = content.locals;
|
|
3273
|
+
|
|
3274
|
+
if(false) {}
|
|
3275
|
+
|
|
3276
|
+
/***/ }),
|
|
3277
|
+
/* 35 */
|
|
3278
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3279
|
+
|
|
3280
|
+
exports = module.exports = __webpack_require__(1)(false);
|
|
3281
|
+
// imports
|
|
3282
|
+
|
|
3283
|
+
|
|
3284
|
+
// module
|
|
3285
|
+
exports.push([module.i, ".xgplayer-skin-default{background:#000;width:100%;height:100%;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.xgplayer-skin-default *{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}.xgplayer-skin-default.xgplayer-rotate-fullscreen{position:absolute;top:0;left:100%;bottom:0;right:0;height:100vw!important;width:100vh!important;-webkit-transform-origin:top left;-ms-transform-origin:top left;transform-origin:top left;-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.xgplayer-skin-default.xgplayer-is-fullscreen{width:100%!important;height:100%!important;padding-top:0!important;z-index:9999}.xgplayer-skin-default.xgplayer-is-fullscreen.xgplayer-inactive{cursor:none}.xgplayer-skin-default video{width:100%;height:100%;outline:none}.xgplayer-skin-default .xgplayer-none{display:none}@-webkit-keyframes loadingRotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loadingRotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes loadingDashOffset{0%{stroke-dashoffset:236}to{stroke-dashoffset:0}}@keyframes loadingDashOffset{0%{stroke-dashoffset:236}to{stroke-dashoffset:0}}.xgplayer-skin-default .xgplayer-controls{display:-webkit-flex;display:-moz-box;display:flex;position:absolute;bottom:0;left:0;right:0;height:40px;background-image:linear-gradient(180deg,transparent,rgba(0,0,0,.37),rgba(0,0,0,.75),rgba(0,0,0,.75));z-index:10}.xgplayer-skin-default.xgplayer-inactive .xgplayer-controls,.xgplayer-skin-default.xgplayer-is-live .xgplayer-controls .xgplayer-progress,.xgplayer-skin-default.xgplayer-is-live .xgplayer-controls .xgplayer-time,.xgplayer-skin-default.xgplayer-no-controls .xgplayer-controls,.xgplayer-skin-default.xgplayer-nostart .xgplayer-controls{display:none}.xgplayer-skin-default.xgplayer-is-live .xgplayer-controls .xgplayer-live{display:block}.xgplayer-skin-default .xgplayer-live{display:block;font-size:12px;color:#fff;line-height:40px;-webkit-order:1;-moz-box-ordinal-group:2;order:1}.xgplayer-skin-default .xgplayer-icon{display:block;width:40px;height:40px;overflow:hidden;fill:#fff}.xgplayer-skin-default .xgplayer-icon svg{position:absolute}.xgplayer-skin-default .xgplayer-tips{background:rgba(0,0,0,.54);border-radius:1px;display:none;position:absolute;font-family:PingFangSC-Regular;font-size:11px;color:#fff;padding:2px 4px;text-align:center;top:-30px;left:50%;margin-left:-16px;width:auto;white-space:nowrap}.xgplayer-skin-default.xgplayer-mobile .xgplayer-tips{display:none!important}.xgplayer-skin-default .xgplayer-screen-container{display:block;width:100%}", ""]);
|
|
3286
|
+
|
|
3287
|
+
// exports
|
|
3288
|
+
|
|
3289
|
+
|
|
3290
|
+
/***/ }),
|
|
3291
|
+
/* 36 */
|
|
3292
|
+
/***/ (function(module, exports) {
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
/**
|
|
3296
|
+
* When source maps are enabled, `style-loader` uses a link element with a data-uri to
|
|
3297
|
+
* embed the css on the page. This breaks all relative urls because now they are relative to a
|
|
3298
|
+
* bundle instead of the current page.
|
|
3299
|
+
*
|
|
3300
|
+
* One solution is to only use full urls, but that may be impossible.
|
|
3301
|
+
*
|
|
3302
|
+
* Instead, this function "fixes" the relative urls to be absolute according to the current page location.
|
|
3303
|
+
*
|
|
3304
|
+
* A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
|
|
3305
|
+
*
|
|
3306
|
+
*/
|
|
3307
|
+
|
|
3308
|
+
module.exports = function (css) {
|
|
3309
|
+
// get current location
|
|
3310
|
+
var location = typeof window !== "undefined" && window.location;
|
|
3311
|
+
|
|
3312
|
+
if (!location) {
|
|
3313
|
+
throw new Error("fixUrls requires window.location");
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
// blank or null?
|
|
3317
|
+
if (!css || typeof css !== "string") {
|
|
3318
|
+
return css;
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
var baseUrl = location.protocol + "//" + location.host;
|
|
3322
|
+
var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
|
|
3323
|
+
|
|
3324
|
+
// convert each url(...)
|
|
3325
|
+
/*
|
|
3326
|
+
This regular expression is just a way to recursively match brackets within
|
|
3327
|
+
a string.
|
|
3328
|
+
/url\s*\( = Match on the word "url" with any whitespace after it and then a parens
|
|
3329
|
+
( = Start a capturing group
|
|
3330
|
+
(?: = Start a non-capturing group
|
|
3331
|
+
[^)(] = Match anything that isn't a parentheses
|
|
3332
|
+
| = OR
|
|
3333
|
+
\( = Match a start parentheses
|
|
3334
|
+
(?: = Start another non-capturing groups
|
|
3335
|
+
[^)(]+ = Match anything that isn't a parentheses
|
|
3336
|
+
| = OR
|
|
3337
|
+
\( = Match a start parentheses
|
|
3338
|
+
[^)(]* = Match anything that isn't a parentheses
|
|
3339
|
+
\) = Match a end parentheses
|
|
3340
|
+
) = End Group
|
|
3341
|
+
*\) = Match anything and then a close parens
|
|
3342
|
+
) = Close non-capturing group
|
|
3343
|
+
* = Match anything
|
|
3344
|
+
) = Close capturing group
|
|
3345
|
+
\) = Match a close parens
|
|
3346
|
+
/gi = Get all matches, not the first. Be case insensitive.
|
|
3347
|
+
*/
|
|
3348
|
+
var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function (fullMatch, origUrl) {
|
|
3349
|
+
// strip quotes (if they exist)
|
|
3350
|
+
var unquotedOrigUrl = origUrl.trim().replace(/^"(.*)"$/, function (o, $1) {
|
|
3351
|
+
return $1;
|
|
3352
|
+
}).replace(/^'(.*)'$/, function (o, $1) {
|
|
3353
|
+
return $1;
|
|
3354
|
+
});
|
|
3355
|
+
|
|
3356
|
+
// already a full url? no change
|
|
3357
|
+
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
|
|
3358
|
+
return fullMatch;
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
// convert the url to a full url
|
|
3362
|
+
var newUrl;
|
|
3363
|
+
|
|
3364
|
+
if (unquotedOrigUrl.indexOf("//") === 0) {
|
|
3365
|
+
//TODO: should we add protocol?
|
|
3366
|
+
newUrl = unquotedOrigUrl;
|
|
3367
|
+
} else if (unquotedOrigUrl.indexOf("/") === 0) {
|
|
3368
|
+
// path should be relative to the base url
|
|
3369
|
+
newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
|
|
3370
|
+
} else {
|
|
3371
|
+
// path should be relative to current directory
|
|
3372
|
+
newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
// send back the fixed url(...)
|
|
3376
|
+
return "url(" + JSON.stringify(newUrl) + ")";
|
|
3377
|
+
});
|
|
3378
|
+
|
|
3379
|
+
// send back the fixed css
|
|
3380
|
+
return fixedCss;
|
|
3381
|
+
};
|
|
3382
|
+
|
|
3383
|
+
/***/ }),
|
|
3384
|
+
/* 37 */
|
|
3385
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3386
|
+
|
|
3387
|
+
"use strict";
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3391
|
+
value: true
|
|
3392
|
+
});
|
|
3393
|
+
|
|
3394
|
+
var _util = __webpack_require__(0);
|
|
3395
|
+
|
|
3396
|
+
var mobile = function mobile() {
|
|
3397
|
+
var player = this;
|
|
3398
|
+
var root = player.root;
|
|
3399
|
+
var clk = 0;var _click_ = void 0;
|
|
3400
|
+
var clickedTime = {
|
|
3401
|
+
first: '',
|
|
3402
|
+
second: ''
|
|
3403
|
+
};
|
|
3404
|
+
|
|
3405
|
+
player.onElementTouchend = function (e, element) {
|
|
3406
|
+
if (!this.config.closeVideoPreventDefault) {
|
|
3407
|
+
e.preventDefault();
|
|
3408
|
+
}
|
|
3409
|
+
if (!this.config.closeVideoStopPropagation) {
|
|
3410
|
+
e.stopPropagation();
|
|
3411
|
+
}
|
|
3412
|
+
var player = this;
|
|
3413
|
+
if ((0, _util.hasClass)(root, 'xgplayer-inactive')) {
|
|
3414
|
+
player.emit('focus');
|
|
3415
|
+
} else {
|
|
3416
|
+
player.emit('blur');
|
|
3417
|
+
}
|
|
3418
|
+
if (!player.config.closeVideoTouch && !player.isTouchMove) {
|
|
3419
|
+
var onTouch = function onTouch() {
|
|
3420
|
+
_click_ = setTimeout(function () {
|
|
3421
|
+
if ((0, _util.hasClass)(player.root, 'xgplayer-nostart')) {
|
|
3422
|
+
return false;
|
|
3423
|
+
} else if (!player.ended) {
|
|
3424
|
+
if (player.paused) {
|
|
3425
|
+
var playPromise = player.play();
|
|
3426
|
+
if (playPromise !== undefined && playPromise) {
|
|
3427
|
+
playPromise.catch(function (err) {});
|
|
3428
|
+
}
|
|
3429
|
+
} else {
|
|
3430
|
+
player.pause();
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
clk = 0;
|
|
3434
|
+
}, 200);
|
|
3435
|
+
};
|
|
3436
|
+
|
|
3437
|
+
if (!player.config.closeVideoClick) {
|
|
3438
|
+
clk++;
|
|
3439
|
+
if (_click_) {
|
|
3440
|
+
clearTimeout(_click_);
|
|
3441
|
+
}
|
|
3442
|
+
if (clk === 1) {
|
|
3443
|
+
if (player.config.enableVideoDbltouch) {
|
|
3444
|
+
clickedTime.first = new Date();
|
|
3445
|
+
} else {
|
|
3446
|
+
onTouch();
|
|
3447
|
+
}
|
|
3448
|
+
} else if (clk === 2) {
|
|
3449
|
+
if (player.config.enableVideoDbltouch) {
|
|
3450
|
+
clickedTime.second = new Date();
|
|
3451
|
+
if (Math.abs(clickedTime.first - clickedTime.second) < 400) {
|
|
3452
|
+
// 双击
|
|
3453
|
+
onTouch();
|
|
3454
|
+
} else {
|
|
3455
|
+
clickedTime.first = new Date();
|
|
3456
|
+
clk = 1;
|
|
3457
|
+
}
|
|
3458
|
+
} else {
|
|
3459
|
+
clk = 0;
|
|
3460
|
+
}
|
|
3461
|
+
} else {
|
|
3462
|
+
clk = 0;
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
};
|
|
3467
|
+
|
|
3468
|
+
function onReady(e) {
|
|
3469
|
+
player.video.addEventListener('touchend', function (e) {
|
|
3470
|
+
player.onElementTouchend(e, player.video);
|
|
3471
|
+
});
|
|
3472
|
+
player.video.addEventListener('touchstart', function () {
|
|
3473
|
+
player.isTouchMove = false;
|
|
3474
|
+
});
|
|
3475
|
+
player.video.addEventListener('touchmove', function () {
|
|
3476
|
+
player.isTouchMove = true;
|
|
3477
|
+
});
|
|
3478
|
+
if (player.config.autoplay) {
|
|
3479
|
+
player.start();
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
player.once('ready', onReady);
|
|
3483
|
+
|
|
3484
|
+
function onDestroy() {
|
|
3485
|
+
player.off('ready', onReady);
|
|
3486
|
+
player.off('destroy', onDestroy);
|
|
3487
|
+
}
|
|
3488
|
+
player.once('destroy', onDestroy);
|
|
3489
|
+
};
|
|
3490
|
+
|
|
3491
|
+
exports.default = {
|
|
3492
|
+
name: 'mobile',
|
|
3493
|
+
method: mobile
|
|
3494
|
+
};
|
|
3495
|
+
module.exports = exports['default'];
|
|
3496
|
+
|
|
3497
|
+
/***/ }),
|
|
3498
|
+
/* 38 */
|
|
3499
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3500
|
+
|
|
3501
|
+
"use strict";
|
|
3502
|
+
|
|
3503
|
+
|
|
3504
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3505
|
+
value: true
|
|
3506
|
+
});
|
|
3507
|
+
|
|
3508
|
+
var _util = __webpack_require__(0);
|
|
3509
|
+
|
|
3510
|
+
var pc = function pc() {
|
|
3511
|
+
var player = this;
|
|
3512
|
+
if (!player.controls || !player.video) return;
|
|
3513
|
+
var controls = player.controls;var root = player.root;
|
|
3514
|
+
var clk = 0;var _click_ = void 0;
|
|
3515
|
+
|
|
3516
|
+
player.onElementClick = function (e, element) {
|
|
3517
|
+
if (!this.config.closeVideoPreventDefault) {
|
|
3518
|
+
e.preventDefault();
|
|
3519
|
+
}
|
|
3520
|
+
if (!this.config.closeVideoStopPropagation) {
|
|
3521
|
+
e.stopPropagation();
|
|
3522
|
+
}
|
|
3523
|
+
var player = this;
|
|
3524
|
+
if (!player.config.closeVideoClick) {
|
|
3525
|
+
clk++;
|
|
3526
|
+
if (_click_) {
|
|
3527
|
+
clearTimeout(_click_);
|
|
3528
|
+
}
|
|
3529
|
+
if (clk === 1) {
|
|
3530
|
+
_click_ = setTimeout(function () {
|
|
3531
|
+
if ((0, _util.hasClass)(player.root, 'xgplayer-nostart')) {
|
|
3532
|
+
return false;
|
|
3533
|
+
} else if (!player.ended) {
|
|
3534
|
+
if (player.paused) {
|
|
3535
|
+
var playPromise = player.play();
|
|
3536
|
+
if (playPromise !== undefined && playPromise) {
|
|
3537
|
+
playPromise.catch(function (err) {});
|
|
3538
|
+
}
|
|
3539
|
+
} else {
|
|
3540
|
+
player.pause();
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
clk = 0;
|
|
3544
|
+
}, 200);
|
|
3545
|
+
} else {
|
|
3546
|
+
clk = 0;
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
};
|
|
3550
|
+
player.video.addEventListener('click', function (e) {
|
|
3551
|
+
player.onElementClick(e, player.video);
|
|
3552
|
+
}, false);
|
|
3553
|
+
|
|
3554
|
+
player.onElementDblclick = function (e, element) {
|
|
3555
|
+
if (!this.config.closeVideoPreventDefault) {
|
|
3556
|
+
e.preventDefault();
|
|
3557
|
+
}
|
|
3558
|
+
if (!this.config.closeVideoStopPropagation) {
|
|
3559
|
+
e.stopPropagation();
|
|
3560
|
+
}
|
|
3561
|
+
var player = this;
|
|
3562
|
+
if (!player.config.closeVideoDblclick) {
|
|
3563
|
+
var fullscreen = controls.querySelector('.xgplayer-fullscreen');
|
|
3564
|
+
if (fullscreen) {
|
|
3565
|
+
var _clk = void 0;
|
|
3566
|
+
if (document.createEvent) {
|
|
3567
|
+
_clk = document.createEvent('Event');
|
|
3568
|
+
_clk.initEvent('click', true, true);
|
|
3569
|
+
} else {
|
|
3570
|
+
_clk = new Event('click');
|
|
3571
|
+
}
|
|
3572
|
+
fullscreen.dispatchEvent(_clk);
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
};
|
|
3576
|
+
player.video.addEventListener('dblclick', function (e) {
|
|
3577
|
+
player.onElementDblclick(e, player.video);
|
|
3578
|
+
}, false);
|
|
3579
|
+
|
|
3580
|
+
function onMouseEnter() {
|
|
3581
|
+
clearTimeout(player.leavePlayerTimer);
|
|
3582
|
+
player.emit('focus', player);
|
|
3583
|
+
}
|
|
3584
|
+
root.addEventListener('mouseenter', onMouseEnter);
|
|
3585
|
+
|
|
3586
|
+
function onMouseLeave() {
|
|
3587
|
+
if (!player.config.closePlayerBlur) {
|
|
3588
|
+
player.leavePlayerTimer = setTimeout(function () {
|
|
3589
|
+
player.emit('blur', player);
|
|
3590
|
+
}, player.config.leavePlayerTime || 0);
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
root.addEventListener('mouseleave', onMouseLeave);
|
|
3594
|
+
|
|
3595
|
+
function onControlMouseEnter(e) {
|
|
3596
|
+
if (player.userTimer) {
|
|
3597
|
+
clearTimeout(player.userTimer);
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
controls.addEventListener('mouseenter', onControlMouseEnter);
|
|
3601
|
+
|
|
3602
|
+
function onControlMouseLeave(e) {
|
|
3603
|
+
if (!player.config.closeControlsBlur) {
|
|
3604
|
+
player.emit('focus', player);
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
controls.addEventListener('mouseleave', onControlMouseLeave);
|
|
3608
|
+
|
|
3609
|
+
function onControlClick(e) {
|
|
3610
|
+
e.preventDefault();
|
|
3611
|
+
e.stopPropagation();
|
|
3612
|
+
}
|
|
3613
|
+
controls.addEventListener('click', onControlClick);
|
|
3614
|
+
|
|
3615
|
+
function onReady(e) {
|
|
3616
|
+
if (player.config.autoplay) {
|
|
3617
|
+
player.start();
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
player.once('ready', onReady);
|
|
3621
|
+
|
|
3622
|
+
function onDestroy() {
|
|
3623
|
+
root.removeEventListener('mouseenter', onMouseEnter);
|
|
3624
|
+
root.removeEventListener('mouseleave', onMouseLeave);
|
|
3625
|
+
player.off('ready', onReady);
|
|
3626
|
+
player.off('destroy', onDestroy);
|
|
3627
|
+
}
|
|
3628
|
+
player.once('destroy', onDestroy);
|
|
3629
|
+
};
|
|
3630
|
+
|
|
3631
|
+
exports.default = {
|
|
3632
|
+
name: 'pc',
|
|
3633
|
+
method: pc
|
|
3634
|
+
};
|
|
3635
|
+
module.exports = exports['default'];
|
|
3636
|
+
|
|
3637
|
+
/***/ }),
|
|
3638
|
+
/* 39 */
|
|
3639
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3640
|
+
|
|
3641
|
+
"use strict";
|
|
3642
|
+
|
|
3643
|
+
|
|
3644
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3645
|
+
value: true
|
|
3646
|
+
});
|
|
3647
|
+
|
|
3648
|
+
var _util = __webpack_require__(0);
|
|
3649
|
+
|
|
3650
|
+
var start = function start() {
|
|
3651
|
+
var player = this;
|
|
3652
|
+
var root = player.root;
|
|
3653
|
+
|
|
3654
|
+
function onCanPlay() {
|
|
3655
|
+
player.off('canplay', onCanPlay);
|
|
3656
|
+
var playPromise = player.play();
|
|
3657
|
+
if (playPromise !== undefined && playPromise) {
|
|
3658
|
+
playPromise.catch(function (err) {});
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3662
|
+
function onStartBtnClick() {
|
|
3663
|
+
if ((0, _util.hasClass)(root, 'xgplayer-nostart')) {
|
|
3664
|
+
(0, _util.removeClass)(root, 'xgplayer-nostart'); // for ie quick switch
|
|
3665
|
+
(0, _util.addClass)(root, 'xgplayer-is-enter');
|
|
3666
|
+
|
|
3667
|
+
if (typeof root.contains === 'function') {
|
|
3668
|
+
if (player.video && player.video.nodeType === 1 && !root.contains(player.video) || player.video && player.video.nodeType !== 1 && player.video.mediaSource === undefined) {
|
|
3669
|
+
player.once('canplay', onCanPlay);
|
|
3670
|
+
player.start();
|
|
3671
|
+
} else {
|
|
3672
|
+
onCanPlay();
|
|
3673
|
+
}
|
|
3674
|
+
} else {
|
|
3675
|
+
if (player.video && player.video.nodeType === 1 && !root.querySelector(this.videoConfig.mediaType) || player.video && player.video.nodeType !== 1 && player.video.mediaSource === undefined) {
|
|
3676
|
+
player.once('canplay', onCanPlay);
|
|
3677
|
+
player.start();
|
|
3678
|
+
} else {
|
|
3679
|
+
onCanPlay();
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
} else {
|
|
3683
|
+
if (player.paused) {
|
|
3684
|
+
(0, _util.removeClass)(root, 'xgplayer-nostart xgplayer-isloading');
|
|
3685
|
+
setTimeout(function () {
|
|
3686
|
+
var playPromise = player.play();
|
|
3687
|
+
if (playPromise !== undefined && playPromise) {
|
|
3688
|
+
playPromise.catch(function (err) {});
|
|
3689
|
+
}
|
|
3690
|
+
}, 10);
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
player.on('startBtnClick', onStartBtnClick);
|
|
3695
|
+
|
|
3696
|
+
function onDestroy() {
|
|
3697
|
+
player.off('startBtnClick', onStartBtnClick);
|
|
3698
|
+
player.off('canplay', onCanPlay);
|
|
3699
|
+
player.off('destroy', onDestroy);
|
|
3700
|
+
}
|
|
3701
|
+
player.once('destroy', onDestroy);
|
|
3702
|
+
};
|
|
3703
|
+
|
|
3704
|
+
exports.default = {
|
|
3705
|
+
name: 'start',
|
|
3706
|
+
method: start
|
|
3707
|
+
};
|
|
3708
|
+
module.exports = exports['default'];
|
|
3709
|
+
|
|
3710
|
+
/***/ }),
|
|
3711
|
+
/* 40 */
|
|
3712
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3713
|
+
|
|
3714
|
+
"use strict";
|
|
3715
|
+
|
|
3716
|
+
|
|
3717
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3718
|
+
value: true
|
|
3719
|
+
});
|
|
3720
|
+
|
|
3721
|
+
var _util = __webpack_require__(0);
|
|
3722
|
+
|
|
3723
|
+
var _startPlay = __webpack_require__(41);
|
|
3724
|
+
|
|
3725
|
+
var _startPlay2 = _interopRequireDefault(_startPlay);
|
|
3726
|
+
|
|
3727
|
+
var _startPause = __webpack_require__(42);
|
|
3728
|
+
|
|
3729
|
+
var _startPause2 = _interopRequireDefault(_startPause);
|
|
3730
|
+
|
|
3731
|
+
__webpack_require__(43);
|
|
3732
|
+
|
|
3733
|
+
function _interopRequireDefault(obj) {
|
|
3734
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
var s_start = function s_start() {
|
|
3738
|
+
var player = this;
|
|
3739
|
+
var root = player.root;
|
|
3740
|
+
var btn = (0, _util.createDom)('xg-start', '<div class="xgplayer-icon-play">' + _startPlay2.default + '</div>\n <div class="xgplayer-icon-pause">' + _startPause2.default + '</div>', {}, 'xgplayer-start');
|
|
3741
|
+
function onPlayerReady(player) {
|
|
3742
|
+
(0, _util.addClass)(player.root, 'xgplayer-skin-default');
|
|
3743
|
+
if (player.config) {
|
|
3744
|
+
player.config.autoplay && !(0, _util.isWeiXin)() && !(0, _util.isUc)() && (0, _util.addClass)(player.root, 'xgplayer-is-enter');
|
|
3745
|
+
if (player.config.lang && player.config.lang === 'en') {
|
|
3746
|
+
(0, _util.addClass)(player.root, 'xgplayer-lang-is-en');
|
|
3747
|
+
} else if (player.config.lang === 'jp') {
|
|
3748
|
+
(0, _util.addClass)(player.root, 'xgplayer-lang-is-jp');
|
|
3749
|
+
}
|
|
3750
|
+
if (!player.config.enableContextmenu) {
|
|
3751
|
+
player.video.addEventListener('contextmenu', function (e) {
|
|
3752
|
+
e.preventDefault();
|
|
3753
|
+
e.stopPropagation();
|
|
3754
|
+
});
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
if (player.config && player.config.hideStartBtn) {
|
|
3760
|
+
(0, _util.addClass)(root, 'xgplayer-start-hide');
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
if (player.isReady) {
|
|
3764
|
+
root.appendChild(btn);
|
|
3765
|
+
onPlayerReady(player);
|
|
3766
|
+
} else {
|
|
3767
|
+
player.once('ready', function () {
|
|
3768
|
+
root.appendChild(btn);
|
|
3769
|
+
onPlayerReady(player);
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
player.once('autoplay was prevented', function () {
|
|
3774
|
+
(0, _util.removeClass)(player.root, 'xgplayer-is-enter');
|
|
3775
|
+
(0, _util.addClass)(player.root, 'xgplayer-nostart');
|
|
3776
|
+
});
|
|
3777
|
+
|
|
3778
|
+
player.once('canplay', function () {
|
|
3779
|
+
(0, _util.removeClass)(player.root, 'xgplayer-is-enter');
|
|
3780
|
+
});
|
|
3781
|
+
|
|
3782
|
+
btn.onclick = function (e) {
|
|
3783
|
+
e.preventDefault();
|
|
3784
|
+
e.stopPropagation();
|
|
3785
|
+
player.userGestureTrigEvent('startBtnClick');
|
|
3786
|
+
};
|
|
3787
|
+
};
|
|
3788
|
+
|
|
3789
|
+
exports.default = {
|
|
3790
|
+
name: 's_start',
|
|
3791
|
+
method: s_start
|
|
3792
|
+
};
|
|
3793
|
+
module.exports = exports['default'];
|
|
3794
|
+
|
|
3795
|
+
/***/ }),
|
|
3796
|
+
/* 41 */
|
|
3797
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3798
|
+
|
|
3799
|
+
"use strict";
|
|
3800
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3801
|
+
/* harmony default export */ __webpack_exports__["default"] = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"70\" height=\"70\" viewBox=\"0 0 70 70\">\n <path transform=\"translate(15,15) scale(0.04,0.04)\" d=\"M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z\"></path>\n</svg>\n");
|
|
3802
|
+
|
|
3803
|
+
/***/ }),
|
|
3804
|
+
/* 42 */
|
|
3805
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3806
|
+
|
|
3807
|
+
"use strict";
|
|
3808
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3809
|
+
/* harmony default export */ __webpack_exports__["default"] = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"70\" height=\"70\" viewBox=\"0 0 70 70\">\n <path transform=\"translate(15,15) scale(0.04 0.04)\" d=\"M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z\"></path>\n</svg>\n");
|
|
3810
|
+
|
|
3811
|
+
/***/ }),
|
|
3812
|
+
/* 43 */
|
|
3813
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3814
|
+
|
|
3815
|
+
|
|
3816
|
+
var content = __webpack_require__(44);
|
|
3817
|
+
|
|
3818
|
+
if(typeof content === 'string') content = [[module.i, content, '']];
|
|
3819
|
+
|
|
3820
|
+
var transform;
|
|
3821
|
+
var insertInto;
|
|
3822
|
+
|
|
3823
|
+
|
|
3824
|
+
|
|
3825
|
+
var options = {"hmr":true}
|
|
3826
|
+
|
|
3827
|
+
options.transform = transform
|
|
3828
|
+
options.insertInto = undefined;
|
|
3829
|
+
|
|
3830
|
+
var update = __webpack_require__(2)(content, options);
|
|
3831
|
+
|
|
3832
|
+
if(content.locals) module.exports = content.locals;
|
|
3833
|
+
|
|
3834
|
+
if(false) {}
|
|
3835
|
+
|
|
3836
|
+
/***/ }),
|
|
3837
|
+
/* 44 */
|
|
3838
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3839
|
+
|
|
3840
|
+
exports = module.exports = __webpack_require__(1)(false);
|
|
3841
|
+
// imports
|
|
3842
|
+
|
|
3843
|
+
|
|
3844
|
+
// module
|
|
3845
|
+
exports.push([module.i, ".xgplayer-skin-default .xgplayer-start{border-radius:50%;display:inline-block;width:70px;height:70px;background:rgba(0,0,0,.38);overflow:hidden;text-align:center;line-height:70px;vertical-align:middle;position:absolute;left:50%;top:50%;z-index:115;margin:-35px auto auto -35px;cursor:pointer}.xgplayer-skin-default .xgplayer-start div{position:absolute}.xgplayer-skin-default .xgplayer-start div svg{fill:hsla(0,0%,100%,.7)}.xgplayer-skin-default .xgplayer-start .xgplayer-icon-play{display:block}.xgplayer-skin-default .xgplayer-start .xgplayer-icon-pause{display:none}.xgplayer-skin-default .xgplayer-start:hover{opacity:.85}.xgplayer-skin-default.xgplayer-pause.xgplayer-start-hide .xgplayer-start,.xgplayer-skin-default.xgplayer-playing .xgplayer-start,.xgplayer-skin-default.xgplayer-playing .xgplayer-start .xgplayer-icon-play,.xgplayer-skin-default.xgplayer-start-hide .xgplayer-start{display:none}.xgplayer-skin-default.xgplayer-playing .xgplayer-start .xgplayer-icon-pause{display:block}.xgplayer-skin-default.xgplayer-pause .xgplayer-start{display:inline-block}.xgplayer-skin-default.xgplayer-pause .xgplayer-start .xgplayer-icon-play{display:block}.xgplayer-skin-default.xgplayer-is-replay .xgplayer-start,.xgplayer-skin-default.xgplayer-pause .xgplayer-start .xgplayer-icon-pause{display:none}.xgplayer-skin-default.xgplayer-is-replay .xgplayer-start .xgplayer-icon-play{display:block}.xgplayer-skin-default.xgplayer-is-replay .xgplayer-start .xgplayer-icon-pause{display:none}", ""]);
|
|
3846
|
+
|
|
3847
|
+
// exports
|
|
3848
|
+
|
|
3849
|
+
|
|
3850
|
+
/***/ }),
|
|
3851
|
+
/* 45 */,
|
|
3852
|
+
/* 46 */,
|
|
3853
|
+
/* 47 */,
|
|
3854
|
+
/* 48 */,
|
|
3855
|
+
/* 49 */,
|
|
3856
|
+
/* 50 */,
|
|
3857
|
+
/* 51 */,
|
|
3858
|
+
/* 52 */,
|
|
3859
|
+
/* 53 */,
|
|
3860
|
+
/* 54 */,
|
|
3861
|
+
/* 55 */,
|
|
3862
|
+
/* 56 */,
|
|
3863
|
+
/* 57 */,
|
|
3864
|
+
/* 58 */,
|
|
3865
|
+
/* 59 */,
|
|
3866
|
+
/* 60 */,
|
|
3867
|
+
/* 61 */,
|
|
3868
|
+
/* 62 */,
|
|
3869
|
+
/* 63 */,
|
|
3870
|
+
/* 64 */,
|
|
3871
|
+
/* 65 */,
|
|
3872
|
+
/* 66 */,
|
|
3873
|
+
/* 67 */,
|
|
3874
|
+
/* 68 */,
|
|
3875
|
+
/* 69 */,
|
|
3876
|
+
/* 70 */,
|
|
3877
|
+
/* 71 */,
|
|
3878
|
+
/* 72 */,
|
|
3879
|
+
/* 73 */,
|
|
3880
|
+
/* 74 */,
|
|
3881
|
+
/* 75 */,
|
|
3882
|
+
/* 76 */,
|
|
3883
|
+
/* 77 */,
|
|
3884
|
+
/* 78 */,
|
|
3885
|
+
/* 79 */,
|
|
3886
|
+
/* 80 */,
|
|
3887
|
+
/* 81 */,
|
|
3888
|
+
/* 82 */,
|
|
3889
|
+
/* 83 */,
|
|
3890
|
+
/* 84 */,
|
|
3891
|
+
/* 85 */,
|
|
3892
|
+
/* 86 */,
|
|
3893
|
+
/* 87 */,
|
|
3894
|
+
/* 88 */,
|
|
3895
|
+
/* 89 */,
|
|
3896
|
+
/* 90 */,
|
|
3897
|
+
/* 91 */,
|
|
3898
|
+
/* 92 */,
|
|
3899
|
+
/* 93 */,
|
|
3900
|
+
/* 94 */,
|
|
3901
|
+
/* 95 */,
|
|
3902
|
+
/* 96 */,
|
|
3903
|
+
/* 97 */,
|
|
3904
|
+
/* 98 */,
|
|
3905
|
+
/* 99 */,
|
|
3906
|
+
/* 100 */,
|
|
3907
|
+
/* 101 */,
|
|
3908
|
+
/* 102 */,
|
|
3909
|
+
/* 103 */,
|
|
3910
|
+
/* 104 */,
|
|
3911
|
+
/* 105 */,
|
|
3912
|
+
/* 106 */,
|
|
3913
|
+
/* 107 */,
|
|
3914
|
+
/* 108 */,
|
|
3915
|
+
/* 109 */,
|
|
3916
|
+
/* 110 */,
|
|
3917
|
+
/* 111 */,
|
|
3918
|
+
/* 112 */,
|
|
3919
|
+
/* 113 */,
|
|
3920
|
+
/* 114 */,
|
|
3921
|
+
/* 115 */,
|
|
3922
|
+
/* 116 */,
|
|
3923
|
+
/* 117 */,
|
|
3924
|
+
/* 118 */,
|
|
3925
|
+
/* 119 */,
|
|
3926
|
+
/* 120 */,
|
|
3927
|
+
/* 121 */,
|
|
3928
|
+
/* 122 */,
|
|
3929
|
+
/* 123 */,
|
|
3930
|
+
/* 124 */,
|
|
3931
|
+
/* 125 */,
|
|
3932
|
+
/* 126 */,
|
|
3933
|
+
/* 127 */,
|
|
3934
|
+
/* 128 */,
|
|
3935
|
+
/* 129 */,
|
|
3936
|
+
/* 130 */,
|
|
3937
|
+
/* 131 */,
|
|
3938
|
+
/* 132 */,
|
|
3939
|
+
/* 133 */,
|
|
3940
|
+
/* 134 */,
|
|
3941
|
+
/* 135 */,
|
|
3942
|
+
/* 136 */,
|
|
3943
|
+
/* 137 */,
|
|
3944
|
+
/* 138 */,
|
|
3945
|
+
/* 139 */,
|
|
3946
|
+
/* 140 */,
|
|
3947
|
+
/* 141 */,
|
|
3948
|
+
/* 142 */,
|
|
3949
|
+
/* 143 */,
|
|
3950
|
+
/* 144 */,
|
|
3951
|
+
/* 145 */,
|
|
3952
|
+
/* 146 */,
|
|
3953
|
+
/* 147 */,
|
|
3954
|
+
/* 148 */,
|
|
3955
|
+
/* 149 */,
|
|
3956
|
+
/* 150 */,
|
|
3957
|
+
/* 151 */,
|
|
3958
|
+
/* 152 */,
|
|
3959
|
+
/* 153 */,
|
|
3960
|
+
/* 154 */,
|
|
3961
|
+
/* 155 */,
|
|
3962
|
+
/* 156 */,
|
|
3963
|
+
/* 157 */,
|
|
3964
|
+
/* 158 */,
|
|
3965
|
+
/* 159 */,
|
|
3966
|
+
/* 160 */,
|
|
3967
|
+
/* 161 */,
|
|
3968
|
+
/* 162 */,
|
|
3969
|
+
/* 163 */,
|
|
3970
|
+
/* 164 */,
|
|
3971
|
+
/* 165 */,
|
|
3972
|
+
/* 166 */,
|
|
3973
|
+
/* 167 */,
|
|
3974
|
+
/* 168 */,
|
|
3975
|
+
/* 169 */,
|
|
3976
|
+
/* 170 */,
|
|
3977
|
+
/* 171 */,
|
|
3978
|
+
/* 172 */,
|
|
3979
|
+
/* 173 */,
|
|
3980
|
+
/* 174 */,
|
|
3981
|
+
/* 175 */
|
|
3982
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3983
|
+
|
|
3984
|
+
module.exports = __webpack_require__(176);
|
|
3985
|
+
|
|
3986
|
+
|
|
3987
|
+
/***/ }),
|
|
3988
|
+
/* 176 */
|
|
3989
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3990
|
+
|
|
3991
|
+
"use strict";
|
|
3992
|
+
|
|
3993
|
+
|
|
3994
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3995
|
+
value: true
|
|
3996
|
+
});
|
|
3997
|
+
|
|
3998
|
+
var _player = __webpack_require__(9);
|
|
3999
|
+
|
|
4000
|
+
var _player2 = _interopRequireDefault(_player);
|
|
4001
|
+
|
|
4002
|
+
var _mobile = __webpack_require__(37);
|
|
4003
|
+
|
|
4004
|
+
var _mobile2 = _interopRequireDefault(_mobile);
|
|
4005
|
+
|
|
4006
|
+
var _pc = __webpack_require__(38);
|
|
4007
|
+
|
|
4008
|
+
var _pc2 = _interopRequireDefault(_pc);
|
|
4009
|
+
|
|
4010
|
+
var _start = __webpack_require__(39);
|
|
4011
|
+
|
|
4012
|
+
var _start2 = _interopRequireDefault(_start);
|
|
4013
|
+
|
|
4014
|
+
var _start3 = __webpack_require__(40);
|
|
4015
|
+
|
|
4016
|
+
var _start4 = _interopRequireDefault(_start3);
|
|
4017
|
+
|
|
4018
|
+
function _interopRequireDefault(obj) {
|
|
4019
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
var controlLst = [_mobile2.default, _pc2.default, _start2.default, _start4.default];
|
|
4023
|
+
controlLst.forEach(function (control) {
|
|
4024
|
+
_player2.default.install(control.name, control.method);
|
|
4025
|
+
});
|
|
4026
|
+
|
|
4027
|
+
exports.default = _player2.default;
|
|
4028
|
+
module.exports = exports['default'];
|
|
4029
|
+
|
|
4030
|
+
/***/ })
|
|
4031
|
+
/******/ ]);
|
|
4032
|
+
});
|
|
2
4033
|
//# sourceMappingURL=core_player.js.map
|