1!function(e, t) { 2 "object" == typeof exports && "undefined" != typeof module ? module.exports = t(require("core-js/modules/es.array.find.js"), require("core-js/modules/es.object.to-string.js"), require("core-js/modules/es.array.concat.js"), require("core-js/modules/web.dom-collections.for-each.js"), require("core-js/modules/es.object.keys.js"), require("core-js/modules/es.array.slice.js"), require("core-js/modules/es.regexp.exec.js"), require("core-js/modules/es.regexp.test.js"), require("core-js/modules/es.array.join.js"), require("core-js/modules/es.array.splice.js"), require("core-js/modules/es.promise.js"), require("core-js/modules/es.function.name.js"), require("core-js/modules/es.number.is-nan.js"), require("core-js/modules/es.number.constructor.js"), require("core-js/modules/es.array.map.js"), require("core-js/modules/es.array.iterator.js"), require("core-js/modules/web.dom-collections.iterator.js"), require("core-js/modules/es.array.filter.js"), require("core-js/modules/es.object.assign.js"), require("core-js/modules/es.symbol.js"), require("core-js/modules/es.string.match.js"), require("core-js/modules/es.regexp.constructor.js"), require("core-js/modules/es.regexp.sticky.js"), require("core-js/modules/es.regexp.to-string.js"), require("core-js/modules/es.string.split.js"), require("core-js/modules/es.string.replace.js"), require("core-js/modules/es.string.trim.js"), require("core-js/modules/es.array.sort.js"), require("core-js/modules/es.string.iterator.js"), require("core-js/modules/es.number.to-fixed.js"), require("core-js/modules/es.array.find-index.js"), require("core-js/modules/es.typed-array.uint8-array.js"), require("core-js/modules/esnext.typed-array.at.js"), require("core-js/modules/es.typed-array.copy-within.js"), require("core-js/modules/es.typed-array.every.js"), require("core-js/modules/es.typed-array.fill.js"), require("core-js/modules/es.typed-array.filter.js"), require("core-js/modules/es.typed-array.find.js"), require("core-js/modules/es.typed-array.find-index.js"), require("core-js/modules/esnext.typed-array.find-last.js"), require("core-js/modules/esnext.typed-array.find-last-index.js"), require("core-js/modules/es.typed-array.for-each.js"), require("core-js/modules/es.typed-array.includes.js"), require("core-js/modules/es.typed-array.index-of.js"), require("core-js/modules/es.typed-array.iterator.js"), require("core-js/modules/es.typed-array.join.js"), require("core-js/modules/es.typed-array.last-index-of.js"), require("core-js/modules/es.typed-array.map.js"), require("core-js/modules/es.typed-array.reduce.js"), require("core-js/modules/es.typed-array.reduce-right.js"), require("core-js/modules/es.typed-array.reverse.js"), require("core-js/modules/es.typed-array.set.js"), require("core-js/modules/es.typed-array.slice.js"), require("core-js/modules/es.typed-array.some.js"), require("core-js/modules/es.typed-array.sort.js"), require("core-js/modules/es.typed-array.subarray.js"), require("core-js/modules/es.typed-array.to-locale-string.js"), require("core-js/modules/es.typed-array.to-string.js"), require("core-js/modules/web.url.js"), require("core-js/modules/web.url-search-params.js"), require("core-js/modules/es.json.stringify.js")) : "function" == typeof define && define.amd ? define(["core-js/modules/es.array.find.js", "core-js/modules/es.object.to-string.js", "core-js/modules/es.array.concat.js", "core-js/modules/web.dom-collections.for-each.js", "core-js/modules/es.object.keys.js", "core-js/modules/es.array.slice.js", "core-js/modules/es.regexp.exec.js", "core-js/modules/es.regexp.test.js", "core-js/modules/es.array.join.js", "core-js/modules/es.array.splice.js", "core-js/modules/es.promise.js", "core-js/modules/es.function.name.js", "core-js/modules/es.number.is-nan.js", "core-js/modules/es.number.constructor.js", "core-js/modules/es.array.map.js", "core-js/modules/es.array.iterator.js", "core-js/modules/web.dom-collections.iterator.js", "core-js/modules/es.array.filter.js", "core-js/modules/es.object.assign.js", "core-js/modules/es.symbol.js", "core-js/modules/es.string.match.js", "core-js/modules/es.regexp.constructor.js", "core-js/modules/es.regexp.sticky.js", "core-js/modules/es.regexp.to-string.js", "core-js/modules/es.string.split.js", "core-js/modules/es.string.replace.js", "core-js/modules/es.string.trim.js", "core-js/modules/es.array.sort.js", "core-js/modules/es.string.iterator.js", "core-js/modules/es.number.to-fixed.js", "core-js/modules/es.array.find-index.js", "core-js/modules/es.typed-array.uint8-array.js", "core-js/modules/esnext.typed-array.at.js", "core-js/modules/es.typed-array.copy-within.js", "core-js/modules/es.typed-array.every.js", "core-js/modules/es.typed-array.fill.js", "core-js/modules/es.typed-array.filter.js", "core-js/modules/es.typed-array.find.js", "core-js/modules/es.typed-array.find-index.js", "core-js/modules/esnext.typed-array.find-last.js", "core-js/modules/esnext.typed-array.find-last-index.js", "core-js/modules/es.typed-array.for-each.js", "core-js/modules/es.typed-array.includes.js", "core-js/modules/es.typed-array.index-of.js", "core-js/modules/es.typed-array.iterator.js", "core-js/modules/es.typed-array.join.js", "core-js/modules/es.typed-array.last-index-of.js", "core-js/modules/es.typed-array.map.js", "core-js/modules/es.typed-array.reduce.js", "core-js/modules/es.typed-array.reduce-right.js", "core-js/modules/es.typed-array.reverse.js", "core-js/modules/es.typed-array.set.js", "core-js/modules/es.typed-array.slice.js", "core-js/modules/es.typed-array.some.js", "core-js/modules/es.typed-array.sort.js", "core-js/modules/es.typed-array.subarray.js", "core-js/modules/es.typed-array.to-locale-string.js", "core-js/modules/es.typed-array.to-string.js", "core-js/modules/web.url.js", "core-js/modules/web.url-search-params.js", "core-js/modules/es.json.stringify.js"], t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).Player = t() 3}(this, (function() { 4 "use strict"; 5 function e(e, t) { 6 var i = Object.keys(e); 7 if (Object.getOwnPropertySymbols) { 8 var n = Object.getOwnPropertySymbols(e); 9 t && (n = n.filter((function(t) { 10 return Object.getOwnPropertyDescriptor(e, t).enumerable 11 } 12 ))), 13 i.push.apply(i, n) 14 } 15 return i 16 } 17 function t(t) { 18 for (var i = 1; i < arguments.length; i++) { 19 var n = null != arguments[i] ? arguments[i] : {};
vendor: 64,390 bytes, lines 20-1871
20 i % 2 ? e(Object(n), !0).forEach((function(e) { 21 s(t, e, n[e]) 22 } 23 )) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : e(Object(n)).forEach((function(e) { 24 Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e)) 25 } 26 )) 27 } 28 return t 29 } 30 function i(e) { 31 return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { 32 return typeof e 33 } 34 : function(e) { 35 return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e 36 } 37 )(e) 38 } 39 function n(e, t) { 40 if (!(e instanceof t)) 41 throw new TypeError("Cannot call a class as a function") 42 } 43 function o(e, t) { 44 for (var i = 0; i < t.length; i++) { 45 var n = t[i]; 46 n.enumerable = n.enumerable || !1, 47 n.configurable = !0, 48 "value"in n && (n.writable = !0), 49 Object.defineProperty(e, y(n.key), n) 50 } 51 } 52 function r(e, t, i) { 53 return t && o(e.prototype, t), 54 i && o(e, i), 55 Object.defineProperty(e, "prototype", { 56 writable: !1 57 }), 58 e 59 } 60 function s(e, t, i) { 61 return (t = y(t))in e ? Object.defineProperty(e, t, { 62 value: i, 63 enumerable: !0, 64 configurable: !0, 65 writable: !0 66 }) : e[t] = i, 67 e 68 } 69 function a(e, t) { 70 if ("function" != typeof t && null !== t) 71 throw new TypeError("Super expression must either be null or a function"); 72 e.prototype = Object.create(t && t.prototype, { 73 constructor: { 74 value: e, 75 writable: !0, 76 configurable: !0 77 } 78 }), 79 Object.defineProperty(e, "prototype", { 80 writable: !1 81 }), 82 t && c(e, t) 83 } 84 function l(e) { 85 return (l = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { 86 return e.__proto__ || Object.getPrototypeOf(e) 87 } 88 )(e) 89 } 90 function c(e, t) { 91 return (c = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { 92 return e.__proto__ = t, 93 e 94 } 95 )(e, t) 96 } 97 function u(e) { 98 if (void 0 === e) 99 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 100 return e 101 } 102 function h(e, t) { 103 if (t && ("object" == typeof t || "function" == typeof t)) 104 return t; 105 if (void 0 !== t) 106 throw new TypeError("Derived constructors may only return object or undefined"); 107 return u(e) 108 } 109 function d(e) { 110 var t = function() { 111 if ("undefined" == typeof Reflect || !Reflect.construct) 112 return !1; 113 if (Reflect.construct.sham) 114 return !1; 115 if ("function" == typeof Proxy) 116 return !0; 117 try { 118 return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {} 119 ))), 120 !0 121 } catch (e) { 122 return !1 123 } 124 }(); 125 return function() { 126 var i, n = l(e); 127 if (t) { 128 var o = l(this).constructor; 129 i = Reflect.construct(n, arguments, o) 130 } else 131 i = n.apply(this, arguments); 132 return h(this, i) 133 } 134 } 135 function f(e, t) { 136 for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = l(e)); ) 137 ; 138 return e 139 } 140 function p() { 141 return p = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, i) { 142 var n = f(e, t); 143 if (n) { 144 var o = Object.getOwnPropertyDescriptor(n, t); 145 return o.get ? o.get.call(arguments.length < 3 ? e : i) : o.value 146 } 147 } 148 , 149 p.apply(this, arguments) 150 } 151 function g(e) { 152 return function(e) { 153 if (Array.isArray(e)) 154 return v(e) 155 }(e) || function(e) { 156 if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) 157 return Array.from(e) 158 }(e) || function(e, t) { 159 if (!e) 160 return; 161 if ("string" == typeof e) 162 return v(e, t); 163 var i = Object.prototype.toString.call(e).slice(8, -1); 164 "Object" === i && e.constructor && (i = e.constructor.name); 165 if ("Map" === i || "Set" === i) 166 return Array.from(e); 167 if ("Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) 168 return v(e, t) 169 }(e) || function() { 170 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") 171 }() 172 } 173 function v(e, t) { 174 (null == t || t > e.length) && (t = e.length); 175 for (var i = 0, n = new Array(t); i < t; i++) 176 n[i] = e[i]; 177 return n 178 } 179 function y(e) { 180 var t = function(e, t) { 181 if ("object" != typeof e || null === e) 182 return e; 183 var i = e[Symbol.toPrimitive]; 184 if (void 0 !== i) { 185 var n = i.call(e, t || "default"); 186 if ("object" != typeof n) 187 return n; 188 throw new TypeError("@@toPrimitive must return a primitive value.") 189 } 190 return ("string" === t ? String : Number)(e) 191 }(e, "string"); 192 return "symbol" == typeof t ? t : String(t) 193 } 194 "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self; 195 var m = { 196 exports: {} 197 }; 198 !function(e) { 199 var t = Object.prototype.hasOwnProperty 200 , i = "~"; 201 function n() {} 202 function o(e, t, i) { 203 this.fn = e, 204 this.context = t, 205 this.once = i || !1 206 } 207 function r(e, t, n, r, s) { 208 if ("function" != typeof n) 209 throw new TypeError("The listener must be a function"); 210 var a = new o(n,r || e,s) 211 , l = i ? i + t : t; 212 return e._events[l] ? e._events[l].fn ? e._events[l] = [e._events[l], a] : e._events[l].push(a) : (e._events[l] = a, 213 e._eventsCount++), 214 e 215 } 216 function s(e, t) { 217 0 == --e._eventsCount ? e._events = new n : delete e._events[t] 218 } 219 function a() { 220 this._events = new n, 221 this._eventsCount = 0 222 } 223 Object.create && (n.prototype = Object.create(null), 224 (new n).__proto__ || (i = !1)), 225 a.prototype.eventNames = function() { 226 var e, n, o = []; 227 if (0 === this._eventsCount) 228 return o; 229 for (n in e = this._events) 230 t.call(e, n) && o.push(i ? n.slice(1) : n); 231 return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(e)) : o 232 } 233 , 234 a.prototype.listeners = function(e) { 235 var t = i ? i + e : e 236 , n = this._events[t]; 237 if (!n) 238 return []; 239 if (n.fn) 240 return [n.fn]; 241 for (var o = 0, r = n.length, s = new Array(r); o < r; o++) 242 s[o] = n[o].fn; 243 return s 244 } 245 , 246 a.prototype.listenerCount = function(e) { 247 var t = i ? i + e : e 248 , n = this._events[t]; 249 return n ? n.fn ? 1 : n.length : 0 250 } 251 , 252 a.prototype.emit = function(e, t, n, o, r, s) { 253 var a = i ? i + e : e; 254 if (!this._events[a]) 255 return !1; 256 var l, c, u = this._events[a], h = arguments.length; 257 if (u.fn) { 258 switch (u.once && this.removeListener(e, u.fn, void 0, !0), 259 h) { 260 case 1: 261 return u.fn.call(u.context), 262 !0; 263 case 2: 264 return u.fn.call(u.context, t), 265 !0; 266 case 3: 267 return u.fn.call(u.context, t, n), 268 !0; 269 case 4: 270 return u.fn.call(u.context, t, n, o), 271 !0; 272 case 5: 273 return u.fn.call(u.context, t, n, o, r), 274 !0; 275 case 6: 276 return u.fn.call(u.context, t, n, o, r, s), 277 !0 278 } 279 for (c = 1, 280 l = new Array(h - 1); c < h; c++) 281 l[c - 1] = arguments[c]; 282 u.fn.apply(u.context, l) 283 } else { 284 var d, f = u.length; 285 for (c = 0; c < f; c++) 286 switch (u[c].once && this.removeListener(e, u[c].fn, void 0, !0), 287 h) { 288 case 1: 289 u[c].fn.call(u[c].context); 290 break; 291 case 2: 292 u[c].fn.call(u[c].context, t); 293 break; 294 case 3: 295 u[c].fn.call(u[c].context, t, n); 296 break; 297 case 4: 298 u[c].fn.call(u[c].context, t, n, o); 299 break; 300 default: 301 if (!l) 302 for (d = 1, 303 l = new Array(h - 1); d < h; d++) 304 l[d - 1] = arguments[d]; 305 u[c].fn.apply(u[c].context, l) 306 } 307 } 308 return !0 309 } 310 , 311 a.prototype.on = function(e, t, i) { 312 return r(this, e, t, i, !1) 313 } 314 , 315 a.prototype.once = function(e, t, i) { 316 return r(this, e, t, i, !0) 317 } 318 , 319 a.prototype.removeListener = function(e, t, n, o) { 320 var r = i ? i + e : e; 321 if (!this._events[r]) 322 return this; 323 if (!t) 324 return s(this, r), 325 this; 326 var a = this._events[r]; 327 if (a.fn) 328 a.fn !== t || o && !a.once || n && a.context !== n || s(this, r); 329 else { 330 for (var l = 0, c = [], u = a.length; l < u; l++) 331 (a[l].fn !== t || o && !a[l].once || n && a[l].context !== n) && c.push(a[l]); 332 c.length ? this._events[r] = 1 === c.length ? c[0] : c : s(this, r) 333 } 334 return this 335 } 336 , 337 a.prototype.removeAllListeners = function(e) { 338 var t; 339 return e ? (t = i ? i + e : e, 340 this._events[t] && s(this, t)) : (this._events = new n, 341 this._eventsCount = 0), 342 this 343 } 344 , 345 a.prototype.off = a.prototype.removeListener, 346 a.prototype.addListener = a.prototype.on, 347 a.prefixed = i, 348 a.EventEmitter = a, 349 e.exports = a 350 }(m); 351 var k = m.exports 352 , b = "undefined" != typeof window && window.location && window.location.href.indexOf("xgplayerdebugger=1") > -1 353 , C = { 354 info: "color: #525252; background-color: #90ee90;", 355 error: "color: #525252; background-color: red;", 356 warn: "color: #525252; background-color: yellow; " 357 } 358 , _ = "%c[xgplayer]" 359 , w = { 360 config: { 361 debug: b ? 3 : 0 362 }, 363 logInfo: function(e) { 364 for (var t, i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++) 365 n[o - 1] = arguments[o]; 366 this.config.debug >= 3 && (t = console).log.apply(t, [_, C.info, e].concat(n)) 367 }, 368 logWarn: function(e) { 369 for (var t, i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++) 370 n[o - 1] = arguments[o]; 371 this.config.debug >= 1 && (t = console).warn.apply(t, [_, C.warn, e].concat(n)) 372 }, 373 logError: function(e) { 374 var t; 375 if (!(this.config.debug < 1)) { 376 for (var i = this.config.debug >= 2 ? "trace" : "error", n = arguments.length, o = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) 377 o[r - 1] = arguments[r]; 378 (t = console)[i].apply(t, [_, C.error, e].concat(o)) 379 } 380 } 381 }; 382 var T = function() { 383 function e(t) { 384 n(this, e), 385 this.bufferedList = t 386 } 387 return r(e, [{ 388 key: "start", 389 value: function(e) { 390 return this.bufferedList[e].start 391 } 392 }, { 393 key: "end", 394 value: function(e) { 395 return this.bufferedList[e].end 396 } 397 }, { 398 key: "length", 399 get: function() { 400 return this.bufferedList.length 401 } 402 }]), 403 e 404 }() 405 , x = {}; 406 function E(e, t) { 407 for (var i = 0, n = t.length; i < n; i++) 408 if (e.indexOf(t[i]) > -1) 409 return !0; 410 return !1 411 } 412 function S(e) { 413 var t = i(e); 414 return null !== e && ("object" === t || "function" === t) 415 } 416 function P(e, t, i) { 417 var n, o, r, s, a, l, c = 0, u = !1, h = !1, d = !0, f = !t && 0 !== t && "function" == typeof window.requestAnimationFrame; 418 if ("function" != typeof e) 419 throw new TypeError("Expected a function"); 420 function p(t) { 421 var i = n 422 , r = o; 423 return n = o = void 0, 424 c = t, 425 s = e.apply(r, i) 426 } 427 function g(e, t) { 428 return f ? (window.cancelAnimationFrame(a), 429 window.requestAnimationFrame(e)) : setTimeout(e, t) 430 } 431 function v(e) { 432 return c = e, 433 a = g(m, t), 434 u ? p(e) : s 435 } 436 function y(e) { 437 var i = e - l; 438 return void 0 === l || i >= t || i < 0 || h && e - c >= r 439 } 440 function m() { 441 var e = Date.now(); 442 if (y(e)) 443 return k(e); 444 a = g(m, function(e) { 445 var i = e - c 446 , n = t - (e - l); 447 return h ? Math.min(n, r - i) : n 448 }(e)) 449 } 450 function k(e) { 451 return a = void 0, 452 d && n ? p(e) : (n = o = void 0, 453 s) 454 } 455 function b() { 456 for (var e = Date.now(), i = y(e), r = arguments.length, c = new Array(r), u = 0; u < r; u++) 457 c[u] = arguments[u]; 458 if (n = c, 459 o = this, 460 l = e, 461 i) { 462 if (void 0 === a) 463 return v(l); 464 if (h) 465 return a = g(m, t), 466 p(l) 467 } 468 return void 0 === a && (a = g(m, t)), 469 s 470 } 471 return t = +t || 0, 472 S(i) && (u = !!i.leading, 473 r = (h = "maxWait"in i) ? Math.max(+i.maxWait || 0, t) : r, 474 d = "trailing"in i ? !!i.trailing : d), 475 b.cancel = function() { 476 void 0 !== a && function(e) { 477 if (f) 478 return window.cancelAnimationFrame(e); 479 clearTimeout(e) 480 }(a), 481 c = 0, 482 n = l = o = a = void 0 483 } 484 , 485 b.flush = function() { 486 return void 0 === a ? s : k(Date.now()) 487 } 488 , 489 b.pending = function() { 490 return void 0 !== a 491 } 492 , 493 b 494 } 495 x.createDom = function() { 496 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div" 497 , t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "" 498 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {} 499 , n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "" 500 , o = document.createElement(e); 501 return o.className = n, 502 o.innerHTML = t, 503 Object.keys(i).forEach((function(t) { 504 var n = t 505 , r = i[t]; 506 "video" === e || "audio" === e || "live-video" === e ? r && o.setAttribute(n, r) : o.setAttribute(n, r) 507 } 508 )), 509 o 510 } 511 , 512 x.createDomFromHtml = function(e) { 513 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {} 514 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ""; 515 try { 516 var n = document.createElement("div"); 517 n.innerHTML = e; 518 var o = n.children; 519 return n = null, 520 o.length > 0 ? (o = o[0], 521 i && x.addClass(o, i), 522 t && Object.keys(t).forEach((function(e) { 523 o.setAttribute(e, t[e]) 524 } 525 )), 526 o) : null 527 } catch (r) { 528 return w.logError("util.createDomFromHtml", r), 529 null 530 } 531 } 532 , 533 x.hasClass = function(e, t) { 534 if (!e || !t) 535 return !1; 536 try { 537 return Array.prototype.some.call(e.classList, (function(e) { 538 return e === t 539 } 540 )) 541 } catch (o) { 542 var n = e.className && "object" === i(e.className) ? e.getAttribute("class") : e.className; 543 return n && !!n.match(new RegExp("(\\s|^)" + t + "(\\s|$)")) 544 } 545 } 546 , 547 x.addClass = function(e, t) { 548 if (e && t) 549 try { 550 t.replace(/(^\s+|\s+$)/g, "").split(/\s+/g).forEach((function(t) { 551 t && e.classList.add(t) 552 } 553 )) 554 } catch (n) { 555 x.hasClass(e, t) || (e.className && "object" === i(e.className) ? e.setAttribute("class", e.getAttribute("class") + " " + t) : e.className += " " + t) 556 } 557 } 558 , 559 x.removeClass = function(e, t) { 560 if (e && t) 561 try { 562 t.replace(/(^\s+|\s+$)/g, "").split(/\s+/g).forEach((function(t) { 563 t && e.classList.remove(t) 564 } 565 )) 566 } catch (n) { 567 x.hasClass(e, t) && t.split(/\s+/g).forEach((function(t) { 568 var n = new RegExp("(\\s|^)" + t + "(\\s|$)"); 569 e.className && "object" === i(e.className) ? e.setAttribute("class", e.getAttribute("class").replace(n, " ")) : e.className = e.className.replace(n, " ") 570 } 571 )) 572 } 573 } 574 , 575 x.toggleClass = function(e, t) { 576 e && t.split(/\s+/g).forEach((function(t) { 577 x.hasClass(e, t) ? x.removeClass(e, t) : x.addClass(e, t) 578 } 579 )) 580 } 581 , 582 x.classNames = function() { 583 for (var e = arguments, t = [], i = function(i) { 584 "String" === x.typeOf(e[i]) ? t.push(e[i]) : "Object" === x.typeOf(e[i]) && Object.keys(e[i]).map((function(n) { 585 e[i][n] && t.push(n) 586 } 587 )) 588 }, n = 0; n < arguments.length; n++) 589 i(n); 590 return t.join(" ") 591 } 592 , 593 x.findDom = function() { 594 var e, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : document, i = arguments.length > 1 ? arguments[1] : void 0; 595 try { 596 e = t.querySelector(i) 597 } catch (n) { 598 w.logError("util.findDom", n), 599 0 === i.indexOf("#") && (e = t.getElementById(i.slice(1))) 600 } 601 return e 602 } 603 , 604 x.getCss = function(e, t) { 605 return e.currentStyle ? e.currentStyle[t] : document.defaultView.getComputedStyle(e, !1)[t] 606 } 607 , 608 x.padStart = function(e, t, i) { 609 for (var n = String(i), o = t >> 0, r = Math.ceil(o / n.length), s = [], a = String(e); r--; ) 610 s.push(n); 611 return s.join("").substring(0, o - a.length) + a 612 } 613 , 614 x.format = function(e) { 615 if (window.isNaN(e)) 616 return ""; 617 e = Math.round(e); 618 var t = x.padStart(Math.floor(e / 3600), 2, 0) 619 , i = x.padStart(Math.floor((e - 3600 * t) / 60), 2, 0) 620 , n = x.padStart(Math.floor(e - 3600 * t - 60 * i), 2, 0); 621 return ("00" === t ? [i, n] : [t, i, n]).join(":") 622 } 623 , 624 x.event = function(e) { 625 if (e.touches) { 626 var t = e.touches[0] || e.changedTouches[0]; 627 e.clientX = t.clientX || 0, 628 e.clientY = t.clientY || 0, 629 e.offsetX = t.pageX - t.target.offsetLeft, 630 e.offsetY = t.pageY - t.target.offsetTop 631 } 632 e._target = e.target || e.srcElement 633 } 634 , 635 x.typeOf = function(e) { 636 return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0] 637 } 638 , 639 x.deepCopy = function(e, t) { 640 if ("Object" === x.typeOf(t) && "Object" === x.typeOf(e)) 641 return Object.keys(t).forEach((function(i) { 642 "Object" !== x.typeOf(t[i]) || t[i]instanceof Node ? "Array" === x.typeOf(t[i]) ? e[i] = "Array" === x.typeOf(e[i]) ? e[i].concat(t[i]) : t[i] : e[i] = t[i] : void 0 === e[i] || void 0 === e[i] ? e[i] = t[i] : x.deepCopy(e[i], t[i]) 643 } 644 )), 645 e 646 } 647 , 648 x.deepMerge = function(e, t) { 649 return Object.keys(t).map((function(i) { 650 var n; 651 "Array" === x.typeOf(t[i]) && "Array" === x.typeOf(e[i]) ? "Array" === x.typeOf(e[i]) && (n = e[i]).push.apply(n, g(t[i])) : x.typeOf(e[i]) !== x.typeOf(t[i]) || null === e[i] || "Object" !== x.typeOf(e[i]) || t[i]instanceof window.Node ? null !== t[i] && (e[i] = t[i]) : x.deepMerge(e[i], t[i]) 652 } 653 )), 654 e 655 } 656 , 657 x.getBgImage = function(e) { 658 var t = (e.currentStyle || window.getComputedStyle(e, null)).backgroundImage; 659 if (!t || "none" === t) 660 return ""; 661 var i = document.createElement("a"); 662 return i.href = t.replace(/url\("|"\)/g, ""), 663 i.href 664 } 665 , 666 x.copyDom = function(e) { 667 if (e && 1 === e.nodeType) { 668 var t = document.createElement(e.tagName); 669 return Array.prototype.forEach.call(e.attributes, (function(e) { 670 t.setAttribute(e.name, e.value) 671 } 672 )), 673 e.innerHTML && (t.innerHTML = e.innerHTML), 674 t 675 } 676 return "" 677 } 678 , 679 x.setInterval = function(e, t, i, n) { 680 e._interval[t] || (e._interval[t] = window.setInterval(i.bind(e), n)) 681 } 682 , 683 x.clearInterval = function(e, t) { 684 clearInterval(e._interval[t]), 685 e._interval[t] = null 686 } 687 , 688 x.setTimeout = function(e, t, i) { 689 e._timers || (e._timers = []); 690 var n = setTimeout((function() { 691 t(), 692 x.clearTimeout(e, n) 693 } 694 ), i); 695 return e._timers.push(n), 696 n 697 } 698 , 699 x.clearTimeout = function(e, t) { 700 var i = e._timers; 701 if ("Array" === x.typeOf(i)) { 702 for (var n = 0; n < i.length; n++) 703 if (i[n] === t) { 704 i.splice(n, 1), 705 clearTimeout(t); 706 break 707 } 708 } else 709 clearTimeout(t) 710 } 711 , 712 x.clearAllTimers = function(e) { 713 var t = e._timers; 714 "Array" === x.typeOf(t) && (t.map((function(e) { 715 clearTimeout(e) 716 } 717 )), 718 e._timerIds = []) 719 } 720 , 721 x.createImgBtn = function(e, t, i, n) { 722 var o, r, s, a = x.createDom("xg-".concat(e), "", {}, "xgplayer-".concat(e, "-img")); 723 (a.style.backgroundImage = 'url("'.concat(t, '")'), 724 i && n) && (["px", "rem", "em", "pt", "dp", "vw", "vh", "vm", "%"].every((function(e) { 725 return !(i.indexOf(e) > -1 && n.indexOf(e) > -1) || (o = parseFloat(i.slice(0, i.indexOf(e)).trim()), 726 r = parseFloat(n.slice(0, n.indexOf(e)).trim()), 727 s = e, 728 !1) 729 } 730 )), 731 a.style.width = "".concat(o).concat(s), 732 a.style.height = "".concat(r).concat(s), 733 a.style.backgroundSize = "".concat(o).concat(s, " ").concat(r).concat(s), 734 a.style.margin = "start" === e ? "-".concat(r / 2).concat(s, " auto auto -").concat(o / 2).concat(s) : "auto 5px auto 5px"); 735 return a 736 } 737 , 738 x.Hex2RGBA = function(e, t) { 739 var i = []; 740 if (/^\#[0-9A-F]{3}$/i.test(e)) { 741 var n = "#"; 742 e.replace(/[0-9A-F]/gi, (function(e) { 743 n += e + e 744 } 745 )), 746 e = n 747 } 748 return /^#[0-9A-F]{6}$/i.test(e) ? (e.replace(/[0-9A-F]{2}/gi, (function(e) { 749 i.push(parseInt(e, 16)) 750 } 751 )), 752 "rgba(".concat(i.join(","), ", ").concat(t, ")")) : "rgba(255, 255, 255, 0.1)" 753 } 754 , 755 x.getFullScreenEl = function() { 756 return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement 757 } 758 , 759 x.checkIsFunction = function(e) { 760 return e && "function" == typeof e 761 } 762 , 763 x.checkIsObject = function(e) { 764 return null !== e && "object" === i(e) 765 } 766 , 767 x.hide = function(e) { 768 e.style.display = "none" 769 } 770 , 771 x.show = function(e, t) { 772 e.style.display = t || "block" 773 } 774 , 775 x.isUndefined = function(e) { 776 if (null == e) 777 return !0 778 } 779 , 780 x.isNotNull = function(e) { 781 return !(null == e) 782 } 783 , 784 x.setStyleFromCsstext = function(e, t) { 785 t && ("String" === x.typeOf(t) ? t.replace(/\s+/g, "").split(";").map((function(t) { 786 if (t) { 787 var i = t.split(":"); 788 i.length > 1 && (e.style[i[0]] = i[1]) 789 } 790 } 791 )) : Object.keys(t).map((function(i) { 792 e.style[i] = t[i] 793 } 794 ))) 795 } 796 , 797 x.filterStyleFromText = function(e) { 798 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ["width", "height", "top", "left", "bottom", "right", "position", "z-index", "padding", "margin", "transform"] 799 , i = e.style.cssText; 800 if (!i) 801 return {}; 802 var n = i.replace(/\s+/g, "").split(";") 803 , o = {} 804 , r = {}; 805 return n.map((function(e) { 806 if (e) { 807 var i = e.split(":"); 808 i.length > 1 && (E(i[0], t) ? o[i[0]] = i[1] : r[i[0]] = i[1]) 809 } 810 } 811 )), 812 e.setAttribute("style", ""), 813 Object.keys(r).map((function(t) { 814 e.style[t] = r[t] 815 } 816 )), 817 o 818 } 819 , 820 x.getStyleFromCsstext = function(e) { 821 var t = e.style.cssText; 822 if (!t) 823 return {}; 824 var i = t.replace(/\s+/g, "").split(";") 825 , n = {}; 826 return i.map((function(e) { 827 if (e) { 828 var t = e.split(":"); 829 t.length > 1 && (n[t[0]] = t[1]) 830 } 831 } 832 )), 833 n 834 } 835 , 836 x.preloadImg = function(e) { 837 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function() {} 838 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function() {} 839 ; 840 if (e) { 841 var n = new window.Image; 842 n.onload = function(e) { 843 n = null, 844 t && t(e) 845 } 846 , 847 n.onerror = function(e) { 848 n = null, 849 i && i(e) 850 } 851 , 852 n.src = e 853 } 854 } 855 , 856 x.stopPropagation = function(e) { 857 e && (e.stopPropagation(), 858 e.cancelable && e.preventDefault()) 859 } 860 , 861 x.scrollTop = function() { 862 return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 863 } 864 , 865 x.scrollLeft = function() { 866 return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0 867 } 868 , 869 x.checkTouchSupport = function() { 870 return "ontouchstart"in window 871 } 872 , 873 x.getBuffered2 = function(e) { 874 for (var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .5, i = [], n = 0; n < e.length; n++) 875 i.push({ 876 start: e.start(n) < .5 ? 0 : e.start(n), 877 end: e.end(n) 878 }); 879 i.sort((function(e, t) { 880 var i = e.start - t.start; 881 return i || t.end - e.end 882 } 883 )); 884 var o = []; 885 if (t) 886 for (var r = 0; r < i.length; r++) { 887 var s = o.length; 888 if (s) { 889 var a = o[s - 1].end; 890 i[r].start - a < t ? i[r].end > a && (o[s - 1].end = i[r].end) : o.push(i[r]) 891 } else 892 o.push(i[r]) 893 } 894 else 895 o = i; 896 return new T(o) 897 } 898 , 899 x.getEventPos = function(e) { 900 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1; 901 return e.touches && e.touches.length > 0 && (e = e.touches[0]), 902 { 903 x: e.x / t, 904 y: e.y / t, 905 clientX: e.clientX / t, 906 clientY: e.clientY / t, 907 offsetX: e.offsetX / t, 908 offsetY: e.offsetY / t, 909 pageX: e.pageX / t, 910 pageY: e.pageY / t 911 } 912 } 913 , 914 x.requestAnimationFrame = function(e) { 915 var t = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame; 916 if (t) 917 return t(e) 918 } 919 , 920 x.getHostFromUrl = function(e) { 921 if ("String" !== x.typeOf(e)) 922 return ""; 923 var t = e.split("/") 924 , i = ""; 925 return t.length > 3 && t[2] && (i = t[2]), 926 i 927 } 928 , 929 x.cancelAnimationFrame = function(e) { 930 var t = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.cancelRequestAnimationFrame; 931 t && t(e) 932 } 933 , 934 x.isMSE = function(e) { 935 return !!(e && e instanceof HTMLMediaElement) && (/^blob/.test(e.currentSrc) || /^blob/.test(e.src)) 936 } 937 , 938 x.generateSessionId = function() { 939 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0 940 , t = (new Date).getTime(); 941 try { 942 e = parseInt(e) 943 } catch (n) { 944 e = 0 945 } 946 t += e, 947 window.performance && "function" == typeof window.performance.now && (t += parseInt(window.performance.now())); 948 var i = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(e) { 949 var i = (t + 16 * Math.random()) % 16 | 0; 950 return t = Math.floor(t / 16), 951 ("x" === e ? i : 3 & i | 8).toString(16) 952 } 953 )); 954 return i 955 } 956 , 957 x.createEvent = function(e) { 958 var t; 959 return "function" == typeof window.Event ? t = new Event(e) : (t = document.createEvent("Event")).initEvent(e, !0, !0), 960 t 961 } 962 , 963 x.adjustTimeByDuration = function(e, t, i) { 964 return t && e && (e > t || i && e < t) ? t : e 965 } 966 , 967 x.createPositionBar = function(e, t) { 968 var i = x.createDom("xg-bar", "", { 969 "data-index": -1 970 }, e); 971 return t.appendChild(i), 972 i 973 } 974 ; 975 var L = /(Android)\s([\d.]+)/ 976 , I = /(Version)\/([\d.]+)/ 977 , A = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"] 978 , O = { 979 get device() { 980 return O.os.isPc ? "pc" : "mobile" 981 }, 982 get browser() { 983 if ("undefined" == typeof navigator) 984 return ""; 985 var e = navigator.userAgent.toLowerCase() 986 , t = { 987 ie: /rv:([\d.]+)\) like gecko/, 988 firefox: /firefox\/([\d.]+)/, 989 chrome: /chrome\/([\d.]+)/, 990 opera: /opera.([\d.]+)/, 991 safari: /version\/([\d.]+).*safari/ 992 }; 993 return [].concat(Object.keys(t).filter((function(i) { 994 return t[i].test(e) 995 } 996 )))[0] 997 }, 998 get os() { 999 if ("undefined" == typeof navigator) 1000 return {}; 1001 var e = navigator.userAgent 1002 , t = /(?:Windows Phone)/.test(e) 1003 , i = /(?:SymbianOS)/.test(e) || t 1004 , n = /(?:Android)/.test(e) 1005 , o = /(?:Firefox)/.test(e) 1006 , r = /(?:iPad|PlayBook)/.test(e) || n && !/(?:Mobile)/.test(e) || o && /(?:Tablet)/.test(e) 1007 , s = /(?:iPhone)/.test(e) && !r 1008 , a = !(s || n || i || r) 1009 , l = /(?:iPad|PlayBook)/.test(e); 1010 return { 1011 isTablet: r, 1012 isPhone: s, 1013 isIpad: l, 1014 isIos: s || l, 1015 isAndroid: n, 1016 isPc: a, 1017 isSymbian: i, 1018 isWindowsPhone: t, 1019 isFireFox: o 1020 } 1021 }, 1022 get osVersion() { 1023 if ("undefined" == typeof navigator) 1024 return 0; 1025 var e = navigator.userAgent 1026 , t = "" 1027 , i = (t = /(?:iPhone)|(?:iPad|PlayBook)/.test(e) ? I : L) ? t.exec(e) : []; 1028 if (i && i.length >= 3) { 1029 var n = i[2].split("."); 1030 return n.length > 0 ? parseInt(n[0]) : 0 1031 } 1032 return 0 1033 }, 1034 get isWeixin() { 1035 if ("undefined" == typeof navigator) 1036 return !1; 1037 return !!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase()) 1038 }, 1039 isSupportMP4: function() { 1040 var e = { 1041 isSupport: !1, 1042 mime: "" 1043 }; 1044 if ("undefined" == typeof document) 1045 return e; 1046 if (this.supportResult) 1047 return this.supportResult; 1048 var t = document.createElement("video"); 1049 return "function" == typeof t.canPlayType && A.map((function(i) { 1050 "probably" === t.canPlayType('video/mp4; codecs="'.concat(i, '"')) && (e.isSupport = !0, 1051 e.mime += "||".concat(i)) 1052 } 1053 )), 1054 this.supportResult = e, 1055 t = null, 1056 e 1057 }, 1058 isHevcSupported: function() { 1059 return !("undefined" == typeof MediaSource || !MediaSource.isTypeSupported) && (MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"')) 1060 }, 1061 probeConfigSupported: function(e) { 1062 var t = { 1063 supported: !1, 1064 smooth: !1, 1065 powerEfficient: !1 1066 }; 1067 if (!e || "undefined" == typeof navigator) 1068 return Promise.resolve(t); 1069 if (navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo) 1070 return navigator.mediaCapabilities.decodingInfo(e); 1071 var i = e.video || {} 1072 , n = e.audio || {}; 1073 try { 1074 var o = MediaSource.isTypeSupported(i.contentType) 1075 , r = MediaSource.isTypeSupported(n.contentType); 1076 return Promise.resolve({ 1077 supported: o && r, 1078 smooth: !1, 1079 powerEfficient: !1 1080 }) 1081 } catch (s) { 1082 return Promise.resolve(t) 1083 } 1084 } 1085 } 1086 , R = "3.0.4" 1087 , D = { 1088 1: "media", 1089 2: "media", 1090 3: "media", 1091 4: "media", 1092 5: "media", 1093 6: "media" 1094 } 1095 , M = { 1096 1: 5101, 1097 2: 5102, 1098 3: 5103, 1099 4: 5104, 1100 5: 5105, 1101 6: 5106 1102 } 1103 , j = r((function e(t) { 1104 var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { 1105 errorType: "", 1106 errorCode: 0, 1107 errorMessage: "", 1108 originError: "", 1109 ext: {}, 1110 mediaError: null 1111 }; 1112 n(this, e); 1113 var o = t && t.i18n ? t.i18n.ERROR_TYPES : null; 1114 if (t.media) { 1115 var r = i.mediaError ? i.mediaError : t.media.error || {} 1116 , s = t.duration 1117 , a = t.currentTime 1118 , l = t.ended 1119 , c = t.src 1120 , u = t.currentSrc 1121 , h = t.media 1122 , d = h.readyState 1123 , f = h.networkState 1124 , p = i.errorCode || r.code; 1125 M[p] && (p = M[p]); 1126 var g = { 1127 playerVersion: R, 1128 currentTime: a, 1129 duration: s, 1130 ended: l, 1131 readyState: d, 1132 networkState: f, 1133 src: c || u, 1134 errorType: i.errorType, 1135 errorCode: p, 1136 message: i.errorMessage || r.message, 1137 mediaError: r, 1138 originError: i.originError ? i.originError.stack : "", 1139 host: x.getHostFromUrl(c || u) 1140 }; 1141 return i.ext && Object.keys(i.ext).map((function(e) { 1142 g[e] = i.ext[e] 1143 } 1144 )), 1145 g 1146 } 1147 if (arguments.length > 1) { 1148 for (var v = { 1149 playerVersion: R, 1150 domain: document.domain 1151 }, y = ["errorType", "currentTime", "duration", "networkState", "readyState", "src", "currentSrc", "ended", "errd", "errorCode", "mediaError"], m = 0; m < arguments.length; m++) 1152 v[y[m]] = arguments[m]; 1153 return v.ex = o ? (o[arguments[0]] || {}).msg : "", 1154 v 1155 } 1156 } 1157 )) 1158 , N = "play" 1159 , F = "playing" 1160 , H = "ended" 1161 , B = "pause" 1162 , U = "error" 1163 , V = "seeking" 1164 , G = "seeked" 1165 , W = "timeupdate" 1166 , q = "waiting" 1167 , z = "canplay" 1168 , K = "durationchange" 1169 , Y = "volumechange" 1170 , X = "loadeddata" 1171 , Z = "ratechange" 1172 , J = "progress" 1173 , $ = "loadstart" 1174 , Q = "emptied" 1175 , ee = "focus" 1176 , te = "blur" 1177 , ie = "ready" 1178 , ne = "urlNull" 1179 , oe = "autoplay_started" 1180 , re = "autoplay_was_prevented" 1181 , se = "complete" 1182 , ae = "replay" 1183 , le = "destroy" 1184 , ce = "urlchange" 1185 , ue = "download_speed_change" 1186 , he = "fullscreen_change" 1187 , de = "cssFullscreen_change" 1188 , fe = "mini_state_change" 1189 , pe = "definition_change" 1190 , ge = "after_definition_change" 1191 , ve = "video_resize" 1192 , ye = "pip_change" 1193 , me = "rotate" 1194 , ke = "screenShot" 1195 , be = "playnext" 1196 , Ce = "shortcut" 1197 , _e = "xglog" 1198 , we = "user_action" 1199 , Te = "reset" 1200 , xe = ["play", "playing", "ended", "pause", "error", "seeking", "seeked", "timeupdate", "waiting", "canplay", "canplaythrough", "durationchange", "volumechange", "loadeddata", "ratechange", "progress", "loadstart", "emptied", "stalled", "suspend", "abort", "lowdecode"] 1201 , Ee = { 1202 STATS_INFO: "stats_info", 1203 STATS_DOWNLOAD: "stats_download", 1204 STATS_RESET: "stats_reset" 1205 } 1206 , Se = "fps_stuck" 1207 , Pe = Object.freeze(Object.defineProperty({ 1208 __proto__: null, 1209 PLAY: N, 1210 PLAYING: F, 1211 ENDED: H, 1212 PAUSE: B, 1213 ERROR: U, 1214 SEEKING: V, 1215 SEEKED: G, 1216 TIME_UPDATE: W, 1217 WAITING: q, 1218 CANPLAY: z, 1219 CANPLAY_THROUGH: "canplaythrough", 1220 DURATION_CHANGE: K, 1221 VOLUME_CHANGE: Y, 1222 LOADED_DATA: X, 1223 RATE_CHANGE: Z, 1224 PROGRESS: J, 1225 LOAD_START: $, 1226 EMPTIED: Q, 1227 STALLED: "stalled", 1228 SUSPEND: "suspend", 1229 ABORT: "abort", 1230 BUFFER_CHANGE: "bufferedChange", 1231 PLAYER_FOCUS: ee, 1232 PLAYER_BLUR: te, 1233 READY: ie, 1234 URL_NULL: ne, 1235 AUTOPLAY_STARTED: oe, 1236 AUTOPLAY_PREVENTED: re, 1237 COMPLETE: se, 1238 REPLAY: ae, 1239 DESTROY: le, 1240 URL_CHANGE: ce, 1241 DOWNLOAD_SPEED_CHANGE: ue, 1242 FULLSCREEN_CHANGE: he, 1243 CSS_FULLSCREEN_CHANGE: de, 1244 MINI_STATE_CHANGE: fe, 1245 DEFINITION_CHANGE: pe, 1246 BEFORE_DEFINITION_CHANGE: "before_definition_change", 1247 AFTER_DEFINITION_CHANGE: ge, 1248 SEI_PARSED: "SEI_PARSED", 1249 RETRY: "retry", 1250 VIDEO_RESIZE: ve, 1251 PIP_CHANGE: ye, 1252 ROTATE: me, 1253 SCREEN_SHOT: ke, 1254 PLAYNEXT: be, 1255 SHORTCUT: Ce, 1256 XGLOG: _e, 1257 USER_ACTION: we, 1258 RESET: Te, 1259 SWITCH_SUBTITLE: "switch_subtitle", 1260 VIDEO_EVENTS: xe, 1261 STATS_EVENTS: Ee, 1262 FPS_STUCK: Se 1263 }, Symbol.toStringTag, { 1264 value: "Module" 1265 })); 1266 function Le(e, t) { 1267 this && this.emit && ("error" === e ? this.errorHandler(e, t.error) : this.emit(e, t)) 1268 } 1269 function Ie(e, t) { 1270 return function(i, n) { 1271 var o = { 1272 player: t, 1273 eventName: e, 1274 originalEvent: i, 1275 detail: i.detail || {}, 1276 timeStamp: i.timeStamp, 1277 currentTime: t.currentTime, 1278 duration: t.duration, 1279 paused: t.paused, 1280 ended: t.ended, 1281 isInternalOp: !!t._internalOp[i.type], 1282 muted: t.muted, 1283 volume: t.volume, 1284 host: x.getHostFromUrl(t.currentSrc), 1285 vtype: t.vtype 1286 }; 1287 if (t.removeInnerOP(i.type), 1288 "timeupdate" === e && (t._currentTime = t.media && t.media.currentTime), 1289 "ratechange" === e) { 1290 var r = t.media ? t.media.playbackRate : 0; 1291 if (r && t._rate === r) 1292 return; 1293 t._rate = t.media && t.media.playbackRate 1294 } 1295 if ("durationchange" === e && (t._duration = t.media.duration), 1296 "volumechange" === e && (o.isMutedChange = t._lastMuted !== t.muted, 1297 t._lastMuted = t.muted), 1298 "error" === e && (o.error = n || t.video.error), 1299 t.mediaEventMiddleware[e]) { 1300 var s = Le.bind(t, e, o); 1301 try { 1302 t.mediaEventMiddleware[e].call(t, o, s) 1303 } catch (a) { 1304 throw Le.call(t, e, o), 1305 a 1306 } 1307 } else 1308 Le.call(t, e, o) 1309 } 1310 } 1311 var Ae = function(e) { 1312 a(i, e); 1313 var t = d(i); 1314 function i(e) { 1315 var o; 1316 n(this, i), 1317 (o = t.call(this, e))._hasStart = !1, 1318 o._currentTime = 0, 1319 o._duration = 0, 1320 o._internalOp = {}, 1321 o._lastMuted = !1, 1322 o.vtype = "MP4", 1323 o._rate = -1, 1324 o.mediaConfig = Object.assign({}, { 1325 controls: !1, 1326 autoplay: e.autoplay, 1327 playsinline: e.playsinline, 1328 "x5-playsinline": e.playsinline, 1329 "webkit-playsinline": e.playsinline, 1330 "x5-video-player-fullscreen": e["x5-video-player-fullscreen"] || e.x5VideoPlayerFullscreen, 1331 "x5-video-orientation": e["x5-video-orientation"] || e.x5VideoOrientation, 1332 airplay: e.airplay, 1333 "webkit-airplay": e.airplay, 1334 tabindex: 0 | e.tabindex, 1335 mediaType: e.mediaType || "video" 1336 }, e.videoConfig, e.videoAttributes); 1337 var r = e["x5-video-player-type"] || e.x5VideoPlayerType; 1338 return O.isWeixin && O.os.isAndroid && r && (o.mediaConfig["x5-video-player-type"] = r, 1339 delete o.mediaConfig.playsinline, 1340 delete o.mediaConfig["webkit-playsinline"], 1341 delete o.mediaConfig["x5-playsinline"]), 1342 e.loop && (o.mediaConfig.loop = "loop"), 1343 o.media = x.createDom(o.mediaConfig.mediaType, "", o.mediaConfig, ""), 1344 e.defaultPlaybackRate && (o.media.defaultPlaybackRate = o.media.playbackRate = e.defaultPlaybackRate), 1345 "Number" === x.typeOf(e.volume) && (o.volume = e.volume), 1346 e.autoplayMuted && (o.media.muted = !0, 1347 o._lastMuted = !0), 1348 e.autoplay && (o.media.autoplay = !0), 1349 o._interval = {}, 1350 o.mediaEventMiddleware = {}, 1351 o.attachVideoEvents(), 1352 o 1353 } 1354 return r(i, [{ 1355 key: "setEventsMiddleware", 1356 value: function(e) { 1357 var t = this; 1358 Object.keys(e).map((function(i) { 1359 t.mediaEventMiddleware[i] = e[i] 1360 } 1361 )) 1362 } 1363 }, { 1364 key: "removeEventsMiddleware", 1365 value: function(e) { 1366 var t = this; 1367 Object.keys(e).map((function(e) { 1368 delete t.mediaEventMiddleware[e] 1369 } 1370 )) 1371 } 1372 }, { 1373 key: "attachVideoEvents", 1374 value: function() { 1375 var e = this 1376 , t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.media; 1377 this._evHandlers || (this._evHandlers = xe.map((function(t) { 1378 var i = "on".concat(t.charAt(0).toUpperCase()).concat(t.slice(1)); 1379 return "function" == typeof e[i] && e.on(t, e[i]), 1380 s({}, t, Ie(t, e)) 1381 } 1382 ))), 1383 this._evHandlers.forEach((function(e) { 1384 var i = Object.keys(e)[0]; 1385 t.addEventListener(i, e[i], !1) 1386 } 1387 )) 1388 } 1389 }, { 1390 key: "detachVideoEvents", 1391 value: function() { 1392 var e = this 1393 , t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.media; 1394 this._evHandlers.forEach((function(e) { 1395 var i = Object.keys(e)[0]; 1396 t.removeEventListener(i, e[i], !1) 1397 } 1398 )), 1399 this._evHandlers.forEach((function(t) { 1400 var i = Object.keys(t)[0] 1401 , n = "on".concat(i.charAt(0).toUpperCase()).concat(i.slice(1)); 1402 "function" == typeof e[n] && e.off(i, e[n]) 1403 } 1404 )), 1405 this._evHandlers = null 1406 } 1407 }, { 1408 key: "_attachSourceEvents", 1409 value: function(e, t) { 1410 var i = this; 1411 e.removeAttribute("src"), 1412 e.load(), 1413 t.forEach((function(e) { 1414 i.media.appendChild(x.createDom("source", "", { 1415 src: "".concat(e.src), 1416 type: "".concat(e.type || "") 1417 })) 1418 } 1419 )); 1420 var n = e.children; 1421 if (n) { 1422 this._videoSourceCount = n.length; 1423 for (var o = null, r = 0; r < this._evHandlers.length; r++) 1424 if ("error" === Object.keys(this._evHandlers[r])[0]) { 1425 o = this._evHandlers[r]; 1426 break 1427 } 1428 !this._sourceError && (this._sourceError = function(e) { 1429 if (i._videoSourceCount--, 1430 0 === i._videoSourceCount) { 1431 var t = { 1432 code: 4, 1433 message: "sources load error" 1434 }; 1435 o ? o.error(e, t) : i.errorHandler("error", t) 1436 } 1437 } 1438 ); 1439 for (var s = 0; s < n.length; s++) 1440 n[s].addEventListener("error", this._sourceError) 1441 } 1442 } 1443 }, { 1444 key: "_detachSourceEvents", 1445 value: function(e) { 1446 var t = e.children; 1447 if (t && 0 !== t.length && this._sourceError) { 1448 for (var i = 0; i < t.length; i++) 1449 t[i].removeEventListener("error", this._sourceError); 1450 for (; t.length > 0; ) 1451 e.removeChild(t[0]) 1452 } 1453 } 1454 }, { 1455 key: "errorHandler", 1456 value: function(e) { 1457 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null; 1458 if (this.media && (this.media.error || t)) { 1459 var i = this.media.error || t 1460 , n = i.code ? D[i.code] : "other"; 1461 i.message; 1462 this.media.currentSrc || (i = { 1463 code: 6, 1464 message: "empty_src" 1465 }), 1466 this.emit(e, new j(this,{ 1467 errorType: n, 1468 errorCode: i.code, 1469 errorMessage: i.message || "", 1470 mediaError: i 1471 })) 1472 } 1473 } 1474 }, { 1475 key: "destroy", 1476 value: function() { 1477 for (var e in this.media && (this.media.pause && (this.media.pause(), 1478 this.media.muted = !0), 1479 this.media.removeAttribute("src"), 1480 this.media.load()), 1481 this._currentTime = 0, 1482 this._duration = 0, 1483 this.mediaConfig = null, 1484 this._interval) 1485 Object.prototype.hasOwnProperty.call(this._interval, e) && (clearInterval(this._interval[e]), 1486 this._interval[e] = null); 1487 this.detachVideoEvents(), 1488 this.media = null, 1489 this.mediaEventMiddleware = {}, 1490 this.removeAllListeners() 1491 } 1492 }, { 1493 key: "video", 1494 get: function() { 1495 return this.media 1496 }, 1497 set: function(e) { 1498 this.media = e 1499 } 1500 }, { 1501 key: "play", 1502 value: function() { 1503 return this.media ? this.media.play() : null 1504 } 1505 }, { 1506 key: "pause", 1507 value: function() { 1508 this.media && this.media.pause() 1509 } 1510 }, { 1511 key: "load", 1512 value: function() { 1513 this.media && this.media.load() 1514 } 1515 }, { 1516 key: "canPlayType", 1517 value: function(e) { 1518 return !!this.media && this.media.canPlayType(e) 1519 } 1520 }, { 1521 key: "getBufferedRange", 1522 value: function(e) { 1523 var t = [0, 0]; 1524 if (!this.media) 1525 return t; 1526 e || (e = this.media.buffered); 1527 var i = this.media.currentTime; 1528 if (e) 1529 for (var n = 0, o = e.length; n < o && (t[0] = e.start(n), 1530 t[1] = e.end(n), 1531 !(t[0] <= i && i <= t[1])); n++) 1532 ; 1533 return t[0] - i <= 0 && i - t[1] <= 0 ? t : [0, 0] 1534 } 1535 }, { 1536 key: "autoplay", 1537 get: function() { 1538 return !!this.media && this.media.autoplay 1539 }, 1540 set: function(e) { 1541 this.media && (this.media.autoplay = e) 1542 } 1543 }, { 1544 key: "buffered", 1545 get: function() { 1546 return this.media ? this.media.buffered : null 1547 } 1548 }, { 1549 key: "buffered2", 1550 get: function() { 1551 return this.media && this.media.buffered ? x.getBuffered2(this.media.buffered) : null 1552 } 1553 }, { 1554 key: "bufferedPoint", 1555 get: function() { 1556 var e = { 1557 start: 0, 1558 end: 0 1559 }; 1560 if (!this.media) 1561 return e; 1562 var t = this.media.buffered; 1563 if (!t || 0 === t.length) 1564 return e; 1565 for (var i = 0; i < t.length; i++) 1566 if ((t.start(i) <= this.currentTime || t.start(i) < .1) && t.end(i) >= this.currentTime) 1567 return { 1568 start: t.start(i), 1569 end: t.end(i) 1570 }; 1571 return e 1572 } 1573 }, { 1574 key: "crossOrigin", 1575 get: function() { 1576 return this.media ? this.media.crossOrigin : "" 1577 }, 1578 set: function(e) { 1579 this.media && (this.media.crossOrigin = e) 1580 } 1581 }, { 1582 key: "currentSrc", 1583 get: function() { 1584 return this.media ? this.media.currentSrc : "" 1585 }, 1586 set: function(e) { 1587 this.media && (this.media.currentSrc = e) 1588 } 1589 }, { 1590 key: "currentTime", 1591 get: function() { 1592 return this.media ? void 0 !== this.media.currentTime ? this.media.currentTime : this._currentTime : 0 1593 }, 1594 set: function(e) { 1595 this.media && (this.media.currentTime = e) 1596 } 1597 }, { 1598 key: "defaultMuted", 1599 get: function() { 1600 return !!this.media && this.media.defaultMuted 1601 }, 1602 set: function(e) { 1603 this.media && (this.media.defaultMuted = e) 1604 } 1605 }, { 1606 key: "duration", 1607 get: function() { 1608 return this._duration 1609 } 1610 }, { 1611 key: "ended", 1612 get: function() { 1613 return !!this.media && this.media.ended 1614 } 1615 }, { 1616 key: "error", 1617 get: function() { 1618 return this.media.error 1619 } 1620 }, { 1621 key: "errorNote", 1622 get: function() { 1623 if (!this.media.error) 1624 return ""; 1625 return ["MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code - 1] 1626 } 1627 }, { 1628 key: "loop", 1629 get: function() { 1630 return !!this.media && this.media.loop 1631 }, 1632 set: function(e) { 1633 this.media && (this.media.loop = e) 1634 } 1635 }, { 1636 key: "muted", 1637 get: function() { 1638 return !!this.media && this.media.muted 1639 }, 1640 set: function(e) { 1641 this.media && this.media.muted !== e && (this._lastMuted = this.media.muted, 1642 this.media.muted = e) 1643 } 1644 }, { 1645 key: "networkState", 1646 get: function() { 1647 return this.media.networkState 1648 } 1649 }, { 1650 key: "paused", 1651 get: function() { 1652 return !this.media || this.media.paused 1653 } 1654 }, { 1655 key: "playbackRate", 1656 get: function() { 1657 return this.media ? this.media.playbackRate : 0 1658 }, 1659 set: function(e) { 1660 this.media && e !== 1 / 0 && (this.media.defaultPlaybackRate = e, 1661 this.media.playbackRate = e) 1662 } 1663 }, { 1664 key: "played", 1665 get: function() { 1666 return this.media ? this.media.played : null 1667 } 1668 }, { 1669 key: "preload", 1670 get: function() { 1671 return !!this.media && this.media.preload 1672 }, 1673 set: function(e) { 1674 this.media && (this.media.preload = e) 1675 } 1676 }, { 1677 key: "readyState", 1678 get: function() { 1679 return this.media.readyState 1680 } 1681 }, { 1682 key: "seekable", 1683 get: function() { 1684 return !!this.media && this.media.seekable 1685 } 1686 }, { 1687 key: "seeking", 1688 get: function() { 1689 return !!this.media && this.media.seeking 1690 } 1691 }, { 1692 key: "src", 1693 get: function() { 1694 return this.media ? this.media.src : "" 1695 }, 1696 set: function(e) { 1697 this.media && (this.emit(ce, e), 1698 this.emit(q), 1699 this._currentTime = 0, 1700 this._duration = 0, 1701 /^blob/.test(this.media.currentSrc) || /^blob/.test(this.media.src) ? this.onWaiting() : (this._detachSourceEvents(this.media), 1702 "Array" === x.typeOf(e) ? this._attachSourceEvents(this.media, e) : e ? this.media.src = e : this.media.removeAttribute("src"), 1703 this.load())) 1704 } 1705 }, { 1706 key: "volume", 1707 get: function() { 1708 return this.media ? this.media.volume : 0 1709 }, 1710 set: function(e) { 1711 e !== 1 / 0 && this.media && (this.media.volume = e) 1712 } 1713 }, { 1714 key: "addInnerOP", 1715 value: function(e) { 1716 this._internalOp[e] = !0 1717 } 1718 }, { 1719 key: "removeInnerOP", 1720 value: function(e) { 1721 delete this._internalOp[e] 1722 } 1723 }, { 1724 key: "emit", 1725 value: function(e, t) { 1726 for (var n, o = arguments.length, r = new Array(o > 2 ? o - 2 : 0), s = 2; s < o; s++) 1727 r[s - 2] = arguments[s]; 1728 (n = p(l(i.prototype), "emit", this)).call.apply(n, [this, e, t].concat(r)) 1729 } 1730 }, { 1731 key: "on", 1732 value: function(e, t) { 1733 for (var n, o = arguments.length, r = new Array(o > 2 ? o - 2 : 0), s = 2; s < o; s++) 1734 r[s - 2] = arguments[s]; 1735 (n = p(l(i.prototype), "on", this)).call.apply(n, [this, e, t].concat(r)) 1736 } 1737 }, { 1738 key: "once", 1739 value: function(e, t) { 1740 for (var n, o = arguments.length, r = new Array(o > 2 ? o - 2 : 0), s = 2; s < o; s++) 1741 r[s - 2] = arguments[s]; 1742 (n = p(l(i.prototype), "once", this)).call.apply(n, [this, e, t].concat(r)) 1743 } 1744 }, { 1745 key: "off", 1746 value: function(e, t) { 1747 for (var n, o = arguments.length, r = new Array(o > 2 ? o - 2 : 0), s = 2; s < o; s++) 1748 r[s - 2] = arguments[s]; 1749 (n = p(l(i.prototype), "off", this)).call.apply(n, [this, e, t].concat(r)) 1750 } 1751 }, { 1752 key: "offAll", 1753 value: function() { 1754 p(l(i.prototype), "removeAllListeners", this).call(this) 1755 } 1756 }]), 1757 i 1758 }(k) 1759 , Oe = function() { 1760 function e() { 1761 var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { 1762 name: "xgplayer", 1763 version: 1, 1764 db: null, 1765 ojstore: { 1766 name: "xg-m4a", 1767 keypath: "vid" 1768 } 1769 }; 1770 n(this, e), 1771 this.indexedDB = window.indexedDB || window.webkitindexedDB, 1772 this.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange, 1773 this.myDB = t 1774 } 1775 return r(e, [{ 1776 key: "openDB", 1777 value: function(e) { 1778 var t = this 1779 , i = this 1780 , n = this.myDB.version || 1 1781 , o = i.indexedDB.open(i.myDB.name, n); 1782 o.onerror = function(e) {} 1783 , 1784 o.onsuccess = function(n) { 1785 t.myDB.db = n.target.result, 1786 e.call(i) 1787 } 1788 , 1789 o.onupgradeneeded = function(e) { 1790 var t = e.target.result; 1791 e.target.transaction, 1792 t.objectStoreNames.contains(i.myDB.ojstore.name) || t.createObjectStore(i.myDB.ojstore.name, { 1793 keyPath: i.myDB.ojstore.keypath 1794 }) 1795 } 1796 } 1797 }, { 1798 key: "deletedb", 1799 value: function() { 1800 this.indexedDB.deleteDatabase(this.myDB.name) 1801 } 1802 }, { 1803 key: "closeDB", 1804 value: function() { 1805 this.myDB.db.close() 1806 } 1807 }, { 1808 key: "addData", 1809 value: function(e, t) { 1810 for (var i, n = this.myDB.db.transaction(e, "readwrite").objectStore(e), o = 0; o < t.length; o++) 1811 (i = n.add(t[o])).onerror = function() {} 1812 , 1813 i.onsuccess = function() {} 1814 } 1815 }, { 1816 key: "putData", 1817 value: function(e, t) { 1818 for (var i, n = this.myDB.db.transaction(e, "readwrite").objectStore(e), o = 0; o < t.length; o++) 1819 (i = n.put(t[o])).onerror = function() {} 1820 , 1821 i.onsuccess = function() {} 1822 } 1823 }, { 1824 key: "getDataByKey", 1825 value: function(e, t, i) { 1826 var n = this 1827 , o = this.myDB.db.transaction(e, "readwrite").objectStore(e).get(t); 1828 o.onerror = function() { 1829 i.call(n, null) 1830 } 1831 , 1832 o.onsuccess = function(e) { 1833 var t = e.target.result; 1834 i.call(n, t) 1835 } 1836 } 1837 }, { 1838 key: "deleteData", 1839 value: function(e, t) { 1840 this.myDB.db.transaction(e, "readwrite").objectStore(e).delete(t) 1841 } 1842 }, { 1843 key: "clearData", 1844 value: function(e) { 1845 this.myDB.db.transaction(e, "readwrite").objectStore(e).clear() 1846 } 1847 }]), 1848 e 1849 }() 1850 , Re = ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"] 1851 , De = ["requestFullscreen", "webkitRequestFullscreen", "mozRequestFullScreen", "msRequestFullscreen"] 1852 , Me = ["exitFullscreen", "webkitExitFullscreen", "mozCancelFullScreen", "msExitFullscreen"] 1853 , je = "data-xgplayerid"; 1854 function Ne(e, t, i) { 1855 for (var n = arguments.length, o = new Array(n > 3 ? n - 3 : 0), r = 3; r < n; r++) 1856 o[r - 3] = arguments[r]; 1857 var s = t.call.apply(t, [e].concat(o)); 1858 i && "function" == typeof i && (s && s.then ? s.then((function() { 1859 for (var t = arguments.length, n = new Array(t), o = 0; o < t; o++) 1860 n[o] = arguments[o]; 1861 i.call.apply(i, [e].concat(n)) 1862 } 1863 )) : i.call.apply(i, [e].concat(o))) 1864 } 1865 function Fe(e, t) { 1866 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { 1867 pre: null, 1868 next: null 1869 }; 1870 return this.__hooks || (this.__hooks = {}), 1871 !this.__hooks[e] && (this.__hooks[e] = null),
1872 function() { 1873 var n = arguments 1874 , o = this; 1875 if (i.pre) 1876 try { 1877 var r; 1878 (r = i.pre).call.apply(r, [this].concat(Array.prototype.slice.call(arguments))) 1879 } catch (l) { 1880 throw l.message = "[pluginName: ".concat(this.pluginName, ":").concat(e, ":pre error] >> ").concat(l.message), 1881 l 1882 } 1883 if (this.__hooks && this.__hooks[e]) 1884 try { 1885 var s, a = (s = this.__hooks[e]).call.apply(s, [this, this].concat(Array.prototype.slice.call(arguments))); 1886 a ? a.then ? a.then((function(e) { 1887 !1 !== e && Ne.apply(void 0, [o, t, i.next].concat(g(n))) 1888 } 1889 )).catch((function(e) { 1890 throw e 1891 } 1892 )) : Ne.apply(void 0, [this, t, i.next].concat(Array.prototype.slice.call(arguments))) : void 0 === a && Ne.apply(void 0, [this, t, i.next].concat(Array.prototype.slice.call(arguments))) 1893 } catch (l) { 1894 throw l.message = "[pluginName: ".concat(this.pluginName, ":").concat(e, "] >> ").concat(l.message), 1895 l 1896 } 1897 else 1898 Ne.apply(void 0, [this, t, i.next].concat(Array.prototype.slice.call(arguments))) 1899 } 1900 .bind(this) 1901 } 1902 function He(e, t) { 1903 var i = this.__hooks; 1904 if (i) 1905 return i.hasOwnProperty(e) ? (i && (i[e] = t), 1906 !0) : (console.warn("has no supported hook which name [".concat(e, "]")), 1907 !1) 1908 } 1909 function Be(e, t) { 1910 var i = this.__hooks; 1911 i && delete i[e] 1912 } 1913 function Ue(e) { 1914 if (this.plugins && this.plugins[e.toLowerCase()]) { 1915 for (var t = this.plugins[e.toLowerCase()], i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++) 1916 n[o - 1] = arguments[o]; 1917 return t.useHooks && t.useHooks.apply(t, n) 1918 } 1919 } 1920 function Ve(e) { 1921 if (this.plugins && this.plugins[e.toLowerCase()]) { 1922 var t = this.plugins[e.toLowerCase()]; 1923 if (t) { 1924 for (var i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++) 1925 n[o - 1] = arguments[o]; 1926 return t.removeHooks && t.removeHooks.apply(t, n) 1927 } 1928 } 1929 } 1930 function Ge(e) { 1931 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; 1932 e.__hooks = {}, 1933 t && t.map((function(t) { 1934 e.__hooks[t] = null 1935 } 1936 )), 1937 Object.defineProperty(e, "hooks", { 1938 get: function() { 1939 return e.__hooks && Object.keys(e.__hooks).map((function(t) { 1940 if (e.__hooks[t]) 1941 return t 1942 } 1943 )) 1944 } 1945 }) 1946 } 1947 function We(e) { 1948 e.__hooks = null 1949 } 1950 function qe(e, t, i) { 1951 for (var n = arguments.length, o = new Array(n > 3 ? n - 3 : 0), r = 3; r < n; r++) 1952 o[r - 3] = arguments[r]; 1953 if (!e.__hooks || !e.__hooks[t]) 1954 return i.call.apply(i, [e, e].concat(o)); 1955 var s, a = (s = e.__hooks[t]).call.apply(s, [e, e].concat(o)); 1956 if (a && a.then) 1957 a.then((function(t) { 1958 return !1 === t ? null : i.call.apply(i, [e, e].concat(o)) 1959 } 1960 )).catch((function(e) { 1961 console.warn("[runHooks]".concat(t, " reject"), e.message) 1962 } 1963 )); 1964 else if (!1 !== a) 1965 return i.call.apply(i, [e, e].concat(o)) 1966 } 1967 function ze(e, t) { 1968 w.logError("[".concat(e, "] event or callback cant be undefined or null when call ").concat(t)) 1969 } 1970 var Ke = function() { 1971 function e(t) { 1972 n(this, e), 1973 x.checkIsFunction(this.beforeCreate) && this.beforeCreate(t), 1974 Ge(this), 1975 this.__args = t, 1976 this.__events = {}, 1977 this.__onceEvents = {}, 1978 this.config = t.config || {}, 1979 this.player = null, 1980 this.playerConfig = {}, 1981 this.pluginName = "", 1982 this.__init(t) 1983 } 1984 return r(e, [{ 1985 key: "beforeCreate", 1986 value: function(e) {} 1987 }, { 1988 key: "afterCreate", 1989 value: function() {} 1990 }, { 1991 key: "beforePlayerInit", 1992 value: function() {} 1993 }, { 1994 key: "onPluginsReady", 1995 value: function() {} 1996 }, { 1997 key: "afterPlayerInit", 1998 value: function() {} 1999 }, {
vendor: 26,464 bytes, lines 2000-2686
2000 key: "destroy", 2001 value: function() {} 2002 }, { 2003 key: "__init", 2004 value: function(e) { 2005 this.player = e.player, 2006 this.playerConfig = e.player && e.player.config, 2007 this.pluginName = e.pluginName ? e.pluginName.toLowerCase() : this.constructor.pluginName.toLowerCase(), 2008 this.logger = e.player && e.player.logger 2009 } 2010 }, { 2011 key: "updateLang", 2012 value: function(e) { 2013 e || (e = this.lang) 2014 } 2015 }, { 2016 key: "lang", 2017 get: function() { 2018 return this.player.lang 2019 } 2020 }, { 2021 key: "i18n", 2022 get: function() { 2023 return this.player.i18n 2024 } 2025 }, { 2026 key: "i18nKeys", 2027 get: function() { 2028 return this.player.i18nKeys 2029 } 2030 }, { 2031 key: "domEventType", 2032 get: function() { 2033 var e = x.checkTouchSupport() ? "touch" : "mouse"; 2034 return !this.playerConfig || "touch" !== this.playerConfig.domEventType && "mouse" !== this.playerConfig.domEventType || (e = this.playerConfig.domEventType), 2035 e 2036 } 2037 }, { 2038 key: "on", 2039 value: function(e, t) { 2040 var i = this; 2041 e && t && this.player ? "string" == typeof e ? (this.__events[e] = t, 2042 this.player.on(e, t)) : Array.isArray(e) && e.forEach((function(e) { 2043 i.__events[e] = t, 2044 i.player.on(e, t) 2045 } 2046 )) : ze(this.pluginName, "plugin.on(event, callback)") 2047 } 2048 }, { 2049 key: "once", 2050 value: function(e, t) { 2051 var i = this; 2052 e && t && this.player ? "string" == typeof e ? (this.__onceEvents[e] = t, 2053 this.player.once(e, t)) : Array.isArray(e) && e.forEach((function(n) { 2054 i.__onceEvents[n] = t, 2055 i.player.once(e, t) 2056 } 2057 )) : ze(this.pluginName, "plugin.once(event, callback)") 2058 } 2059 }, { 2060 key: "off", 2061 value: function(e, t) { 2062 var i = this; 2063 e && t && this.player ? "string" == typeof e ? (delete this.__events[e], 2064 this.player.off(e, t)) : Array.isArray(e) && e.forEach((function(n) { 2065 delete i.__events[e], 2066 i.player.off(n, t) 2067 } 2068 )) : ze(this.pluginName, "plugin.off(event, callback)") 2069 } 2070 }, { 2071 key: "offAll", 2072 value: function() { 2073 var e = this; 2074 ["__events", "__onceEvents"].forEach((function(t) { 2075 Object.keys(e[t]).forEach((function(i) { 2076 e[t][i] && e.off(i, e[t][i]), 2077 i && delete e[t][i] 2078 } 2079 )) 2080 } 2081 )), 2082 this.__events = {}, 2083 this.__onceEvents = {} 2084 } 2085 }, { 2086 key: "emit", 2087 value: function(e) { 2088 var t; 2089 if (this.player) { 2090 for (var i = arguments.length, n = new Array(i > 1 ? i - 1 : 0), o = 1; o < i; o++) 2091 n[o - 1] = arguments[o]; 2092 (t = this.player).emit.apply(t, [e].concat(n)) 2093 } 2094 } 2095 }, { 2096 key: "emitUserAction", 2097 value: function(e, i) { 2098 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; 2099 if (this.player) { 2100 var o = t(t({}, n), {}, { 2101 pluginName: this.pluginName 2102 }); 2103 this.player.emitUserAction(e, i, o) 2104 } 2105 } 2106 }, { 2107 key: "hook", 2108 value: function(e, t) { 2109 return Fe.call.apply(Fe, [this].concat(Array.prototype.slice.call(arguments))) 2110 } 2111 }, { 2112 key: "useHooks", 2113 value: function(e, t) { 2114 for (var i = arguments.length, n = new Array(i > 2 ? i - 2 : 0), o = 2; o < i; o++) 2115 n[o - 2] = arguments[o]; 2116 return He.call.apply(He, [this].concat(Array.prototype.slice.call(arguments))) 2117 } 2118 }, { 2119 key: "removeHooks", 2120 value: function(e, t) { 2121 for (var i = arguments.length, n = new Array(i > 2 ? i - 2 : 0), o = 2; o < i; o++) 2122 n[o - 2] = arguments[o]; 2123 return Be.call.apply(Be, [this].concat(Array.prototype.slice.call(arguments))) 2124 } 2125 }, { 2126 key: "registerPlugin", 2127 value: function(e) { 2128 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {} 2129 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ""; 2130 if (this.player) 2131 return i && (t.pluginName = i), 2132 this.player.registerPlugin({ 2133 plugin: e, 2134 options: t 2135 }) 2136 } 2137 }, { 2138 key: "getPlugin", 2139 value: function(e) { 2140 return this.player ? this.player.getPlugin(e) : null 2141 } 2142 }, { 2143 key: "__destroy", 2144 value: function() { 2145 var e = this 2146 , t = this.player 2147 , i = this.pluginName; 2148 this.offAll(), 2149 x.clearAllTimers(this), 2150 x.checkIsFunction(this.destroy) && this.destroy(), 2151 ["player", "playerConfig", "pluginName", "logger", "__args", "__hooks"].map((function(t) { 2152 e[t] = null 2153 } 2154 )), 2155 t.unRegisterPlugin(i), 2156 We(this) 2157 } 2158 }], [{ 2159 key: "defineGetterOrSetter", 2160 value: function(e, t) { 2161 for (var i in t) 2162 Object.prototype.hasOwnProperty.call(t, i) && Object.defineProperty(e, i, t[i]) 2163 } 2164 }, { 2165 key: "defaultConfig", 2166 get: function() { 2167 return {} 2168 } 2169 }, { 2170 key: "pluginName", 2171 get: function() { 2172 return "pluginName" 2173 } 2174 }]), 2175 e 2176 }(); 2177 if ("undefined" != typeof Element && !Element.prototype.matches) { 2178 var Ye = Element.prototype; 2179 Ye.matches = Ye.matchesSelector || Ye.mozMatchesSelector || Ye.msMatchesSelector || Ye.oMatchesSelector || Ye.webkitMatchesSelector 2180 } 2181 var Xe = function(e, t) { 2182 for (; e && 9 !== e.nodeType; ) { 2183 if ("function" == typeof e.matches && e.matches(t)) 2184 return e; 2185 e = e.parentNode 2186 } 2187 }; 2188 function Ze(e, t, i, n, o) { 2189 var r = Je.apply(this, arguments); 2190 return e.addEventListener(i, r, o), 2191 { 2192 destroy: function() { 2193 e.removeEventListener(i, r, o) 2194 } 2195 } 2196 } 2197 function Je(e, t, i, n) { 2198 return function(i) { 2199 i.delegateTarget = Xe(i.target, t), 2200 i.delegateTarget && n.call(e, i) 2201 } 2202 } 2203 var $e = function(e, t, i, n, o) { 2204 return "function" == typeof e.addEventListener ? Ze.apply(null, arguments) : "function" == typeof i ? Ze.bind(null, document).apply(null, arguments) : ("string" == typeof e && (e = document.querySelectorAll(e)), 2205 Array.prototype.map.call(e, (function(e) { 2206 return Ze(e, t, i, n, o) 2207 } 2208 ))) 2209 } 2210 , Qe = { 2211 CONTROLS: "controls", 2212 ROOT: "root" 2213 } 2214 , et = { 2215 ROOT: "root", 2216 ROOT_LEFT: "rootLeft", 2217 ROOT_RIGHT: "rootRight", 2218 ROOT_TOP: "rootTop", 2219 CONTROLS_LEFT: "controlsLeft", 2220 CONTROLS_RIGTH: "controlsRight", 2221 CONTROLS_RIGHT: "controlsRight", 2222 CONTROLS_CENTER: "controlsCenter", 2223 CONTROLS: "controls" 2224 }; 2225 function tt(e) { 2226 return !!e && (e.indexOf && /^(?:http|data:|\/)/.test(e)) 2227 } 2228 function it(e, t) { 2229 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "" 2230 , n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {} 2231 , o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "" 2232 , r = null; 2233 if (e instanceof window.Element) 2234 return x.addClass(e, i), 2235 Object.keys(n).map((function(t) { 2236 e.setAttribute(t, n[t]) 2237 } 2238 )), 2239 e; 2240 if (tt(e) || tt(e.url)) 2241 return n.src = tt(e) ? e : e.url || "", 2242 r = x.createDom(e.tag || "img", "", n, "xg-img ".concat(i)); 2243 if ("function" == typeof e) 2244 try { 2245 return (r = e())instanceof window.Element ? (x.addClass(r, i), 2246 Object.keys(n).map((function(e) { 2247 r.setAttribute(e, n[e]) 2248 } 2249 )), 2250 r) : (w.logWarn("warn>>icons.".concat(t, " in config of plugin named [").concat(o, "] is a function mast return an Element Object")), 2251 null) 2252 } catch (s) { 2253 return w.logError("Plugin named [".concat(o, "]:createIcon"), s), 2254 null 2255 } 2256 return "string" == typeof e ? x.createDomFromHtml(e, n, i) : (w.logWarn("warn>>icons.".concat(t, " in config of plugin named [").concat(o, "] is invalid")), 2257 null) 2258 } 2259 function nt(e, t) { 2260 var n = t.config.icons || t.playerConfig.icons; 2261 Object.keys(e).map((function(o) { 2262 var r = e[o] 2263 , s = r && r.class ? r.class : "" 2264 , a = r && r.attr ? r.attr : {} 2265 , l = null; 2266 n && n[o] && (s = function(e, t) { 2267 return "object" === i(e) && e.class && "string" == typeof e.class ? "".concat(t, " ").concat(e.class) : t 2268 }(n[o], s), 2269 a = function(e, t) { 2270 return "object" === i(e) && e.attr && "object" === i(e.attr) && Object.keys(e.attr).map((function(i) { 2271 t[i] = e.attr[i] 2272 } 2273 )), 2274 t 2275 }(n[o], a), 2276 l = it(n[o], o, s, a, t.pluginName)), 2277 !l && r && (l = it(r.icon ? r.icon : r, a, s, {}, t.pluginName)), 2278 t.icons[o] = l 2279 } 2280 )) 2281 } 2282 var ot = function(e) { 2283 a(o, e); 2284 var t = d(o); 2285 function o() { 2286 var e, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; 2287 return n(this, o), 2288 (e = t.call(this, i)).__delegates = [], 2289 e 2290 } 2291 return r(o, [{ 2292 key: "__init", 2293 value: function(e) { 2294 if (p(l(o.prototype), "__init", this).call(this, e), 2295 e.root) { 2296 var t = e.root 2297 , i = null; 2298 this.icons = {}, 2299 this.root = null, 2300 this.parent = null, 2301 nt(this.registerIcons() || {}, this), 2302 this.langText = {}; 2303 var n, r, s = this.registerLanguageTexts() || {}; 2304 n = s, 2305 r = this, 2306 Object.keys(n).map((function(e) { 2307 Object.defineProperty(r.langText, e, { 2308 get: function() { 2309 var t = r.lang 2310 , i = r.i18n; 2311 return i[e] ? i[e] : n[e] && n[e][t] || "" 2312 } 2313 }) 2314 } 2315 )); 2316 var a = ""; 2317 try { 2318 a = this.render() 2319 } catch (h) { 2320 throw w.logError("Plugin:".concat(this.pluginName, ":render"), h), 2321 new Error("Plugin:".concat(this.pluginName, ":render:").concat(h.message)) 2322 } 2323 if (a) 2324 (i = o.insert(a, t, e.index)).setAttribute("data-index", e.index); 2325 else { 2326 if (!e.tag) 2327 return; 2328 (i = x.createDom(e.tag, "", e.attr, e.name)).setAttribute("data-index", e.index), 2329 t.appendChild(i) 2330 } 2331 this.root = i, 2332 this.parent = t; 2333 var c = this.config.attr || {} 2334 , u = this.config.style || {}; 2335 this.setAttr(c), 2336 this.setStyle(u), 2337 this.config.index && this.root.setAttribute("data-index", this.config.index), 2338 this.__registerChildren() 2339 } 2340 } 2341 }, { 2342 key: "__registerChildren", 2343 value: function() { 2344 var e = this; 2345 if (this.root) { 2346 this._children = []; 2347 var t = this.children(); 2348 t && "object" === i(t) && Object.keys(t).length > 0 && Object.keys(t).map((function(n) { 2349 var o, r, s = n, a = t[s], l = { 2350 root: e.root 2351 }; 2352 "function" == typeof a ? (o = e.config[s] || {}, 2353 r = a) : "object" === i(a) && "function" == typeof a.plugin && (o = a.options ? x.deepCopy(e.config[s] || {}, a.options) : e.config[s] || {}, 2354 r = a.plugin), 2355 l.config = o, 2356 void 0 !== o.index && (l.index = o.index), 2357 o.root && (l.root = o.root), 2358 e.registerPlugin(r, l, s) 2359 } 2360 )) 2361 } 2362 } 2363 }, { 2364 key: "updateLang", 2365 value: function(e) { 2366 e || (e = this.lang); 2367 var t = this.root 2368 , i = this.i18n 2369 , n = this.langText; 2370 t && function e(t, i) { 2371 for (var n = 0; n < t.children.length; n++) 2372 t.children[n].children.length > 0 ? e(t.children[n], i) : i(t.children[n]) 2373 }(t, (function(t) { 2374 var o = t.getAttribute && t.getAttribute("lang-key"); 2375 if (o) { 2376 var r = i[o.toUpperCase()] || n[o]; 2377 r && (t.innerHTML = "function" == typeof r ? r(e) : r) 2378 } 2379 } 2380 )) 2381 } 2382 }, { 2383 key: "lang", 2384 get: function() { 2385 return this.player.lang 2386 } 2387 }, { 2388 key: "changeLangTextKey", 2389 value: function(e) { 2390 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "" 2391 , i = this.i18n || {} 2392 , n = this.langText; 2393 e.setAttribute && e.setAttribute("lang-key", t); 2394 var o = i[t] || n[t] || ""; 2395 o && (e.innerHTML = o) 2396 } 2397 }, { 2398 key: "plugins", 2399 value: function() { 2400 return this._children 2401 } 2402 }, { 2403 key: "children", 2404 value: function() { 2405 return {} 2406 } 2407 }, { 2408 key: "registerPlugin", 2409 value: function(e) { 2410 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {} 2411 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ""; 2412 t.root = t.root || this.root; 2413 var n = p(l(o.prototype), "registerPlugin", this).call(this, e, t, i); 2414 return this._children.push(n), 2415 n 2416 } 2417 }, { 2418 key: "registerIcons", 2419 value: function() { 2420 return {} 2421 } 2422 }, { 2423 key: "registerLanguageTexts", 2424 value: function() { 2425 return {} 2426 } 2427 }, { 2428 key: "find", 2429 value: function(e) { 2430 if (this.root) 2431 return this.root.querySelector(e) 2432 } 2433 }, { 2434 key: "bind", 2435 value: function(e, t, i) { 2436 var n = this; 2437 if (arguments.length < 3 && "function" == typeof t) 2438 Array.isArray(e) ? e.forEach((function(e) { 2439 n.bindEL(e, t) 2440 } 2441 )) : this.bindEL(e, t); 2442 else { 2443 var r = o.delegate.call(this, this.root, e, t, i); 2444 this.__delegates = this.__delegates.concat(r) 2445 } 2446 } 2447 }, { 2448 key: "unbind", 2449 value: function(e, t) { 2450 var i = this; 2451 if (arguments.length < 3 && "function" == typeof t) 2452 Array.isArray(e) ? e.forEach((function(e) { 2453 i.unbindEL(e, t) 2454 } 2455 )) : this.unbindEL(e, t); 2456 else 2457 for (var n = "".concat(e, "_").concat(t), o = 0; o < this.__delegates.length; o++) 2458 if (this.__delegates[o].key === n) { 2459 this.__delegates[o].destroy(), 2460 this.__delegates.splice(o, 1); 2461 break 2462 } 2463 } 2464 }, { 2465 key: "setStyle", 2466 value: function(e, t) { 2467 var i = this; 2468 if (this.root) 2469 return "String" === x.typeOf(e) ? this.root.style[e] = t : void ("Object" === x.typeOf(e) && Object.keys(e).map((function(t) { 2470 i.root.style[t] = e[t] 2471 } 2472 ))) 2473 } 2474 }, { 2475 key: "setAttr", 2476 value: function(e, t) { 2477 var i = this; 2478 if (this.root) 2479 return "String" === x.typeOf(e) ? this.root.setAttribute(e, t) : void ("Object" === x.typeOf(e) && Object.keys(e).map((function(t) { 2480 i.root.setAttribute(t, e[t]) 2481 } 2482 ))) 2483 } 2484 }, { 2485 key: "setHtml", 2486 value: function(e, t) { 2487 this.root && (this.root.innerHTML = e, 2488 "function" == typeof t && t()) 2489 } 2490 }, { 2491 key: "bindEL", 2492 value: function(e, t) { 2493 var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 2494 this.root && "on".concat(e)in this.root && "function" == typeof t && this.root.addEventListener(e, t, i) 2495 } 2496 }, { 2497 key: "unbindEL", 2498 value: function(e, t) { 2499 var i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 2500 this.root && "on".concat(e)in this.root && "function" == typeof t && this.root.removeEventListener(e, t, i) 2501 } 2502 }, { 2503 key: "show", 2504 value: function(e) { 2505 if (this.root) 2506 return this.root.style.display = void 0 !== e ? e : "block", 2507 "none" === window.getComputedStyle(this.root, null).getPropertyValue("display") ? this.root.style.display = "block" : void 0 2508 } 2509 }, { 2510 key: "hide", 2511 value: function() { 2512 this.root && (this.root.style.display = "none") 2513 } 2514 }, { 2515 key: "appendChild", 2516 value: function(e, t) { 2517 if (!this.root) 2518 return null; 2519 if (arguments.length < 2 && arguments[0]instanceof window.Element) 2520 return this.root.appendChild(arguments[0]); 2521 if (!(t && t instanceof window.Element)) 2522 return null; 2523 try { 2524 return "string" == typeof e ? this.find(e).appendChild(t) : e.appendChild(t) 2525 } catch (i) { 2526 return w.logError("Plugin:appendChild", i), 2527 null 2528 } 2529 } 2530 }, { 2531 key: "render", 2532 value: function() { 2533 return "" 2534 } 2535 }, { 2536 key: "destroy", 2537 value: function() {} 2538 }, { 2539 key: "__destroy", 2540 value: function() { 2541 var e = this 2542 , t = this.player; 2543 this.__delegates.map((function(e) { 2544 e.destroy() 2545 } 2546 )), 2547 this.__delegates = [], 2548 this._children instanceof Array && (this._children.map((function(e) { 2549 t.unRegisterPlugin(e.pluginName) 2550 } 2551 )), 2552 this._children = null), 2553 this.root && (this.root.hasOwnProperty("remove") ? this.root.remove() : this.root.parentNode && this.root.parentNode.removeChild(this.root)), 2554 p(l(o.prototype), "__destroy", this).call(this), 2555 this.icons = {}, 2556 ["root", "parent"].map((function(t) { 2557 e[t] = null 2558 } 2559 )) 2560 } 2561 }], [{ 2562 key: "insert", 2563 value: function(e, t) { 2564 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0 2565 , n = t.children.length 2566 , o = Number(i) 2567 , r = e instanceof window.Node; 2568 if (n) { 2569 for (var s = 0, a = null, l = ""; s < n; s++) { 2570 a = t.children[s]; 2571 var c = Number(a.getAttribute("data-index")); 2572 if (c >= o) { 2573 l = "beforebegin"; 2574 break 2575 } 2576 c < o && (l = "afterend") 2577 } 2578 return r ? "afterend" === l ? t.appendChild(e) : t.insertBefore(e, a) : a.insertAdjacentHTML(l, e), 2579 "afterend" === l ? t.children[t.children.length - 1] : t.children[s] 2580 } 2581 return r ? t.appendChild(e) : t.insertAdjacentHTML("beforeend", e), 2582 t.children[t.children.length - 1] 2583 } 2584 }, { 2585 key: "defaultConfig", 2586 get: function() { 2587 return {} 2588 } 2589 }, { 2590 key: "delegate", 2591 value: function(e, t, i, n) { 2592 var o = arguments.length > 4 && void 0 !== arguments[4] && arguments[4] 2593 , r = []; 2594 if (e instanceof window.Node && "function" == typeof n) 2595 if (Array.isArray(i)) 2596 i.forEach((function(i) { 2597 var s = $e(e, t, i, n, o); 2598 s.key = "".concat(t, "_").concat(i), 2599 r.push(s) 2600 } 2601 )); 2602 else { 2603 var s = $e(e, t, i, n, o); 2604 s.key = "".concat(t, "_").concat(i), 2605 r.push(s) 2606 } 2607 return r 2608 } 2609 }, { 2610 key: "ROOT_TYPES", 2611 get: function() { 2612 return Qe 2613 } 2614 }, { 2615 key: "POSITIONS", 2616 get: function() { 2617 return et 2618 } 2619 }]), 2620 o 2621 }(Ke) 2622 , rt = function() { 2623 function e() { 2624 var t = this; 2625 if (n(this, e), 2626 s(this, "__trigger", (function(e) { 2627 var i = (new Date).getTime(); 2628 t.timeStamp = i; 2629 for (var n = 0; n < e.length; n++) 2630 t.__runHandler(e[n].target) 2631 } 2632 )), 2633 this.__handlers = [], 2634 this.timeStamp = 0, 2635 this.observer = null, 2636 window.ResizeObserver) 2637 try { 2638 this.observer = new window.ResizeObserver(function(e, t, i) { 2639 var n = !0 2640 , o = !0; 2641 if ("function" != typeof e) 2642 throw new TypeError("Expected a function"); 2643 return S(i) && (n = "leading"in i ? !!i.leading : n, 2644 o = "trailing"in i ? !!i.trailing : o), 2645 P(e, t, { 2646 leading: n, 2647 trailing: o, 2648 maxWait: t 2649 }) 2650 }(this.__trigger, 100, { 2651 trailing: !0 2652 })), 2653 this.timeStamp = (new Date).getTime() 2654 } catch (i) { 2655 console.error(i) 2656 } 2657 } 2658 return r(e, [{ 2659 key: "addObserver", 2660 value: function(e, t) { 2661 if (this.observer) { 2662 this.observer && this.observer.observe(e); 2663 for (var i = e.getAttribute(je), n = this.__handlers, o = -1, r = 0; r < n.length; r++) 2664 n[r] && e === n[r].target && (o = r); 2665 o > -1 ? this.__handlers[o].handler = t : this.__handlers.push({ 2666 target: e, 2667 handler: t, 2668 playerId: i 2669 }) 2670 } 2671 } 2672 }, { 2673 key: "unObserver", 2674 value: function(e) { 2675 var t = -1; 2676 this.__handlers.map((function(i, n) { 2677 e === i.target && (t = n) 2678 } 2679 )); 2680 try { 2681 this.observer && this.observer.unobserve(e) 2682 } catch (i) {} 2683 this.observer && this.observer.unobserve(e), 2684 t > -1 && this.__handlers.splice(t, 1) 2685 } 2686 }, {
2687 key: "destroyObserver", 2688 value: function() { 2689 this.observer && this.observer.disconnect(), 2690 this.observer = null, 2691 this.__handlers = null 2692 } 2693 }, { 2694 key: "__runHandler", 2695 value: function(e) { 2696 for (var t = this.__handlers, i = 0; i < t.length; i++) 2697 if (t[i] && e === t[i].target) { 2698 try { 2699 t[i].handler(e) 2700 } catch (n) { 2701 console.error(n) 2702 } 2703 return !0 2704 } 2705 return !1 2706 } 2707 }]), 2708 e 2709 }() 2710 , st = null; 2711 var at = { 2712 pluginGroup: {}, 2713 init: function(e) { 2714 var t, i, n = e._pluginInfoId; 2715 n || (n = (new Date).getTime(), 2716 e._pluginInfoId = n), 2717 !e.config.closeResizeObserver && (t = e.root, 2718 i = function() { 2719 e.resize() 2720 } 2721 , 2722 st || (st = new rt), 2723 st.addObserver(t, i)), 2724 0 === Object.keys(this.pluginGroup).length && (e.isUserActive = !0), 2725 this.pluginGroup[n] = { 2726 _player: e, 2727 _originalOptions: e.config || {}, 2728 _plugins: {} 2729 } 2730 }, 2731 checkPlayerRoot: function(e) { 2732 if (this.pluginGroup) { 2733 for (var t = Object.keys(this.pluginGroup), i = 0; i < t.length; i++) { 2734 var n = this.pluginGroup[t[i]]._player; 2735 if (n.root === e) 2736 return n 2737 } 2738 return null 2739 } 2740 return null 2741 }, 2742 formatPluginInfo: function(e, t) { 2743 var i = null 2744 , n = null; 2745 return e.plugin && "function" == typeof e.plugin ? (i = e.plugin, 2746 n = e.options) : (i = e, 2747 n = {}), 2748 t && (n.config = t || {}), 2749 { 2750 PLUFGIN: i, 2751 options: n 2752 } 2753 }, 2754 checkPluginIfExits: function(e, t) { 2755 for (var i = 0; i < t.length; i++) 2756 if (e.toLowerCase() === t[i].pluginName.toLowerCase()) 2757 return !0; 2758 return !1 2759 }, 2760 getRootByConfig: function(e, t) { 2761 for (var i = Object.keys(t), n = null, o = 0; o < i.length; o++) 2762 if (e.toLowerCase() === i[o].toLowerCase()) { 2763 n = t[i[o]]; 2764 break 2765 } 2766 return "Object" === x.typeOf(n) ? { 2767 root: n.root, 2768 position: n.position 2769 } : {} 2770 }, 2771 lazyRegister: function(e, t) { 2772 var i = this 2773 , n = t.timeout || 1500; 2774 return Promise.race([t.loader().then((function(t) { 2775 var n; 2776 n = t && t.__esModule ? t.default : t, 2777 i.register(e, n, t.options) 2778 } 2779 )), new Promise((function(e, t) { 2780 setTimeout((function() { 2781 t(new Error("timeout")) 2782 } 2783 ), n) 2784 } 2785 ))]) 2786 }, 2787 register: function(e, t) { 2788 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; 2789 if (e && t && "function" == typeof t && void 0 !== t.prototype) { 2790 var n = e._pluginInfoId; 2791 if (n && this.pluginGroup[n]) { 2792 this.pluginGroup[n]._plugins || (this.pluginGroup[n]._plugins = {}); 2793 var o = this.pluginGroup[n]._plugins 2794 , r = this.pluginGroup[n]._originalOptions; 2795 i.player = this.pluginGroup[n]._player; 2796 var s = i.pluginName || t.pluginName; 2797 if (!s) 2798 throw new Error("The property pluginName is necessary"); 2799 if (!t.isSupported || t.isSupported(e.config.mediaType, e.config.codecType)) { 2800 i.config || (i.config = {}); 2801 for (var a = Object.keys(r), l = 0; l < a.length; l++) 2802 if (s.toLowerCase() === a[l].toLowerCase()) { 2803 var c = r[a[l]]; 2804 "Object" === x.typeOf(c) ? i.config = Object.assign({}, i.config, r[a[l]]) : "Boolean" === x.typeOf(c) && (i.config.disable = !c); 2805 break 2806 }
vendor: 5,793 bytes, lines 2807-2947
2807 t.defaultConfig && Object.keys(t.defaultConfig).forEach((function(e) { 2808 void 0 === i.config[e] && (i.config[e] = t.defaultConfig[e]) 2809 } 2810 )), 2811 i.root ? "string" == typeof i.root && (i.root = e[i.root]) : i.root = e.root, 2812 i.index = i.config.index || 0; 2813 try { 2814 o[s.toLowerCase()] && (this.unRegister(n, s.toLowerCase()), 2815 console.warn("the is one plugin with same pluginName [".concat(s, "] exist, destroy the old instance"))); 2816 var u = new t(i); 2817 return o[s.toLowerCase()] = u, 2818 o[s.toLowerCase()].func = t, 2819 u && "function" == typeof u.afterCreate && u.afterCreate(), 2820 u 2821 } catch (h) { 2822 throw console.error(h), 2823 h 2824 } 2825 } else 2826 console.warn("not supported plugin [".concat(s, "]")) 2827 } 2828 } 2829 }, 2830 unRegister: function(e, t) { 2831 e._pluginInfoId && (e = e._pluginInfoId), 2832 t = t.toLowerCase(); 2833 try { 2834 var i = this.pluginGroup[e]._plugins[t]; 2835 i && (i.pluginName && i.__destroy(), 2836 delete this.pluginGroup[e]._plugins[t]) 2837 } catch (n) { 2838 console.error("[unRegister:".concat(t, "] cgid:[").concat(e, "] error"), n) 2839 } 2840 }, 2841 deletePlugin: function(e, t) { 2842 var i = e._pluginInfoId; 2843 i && this.pluginGroup[i] && this.pluginGroup[i]._plugins && delete this.pluginGroup[i]._plugins[t] 2844 }, 2845 getPlugins: function(e) { 2846 var t = e._pluginInfoId; 2847 return t && this.pluginGroup[t] ? this.pluginGroup[t]._plugins : {} 2848 }, 2849 findPlugin: function(e, t) { 2850 var i = e._pluginInfoId; 2851 if (!i || !this.pluginGroup[i]) 2852 return null; 2853 var n = t.toLowerCase(); 2854 return this.pluginGroup[i]._plugins[n] 2855 }, 2856 beforeInit: function(e) { 2857 var t = this; 2858 function i(e) { 2859 return e && e.then ? e : new Promise((function(e) { 2860 e() 2861 } 2862 )) 2863 } 2864 return new Promise((function(n) { 2865 if (t.pluginGroup) 2866 return (e._loadingPlugins && e._loadingPlugins.length ? Promise.all(e._loadingPlugins) : Promise.resolve()).then((function() { 2867 var o = e._pluginInfoId; 2868 if (t.pluginGroup[o]) { 2869 var r = t.pluginGroup[o]._plugins 2870 , s = []; 2871 Object.keys(r).forEach((function(e) { 2872 if (r[e] && r[e].beforePlayerInit) 2873 try { 2874 var t = r[e].beforePlayerInit(); 2875 s.push(i(t)) 2876 } catch (n) { 2877 throw s.push(i(null)), 2878 n 2879 } 2880 } 2881 )), 2882 Promise.all([].concat(s)).then((function() { 2883 n() 2884 } 2885 )).catch((function(e) { 2886 console.error(e), 2887 n() 2888 } 2889 )) 2890 } else 2891 n() 2892 } 2893 )) 2894 } 2895 )) 2896 }, 2897 afterInit: function(e) { 2898 var t = e._pluginInfoId; 2899 if (t && this.pluginGroup[t]) { 2900 var i = this.pluginGroup[t]._plugins; 2901 Object.keys(i).forEach((function(e) { 2902 i[e] && i[e].afterPlayerInit && i[e].afterPlayerInit() 2903 } 2904 )) 2905 } 2906 }, 2907 setLang: function(e, t) { 2908 var i = t._pluginInfoId; 2909 if (i && this.pluginGroup[i]) { 2910 var n = this.pluginGroup[i]._plugins; 2911 Object.keys(n).forEach((function(t) { 2912 if (n[t].updateLang) 2913 n[t].updateLang(e); 2914 else 2915 try { 2916 n[t].lang = e 2917 } catch (i) { 2918 console.warn("".concat(t, " setLang")) 2919 } 2920 } 2921 )) 2922 } 2923 }, 2924 reRender: function(e) { 2925 var t = this 2926 , i = e._pluginInfoId; 2927 if (i && this.pluginGroup[i]) { 2928 var n = [] 2929 , o = this.pluginGroup[i]._plugins; 2930 Object.keys(o).forEach((function(e) { 2931 "controls" !== e && o[e] && (n.push({ 2932 plugin: o[e].func, 2933 options: o[e].__args 2934 }), 2935 t.unRegister(i, e)) 2936 } 2937 )), 2938 n.forEach((function(i) { 2939 t.register(e, i.plugin, i.options) 2940 } 2941 )) 2942 } 2943 }, 2944 onPluginsReady: function(e) { 2945 var t = e._pluginInfoId; 2946 if (t && this.pluginGroup[t]) { 2947 var i = this.pluginGroup[t]._plugins || {};
2948 Object.keys(i).forEach((function(e) { 2949 i[e].onPluginsReady && "function" == typeof i[e].onPluginsReady && i[e].onPluginsReady() 2950 } 2951 )) 2952 } 2953 }, 2954 setCurrentUserActive: function(e, t) { 2955 if (this.pluginGroup[e]) { 2956 if (!t) 2957 return this.pluginGroup[e]._player.isUserActive = t, 2958 e; 2959 for (var i = Object.keys(this.pluginGroup), n = 0; n < i.length; n++) { 2960 var o = this.pluginGroup[i[n]]; 2961 o && o._player && (this.pluginGroup[i[n]]._player.isUserActive = !1) 2962 } 2963 return this.pluginGroup[e]._player.isUserActive = t, 2964 e 2965 } 2966 }, 2967 getCurrentUseActiveId: function() { 2968 if (this.pluginGroup) { 2969 for (var e = Object.keys(this.pluginGroup), t = 0; t < e.length; t++) { 2970 var i = this.pluginGroup[e[t]]; 2971 if (i && i._player && i._player.isUserActive) 2972 return e[t] 2973 } 2974 return null 2975 } 2976 }, 2977 destroy: function(e) { 2978 var t = e._pluginInfoId; 2979 if (this.pluginGroup[t]) { 2980 var i, n; 2981 i = e.root, 2982 st.unObserver(i, n); 2983 for (var o = this.pluginGroup[t]._plugins, r = 0, s = Object.keys(o); r < s.length; r++) { 2984 var a = s[r]; 2985 this.unRegister(t, a) 2986 } 2987 var l = e.isUseActive; 2988 if (delete this.pluginGroup[t], 2989 delete e._pluginInfoId, 2990 l) { 2991 var c = Object.keys(this.pluginGroup); 2992 c.length > 0 && this.setCurrentUserActive(c[c.length - 1], !0) 2993 } 2994 } 2995 } 2996 } 2997 , lt = { 2998 DEFAULT: "xgplayer", 2999 DEFAULT_SKIN: "xgplayer-skin-default", 3000 ENTER: "xgplayer-is-enter", 3001 PAUSED: "xgplayer-pause", 3002 PLAYING: "xgplayer-playing", 3003 ENDED: "xgplayer-ended", 3004 CANPLAY: "xgplayer-canplay", 3005 LOADING: "xgplayer-isloading", 3006 ERROR: "xgplayer-is-error", 3007 REPLAY: "xgplayer-replay", 3008 NO_START: "xgplayer-nostart", 3009 ACTIVE: "xgplayer-active", 3010 INACTIVE: "xgplayer-inactive", 3011 FULLSCREEN: "xgplayer-is-fullscreen", 3012 CSS_FULLSCREEN: "xgplayer-is-cssfullscreen", 3013 ROTATE_FULLSCREEN: "xgplayer-rotate-fullscreen", 3014 PARENT_ROTATE_FULLSCREEN: "xgplayer-rotate-parent", 3015 PARENT_FULLSCREEN: "xgplayer-fullscreen-parent", 3016 INNER_FULLSCREEN: "xgplayer-fullscreen-inner", 3017 NO_CONTROLS: "no-controls", 3018 FLEX_CONTROLS: "flex-controls", 3019 CONTROLS_FOLLOW: "controls-follow", 3020 CONTROLS_AUTOHIDE: "controls-autohide", 3021 TOP_BAR_AUTOHIDE: "top-bar-autohide", 3022 NOT_ALLOW_AUTOPLAY: "not-allow-autoplay", 3023 SEEKING: "seeking", 3024 PC: "xgplayer-pc", 3025 MOBILE: "xgplayer-mobile", 3026 MINI: "xgplayer-mini" 3027 }; 3028 function ct() { 3029 return { 3030 id: "", 3031 el: null, 3032 url: "", 3033 domEventType: "default", 3034 nullUrlStart: !1, 3035 width: 600, 3036 height: 337.5, 3037 fluid: !1, 3038 fitVideoSize: "fixed", 3039 videoFillMode: "auto", 3040 volume: .6, 3041 autoplay: !1, 3042 autoplayMuted: !1, 3043 loop: !1, 3044 isLive: !1, 3045 zoom: 1, 3046 videoInit: !0, 3047 poster: "", 3048 isMobileSimulateMode: !1, 3049 defaultPlaybackRate: 1, 3050 execBeforePluginsCall: null, 3051 allowSeekAfterEnded: !0, 3052 enableContextmenu: !0, 3053 closeVideoClick: !1, 3054 closeVideoDblclick: !1, 3055 closePlayerBlur: !1, 3056 closeDelayBlur: !1, 3057 leavePlayerTime: 3e3, 3058 closePlayVideoFocus: !1, 3059 closePauseVideoFocus: !1, 3060 closeFocusVideoFocus: !0, 3061 closeControlsBlur: !0, 3062 topBarAutoHide: !0, 3063 videoAttributes: {}, 3064 startTime: 0, 3065 seekedStatus: "play", 3066 miniprogress: !1, 3067 disableSwipeHandler: function() {}, 3068 enableSwipeHandler: function() {}, 3069 ignores: [], 3070 whitelist: [], 3071 inactive: 3e3, 3072 lang: (e = (document.documentElement.getAttribute("lang") || navigator.language || "zh-cn").toLocaleLowerCase(), 3073 "zh-cn" === e && (e = "zh"), 3074 e), 3075 controls: !0, 3076 marginControls: !1, 3077 fullscreenTarget: null, 3078 screenShot: !1, 3079 rotate: !1, 3080 pip: !1, 3081 download: !1, 3082 mini: !1, 3083 cssFullscreen: !0, 3084 keyShortcut: !0, 3085 presets: [], 3086 plugins: [], 3087 playbackRate: 1, 3088 definition: { 3089 list: [] 3090 }, 3091 playsinline: !0, 3092 customDuration: 0, 3093 timeOffset: 0, 3094 icons: {}, 3095 i18n: [], 3096 tabindex: 0, 3097 thumbnail: null, 3098 videoConfig: {}, 3099 isHideTips: !1, 3100 commonStyle: { 3101 progressColor: "", 3102 playedColor: "", 3103 cachedColor: "", 3104 sliderBtnStyle: {}, 3105 volumeColor: "" 3106 } 3107 }; 3108 var e 3109 } 3110 var ut = 1 3111 , ht = 2 3112 , dt = 3 3113 , ft = 4 3114 , pt = 5 3115 , gt = 6 3116 , vt = 7 3117 , yt = ["ERROR", "INITIAL", "READY", "ATTACHING", "ATTACHED", "NOTALLOW", "RUNNING", "ENDED", "DESTROYED"] 3118 , mt = function(e) { 3119 a(i, e); 3120 var t = d(i); 3121 function i() { 3122 var e; 3123 n(this, i); 3124 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 3125 r[a] = arguments[a]; 3126 return s(u(e = t.call.apply(t, [this].concat(r))), "onMouseEnter", (function(t) { 3127 var i = u(e) 3128 , n = i.player; 3129 i.playerConfig.closeControlsBlur && n.focus({ 3130 autoHide: !1 3131 }) 3132 } 3133 )), 3134 s(u(e), "onMouseLeave", (function() { 3135 u(e).player.focus() 3136 } 3137 )), 3138 e 3139 } 3140 return r(i, [{ 3141 key: "beforeCreate", 3142 value: function(e) { 3143 e.config.mode || "mobile" !== O.device || (e.config.mode = "flex"), 3144 e.player.config.marginControls && (e.config.autoHide = !1) 3145 } 3146 }, { 3147 key: "afterCreate", 3148 value: function() { 3149 var e = this 3150 , t = this.config 3151 , i = t.disable 3152 , n = t.height 3153 , o = t.mode; 3154 if (!i) { 3155 "flex" === o && this.player.addClass(lt.FLEX_CONTROLS); 3156 var r = { 3157 height: "".concat(n, "px") 3158 }; 3159 Object.keys(r).map((function(t) { 3160 e.root.style[t] = r[t] 3161 } 3162 )), 3163 this.left = this.find("xg-left-grid"), 3164 this.center = this.find("xg-center-grid"), 3165 this.right = this.find("xg-right-grid"), 3166 this.innerRoot = this.find("xg-inner-control
3166s"), 3167 this.on(fe, (function(t) { 3168 t ? x.addClass(e.root, "mini-controls") : x.removeClass(e.root, "mini-controls") 3169 } 3170 )); 3171 var s = this.playerConfig.isMobileSimulateMode; 3172 "mobile" !== O.device && "mobile" !== s && (this.bind("mouseenter", this.onMouseEnter), 3173 this.bind("mouseleave", this.onMouseLeave)) 3174 } 3175 } 3176 }, { 3177 key: "focus", 3178 value: function() { 3179 this.player.focus({ 3180 autoHide: !1 3181 }) 3182 } 3183 }, { 3184 key: "focusAwhile", 3185 value: function() { 3186 this.player.focus({ 3187 autoHide: !0 3188 }) 3189 } 3190 }, { 3191 key: "blur", 3192 value: function() { 3193 this.player.blur({ 3194 ignorePaused: !0 3195 }) 3196 } 3197 }, { 3198 key: "re
vendor: 14,015 bytes, lines 3198-3581
3198coverAutoHide", 3199 value: function() { 3200 this.config.autoHide && x.addClass(this.root, lt.CONTROLS_AUTOHIDE) 3201 } 3202 }, { 3203 key: "pauseAutoHide", 3204 value: function() { 3205 x.removeClass(this.root, lt.CONTROLS_AUTOHIDE) 3206 } 3207 }, { 3208 key: "show", 3209 value: function() { 3210 x.addClass(this.root, "show") 3211 } 3212 }, { 3213 key: "hide", 3214 value: function() { 3215 x.removeClass(this.root, "show") 3216 } 3217 }, { 3218 key: "mode", 3219 get: function() { 3220 return this.config.mode 3221 } 3222 }, { 3223 key: "registerPlugin", 3224 value: function(e) { 3225 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {} 3226 , n = arguments.length > 2 ? arguments[2] : void 0; 3227 if (this.root) { 3228 var o = e.defaultConfig || {}; 3229 if (!t.root) { 3230 var r = t.position ? t.position : t.config && t.config.position ? t.config.position : o.position; 3231 switch (r) { 3232 case et.CONTROLS_LEFT: 3233 t.root = this.left; 3234 break; 3235 case et.CONTROLS_RIGHT: 3236 t.root = this.right; 3237 break; 3238 case et.CONTROLS_CENTER: 3239 t.root = this.center; 3240 break; 3241 case et.CONTROLS: 3242 t.root = this.root; 3243 break; 3244 default: 3245 t.root = this.left 3246 } 3247 return p(l(i.prototype), "registerPlugin", this).call(this, e, t, n) 3248 } 3249 } 3250 } 3251 }, { 3252 key: "destroy", 3253 value: function() { 3254 "mobile" !== O.device && (this.unbind("mouseenter", this.onMouseEnter), 3255 this.unbind("mouseleave", this.onMouseLeave)) 3256 } 3257 }, { 3258 key: "render", 3259 value: function() { 3260 var e = this.config 3261 , t = e.mode 3262 , i = e.autoHide 3263 , n = e.initShow; 3264 if (!e.disable) { 3265 var o = x.classNames({ 3266 "xgplayer-controls": !0 3267 }, { 3268 "flex-controls": "flex" === t 3269 }, { 3270 "bottom-controls": "bottom" === t 3271 }, s({}, lt.CONTROLS_AUTOHIDE, i), { 3272 "xgplayer-controls-initshow": n || !i 3273 }); 3274 return '<xg-controls class="'.concat(o, '" unselectable="on">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>') 3275 } 3276 } 3277 }], [{ 3278 key: "pluginName", 3279 get: function() { 3280 return "controls" 3281 } 3282 }, { 3283 key: "defaultConfig", 3284 get: function() { 3285 return { 3286 disable: !1, 3287 autoHide: !0, 3288 mode: "", 3289 initShow: !1 3290 } 3291 } 3292 }]), 3293 i 3294 }(ot) 3295 , kt = { 3296 lang: {}, 3297 langKeys: [], 3298 textKeys: [] 3299 }; 3300 function bt(e, t) { 3301 return Object.keys(t).forEach((function(i) { 3302 var n, o = x.typeOf(t[i]), r = x.typeOf(e[i]); 3303 "Array" === o ? ("Array" !== r && (e[i] = []), 3304 (n = e[i]).push.apply(n, g(t[i]))) : "Object" === o ? ("Object" !== r && (e[i] = {}), 3305 bt(e[i], t[i])) : e[i] = t[i] 3306 } 3307 )), 3308 e 3309 } 3310 function Ct() { 3311 Object.keys(kt.lang.en).map((function(e) { 3312 kt.textKeys[e] = e 3313 } 3314 )) 3315 } 3316 function _t(e, t) { 3317 var i = e.LANG; 3318 if (t || (t = kt), 3319 t.lang) { 3320 var n = e.TEXT || {}; 3321 "zh" === i && (i = "zh-cn"), 3322 t.lang[i] ? bt(t.lang[i], n) : (t.langKeys.push(i), 3323 t.lang[i] = n), 3324 Ct() 3325 } 3326 } 3327 _t({ 3328 LANG: "en", 3329 TEXT: { 3330 ERROR_TYPES: { 3331 network: { 3332 code: 1, 3333 msg: "video download error" 3334 }, 3335 mse: { 3336 code: 2, 3337 msg: "stream append error" 3338 }, 3339 parse: { 3340 code: 3, 3341 msg: "parsing error" 3342 }, 3343 format: { 3344 code: 4, 3345 msg: "wrong format" 3346 }, 3347 decoder: { 3348 code: 5, 3349 msg: "decoding error" 3350 }, 3351 runtime: { 3352 code: 6, 3353 msg: "grammatical errors" 3354 }, 3355 timeout: { 3356 code: 7, 3357 msg: "play timeout" 3358 }, 3359 other: { 3360 code: 8, 3361 msg: "other errors" 3362 } 3363 }, 3364 HAVE_NOTHING: "There is no information on whether audio/video is ready", 3365 HAVE_METADATA: "Audio/video metadata is ready ", 3366 HAVE_CURRENT_DATA: "Data about the current play location is available, but there is not enough data to play the next frame/millisecond", 3367 HAVE_FUTURE_DATA: "Current and at least one frame of data is available", 3368 HAVE_ENOUGH_DATA: "The available data is sufficient to start playing", 3369 NETWORK_EMPTY: "Audio/video has not been initialized", 3370 NETWORK_IDLE: "Audio/video is active and has been selected for resources, but no network is used", 3371 NETWORK_LOADING: "The browser is downloading the data", 3372 NETWORK_NO_SOURCE: "No audio/video source was found", 3373 MEDIA_ERR_ABORTED: "The fetch process is aborted by the user", 3374 MEDIA_ERR_NETWORK: "An error occurred while downloading", 3375 MEDIA_ERR_DECODE: "An error occurred while decoding", 3376 MEDIA_ERR_SRC_NOT_SUPPORTED: "Audio/video is not supported", 3377 REPLAY: "Replay", 3378 ERROR: "Network is offline", 3379 PLAY_TIPS: "Play", 3380 PAUSE_TIPS: "Pause", 3381 PLAYNEXT_TIPS: "Play next", 3382 DOWNLOAD_TIPS: "Download", 3383 ROTATE_TIPS: "Rotate", 3384 RELOAD_TIPS: "Reload", 3385 FULLSCREEN_TIPS: "Fullscreen", 3386 EXITFULLSCREEN_TIPS: "Exit fullscreen", 3387 CSSFULLSCREEN_TIPS: "Cssfullscreen", 3388 EXITCSSFULLSCREEN_TIPS: "Exit cssfullscreen", 3389 TEXTTRACK: "Caption", 3390 PIP: "PIP", 3391 SCREENSHOT: "Screenshot", 3392 LIVE: "LIVE", 3393 OFF: "Off", 3394 OPEN: "Open", 3395 MINI_DRAG: "Click and hold to drag", 3396 MINISCREEN: "Miniscreen", 3397 REFRESH_TIPS: "Please Try", 3398 REFRESH: "Refresh", 3399 FORWARD: "forward", 3400 LIVE_TIP: "Live" 3401 } 3402 }); 3403 var wt = { 3404 get textKeys() { 3405 return kt.textKeys 3406 }, 3407 get langKeys() { 3408 return kt.langKeys 3409 }, 3410 get lang() { 3411 var e = {}; 3412 return kt.langKeys.map((function(t) { 3413 e[t] = kt.lang[t] 3414 } 3415 )), 3416 kt.lang["zh-cn"] && (e.zh = kt.lang["zh-cn"] || {}), 3417 e 3418 }, 3419 extend: function(e, t) { 3420 var i = []; 3421 if (t || (t = kt), 3422 t.lang) { 3423 i = "Array" !== x.typeOf(e) ? Object.keys(e).map((function(t) { 3424 return { 3425 LANG: "zh" === t ? "zh-cn" : t, 3426 TEXT: e[t] 3427 } 3428 } 3429 )) : e; 3430 var n = t.lang; 3431 i.map((function(e) { 3432 "zh" === e.LANG && (e.LANG = "zh-cn"), 3433 n[e.LANG] ? bt(n[e.LANG] || {}, e.TEXT || {}) : _t(e, t) 3434 } 3435 )), 3436 Ct() 3437 } 3438 }, 3439 use: _t, 3440 init: function(e) { 3441 var t, i = { 3442 lang: {}, 3443 langKeys: [], 3444 textKeys: {}, 3445 pId: e 3446 }; 3447 return bt(i.lang, kt.lang), 3448 (t = i.langKeys).push.apply(t, g(kt.langKeys)), 3449 bt(i.textKeys, kt.textKeys), 3450 i 3451 } 3452 } 3453 , Tt = ["play", "pause", "replay", "retry"] 3454 , xt = 0 3455 , Et = 0 3456 , St = function(e) { 3457 a(o, e); 3458 var i = d(o); 3459 function o(e) { 3460 var t; 3461 n(this, o); 3462 var r, a = x.deepMerge(ct(), e); 3463 s(u(t = i.call(this, a)), "canPlayFunc", (function() { 3464 if (t.config) { 3465 var e = t.config 3466 , i = e.autoplay 3467 , n = e.startTime 3468 , o = e.defaultPlaybackRate; 3469 w.logInfo("player", "canPlayFunc, startTime", n), 3470 n && (t.currentTime = n > t.duration ? t.duration : n, 3471 t.config.startTime = 0), 3472 t.playbackRate = o, 3473 (i || t._useAutoplay) && t.mediaPlay(), 3474 t.off(z, t.canPlayFunc), 3475 t.removeClass(lt.ENTER) 3476 } 3477 } 3478 )), 3479 s(u(t), "onFullscreenChange", (function(e, i) { 3480 var n = function() { 3481 x.setTimeout(u(t), (function() { 3482 t.resize() 3483 } 3484 ), 100) 3485 } 3486 , o = x.getFullScreenEl(); 3487 t._fullActionFrom ? t._fullActionFrom = "" : t.emit(we, { 3488 eventType: "system", 3489 action: "switch_fullscreen", 3490 pluginName: "player", 3491 currentTime: t.currentTime, 3492 duration: t.duration, 3493 props: [{ 3494 prop: "fullscreen", 3495 from: !0, 3496 to: !1 3497 }] 3498 }); 3499 var r = function(e, t, i) { 3500 if (e) { 3501 var n = e.getAttribute(i); 3502 return !(!n || n !== t || "VIDEO" !== e.tagName && "AUDIO" !== e.tagName) 3503 } 3504 }(o, t.playerId, je); 3505 if (i || o && (o === t._fullscreenEl || r)) 3506 n(), 3507 !t.config.closeFocusVideoFocus && t.media.focus(), 3508 t.fullscreen = !0, 3509 t.changeFullStyle(t.root, o, lt.FULLSCREEN), 3510 t.emit(he, !0, t._fullScreenOffset), 3511 t.cssfullscreen && t.exitCssFullscreen(); 3512 else if (t.fullscreen) { 3513 n(); 3514 var s = u(t) 3515 , a = s._fullScreenOffset; 3516 s.config.needFullscreenScroll ? (window.scrollTo(a.left, a.top), 3517 x.setTimeout(u(t), (function() { 3518 t.fullscreen = !1, 3519 t._fullScreenOffset = null 3520 } 3521 ), 100)) : (!t.config.closeFocusVideoFocus && t.media.focus(), 3522 t.fullscreen = !1, 3523 t._fullScreenOffset = null), 3524 t.cssfullscreen ? t.removeClass(lt.FULLSCREEN) : t.recoverFullStyle(t.root, t._fullscreenEl, lt.FULLSCREEN), 3525 t._fullscreenEl = null, 3526 t.emit(he, !1) 3527 } 3528 } 3529 )), 3530 s(u(t), "_onWebkitbeginfullscreen", (function(e) { 3531 t._fullscreenEl = t.media, 3532 t.onFullscreenChange(e, !0) 3533 } 3534 )), 3535 s(u(t), "_onWebkitendfullscreen", (function(e) { 3536 t.onFullscreenChange(e, !1) 3537 } 3538 )), 3539 Ge(u(t), Tt), 3540 t.config = a, 3541 t._pluginInfoId = x.generateSessionId(), 3542 (r = u(t)).logInfo = w.logInfo.bind(r), 3543 r.logWarn = w.logWarn.bind(r), 3544 r.logError = w.logError.bind(r); 3545 var l = t.constructor.defaultPreset; 3546 if (t.config.presets.length) { 3547 var c = t.config.presets.indexOf("default"); 3548 c >= 0 && l && (t.config.presets[c] = l) 3549 } else 3550 l && t.config.presets.push(l); 3551 if (t.userTimer = null, 3552 t.waitTimer = null, 3553 t._state = ut, 3554 t.isError = !1, 3555 t._hasStart = !1, 3556 t.isSeeking = !1, 3557 t.isCanplay = !1, 3558 t._useAutoplay = !1, 3559 t.rotateDeg = 0, 3560 t.isActive = !1, 3561 t.fullscreen = !1, 3562 t.cssfullscreen = !1, 3563 t.isRotateFullscreen = !1, 3564 t._fullscreenEl = null, 3565 t._cssfullscreenEl = null, 3566 t.curDefinition = null, 3567 t._orgCss = "", 3568 t._fullScreenOffset = null, 3569 t._videoHeight = 0, 3570 t._videoWidth = 0, 3571 t._accPlayed = { 3572 t: 0, 3573 acc: 0, 3574 loopAcc: 0 3575 }, 3576 t.innerContainer = null, 3577 t.controls = null, 3578 t.topBar = null, 3579 t.root = null, 3580 t.__i18n = wt.init(t._pluginInfoId), 3581 O.os.isAndroid && O.osVersion >
3581 0 && O.osVersion < 6 && (t.config.autoplay = !1), 3582 t.database = new Oe, 3583 t.isUserActive = !1, 3584 t._onceSeekCanplay = null, 3585 t._isPauseBeforeSeek = 0, 3586 !t._initDOM()) 3587 return console.error(new Error("can't find the dom which id is ".concat(t.config.id, " or this.config.el does not exist"))), 3588 h(t); 3589 var d = t.config 3590 , f = d.definition 3591 , p = void 0 === f ? {} : f; 3592 if (!d.url && p.list && p.list.length > 0) { 3593 var g = p.list.find((function(e) { 3594 return e.definition && e.definition === p.defaultDefinition 3595 } 3596 )); 3597 g || (p.defaultDefinition = p.list[0].definition, 3598 g = p.list[0]), 3599 t.config.url = g.url, 3600 t.curDefinition = g 3601 } 3602 return t._bindEvents(), 3603 t._registerPresets(), 3604 t._registerPlugins(), 3605 at.onPluginsReady(u(t)), 3606 t.getInitDefinition(), 3607 t.setState(ht), 3608 x.setTimeout(u(t), (function() { 3609 t.emit(ie) 3610 } 3611 ), 0), 3612 t.onReady && t.onReady(), 3613 (t.config.videoInit || t.config.autoplay) && (!t.hasStart || t.state < ft) && t.start(), 3614 t 3615 } 3616 return r(o, [{ 3617 key: "_initDOM", 3618 value: function() { 3619 var e = this; 3620 if (this.root = this.config.id ? document.getElementById(this.config.id) : null, 3621 !this.root) { 3622 var t = this.config.el; 3623 if (!t || 1 !== t.nodeType) 3624 return this.emit(U, new j("use",this.config.vid,{ 3625 line: 32, 3626 handle: "Constructor", 3627 msg: "container id can't be empty" 3628 })), 3629 console.error("this.confg.id or this.config.el can't be empty"), 3630 !1; 3631 this.root = t 3632 } 3633 var i = at.checkPlayerRoot(this.root); 3634 i && (w.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"), 3635 i.destroy()), 3636 this.root.setAttribute(je, this.playerId), 3637 at.init(this), 3638 this._initBaseDoms(); 3639 var n = this.constructor.XgVideoProxy; 3640 if (n && this.mediaConfig.mediaType === n.mediaType) { 3641 var o = this.innerContainer || this.root; 3642 this.detachVideoEvents(this.media); 3643 var r = new n(o,this.config,this.mediaConfig); 3644 this.attachVideoEvents(r), 3645 this.media = r 3646 } 3647 if (this.media.setAttribute(je, this.playerId), 3648 this.config.controls) { 3649 var s = this.config.controls.root || null 3650 , a = at.register(this, mt, { 3651 root: s 3652 }); 3653 this.controls = a 3654 } 3655 var l = "mobile" === this.config.isMobileSimulateMode ? "mobile" : O.device; 3656 if (this.addClass("".concat(lt.DEFAULT, " ").concat(lt.INACTIVE, " xgplayer-").concat(l, " ").concat(this.config.controls ? "" : lt.NO_CONTROLS)), 3657 this.config.autoplay ? this.addClass(lt.ENTER) : this.addClass(lt.NO_START), 3658 this.config.fluid) { 3659 var c = this.config 3660 , u = c.width 3661 , h = c.height; 3662 "number" == typeof u && "number" == typeof h || (u = 600, 3663 h = 337.5); 3664 var d = { 3665 width: "100%", 3666 height: "0", 3667 "max-width": "100%", 3668 "padding-top": "".concat(100 * h / u, "%") 3669 }; 3670 Object.keys(d).forEach((function(t) { 3671 e.root.style[t] = d[t] 3672 } 3673 )) 3674 } else 3675 ["width", "height"].forEach((function(t) { 3676 e.config[t] && ("number" != typeof e.config[t] ? e.root.style[t] = e.config[t] : e.root.style[t] = "".concat(e.config[t], "px")) 3677 } 3678 )); 3679 return !0 3680 } 3681 }, { 3682 key: "_initBaseDoms", 3683 value: function() { 3684 this.topBar = null, 3685 this.leftBar = null, 3686 this.rightBar = null, 3687 this.config.marginControls && (this.innerContainer = x.createDom("xg-video-container", "", { 3688 "data-index": -1 3689 }, "xg-video-container"), 3690 this.root.appendChild(this.innerContainer)) 3691 } 3692 }, { 3693 key: "_bindEvents", 3694 value: function() { 3695 var e = this; 3696 ["focus", "blur"].forEach((function(t) { 3697 e.on(t, e["on" + t.charAt(0).toUpperCase() + t.slice(1)]) 3698 } 3699 )), 3700 Re.forEach((function(t) { 3701 document && document.addEventListener(t, e.onFullscreenChange) 3702 } 3703 )), 3704 O.os.isIos && (this.media.addEventListener("webkitbeginfullscreen", this._onWebkitbeginfullscreen), 3705 this.media.addEventListener("webkitendfullscreen", this._onWebkitendfullscreen)), 3706 this.once(X, this.resize), 3707 this.playFunc = function() { 3708 e.config.closeFocusVideoFocus || e.media.focus() 3709 } 3710 , 3711 this.once(N, this.playFunc) 3712 } 3713 }, { 3714 key: "_unbindEvents", 3715 value: function() { 3716 var e = this; 3717 this.root.removeEventListener("mousemove", this.mousemoveFunc), 3718 Re.forEach((function(t) { 3719 document.removeEventListener(t, e.onFullscreenChange) 3720 } 3721 )), 3722 this.playFunc && this.off(N, this.playFunc), 3723 this.off(z, this.canPlayFunc), 3724 this.media.removeEventListener("webkitbeginfullscreen", this._onWebkitbeginfullscreen), 3725 this.media.removeEventListener("webkitendfullscreen", this._onWebkitendfullscreen) 3726 } 3727 }, { 3728 key: "_startInit", 3729 value: function(e) { 3730 var t = this; 3731 if (this.media && (e && "" !== e && ("Array" !== x.typeOf(e) || 0 !== e.length) || (e = "",
vendor: 5,839 bytes, lines 3732-3846
3732 this.emit(ne), 3733 w.logWarn("config.url is null, please get url and run player._startInit(url)"), 3734 !this.config.nullUrlStart))) { 3735 this._detachSourceEvents(this.media), 3736 "Array" === x.typeOf(e) && e.length > 0 ? this._attachSourceEvents(this.media, e) : this.media.src && this.media.src === e ? e || this.media.removeAttribute("src") : this.media.src = e, 3737 "Number" === x.typeOf(this.config.volume) && (this.volume = this.config.volume); 3738 var i = this.innerContainer ? this.innerContainer : this.root; 3739 this.media instanceof window.Element && !i.contains(this.media) && i.insertBefore(this.media, i.firstChild); 3740 var n = this.media.readyState; 3741 w.logInfo("_startInit readyState", n), 3742 this.config.autoplay && (!/^blob/.test(this.media.currentSrc) && !/^blob/.test(this.media.src) && this.load(), 3743 (O.os.isIpad || O.os.isPhone) && this.mediaPlay()), 3744 n >= 2 ? this.canPlayFunc() : this.once(z, this.canPlayFunc), 3745 (!this.hasStart || this.state < ft) && at.afterInit(this), 3746 this.hasStart = !0, 3747 this.setState(ft), 3748 x.setTimeout(this, (function() { 3749 t.emit(se) 3750 } 3751 ), 0) 3752 } 3753 } 3754 }, { 3755 key: "_registerPlugins", 3756 value: function() { 3757 var e = this 3758 , t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; 3759 this._loadingPlugins = []; 3760 var i = this.config.ignores || [] 3761 , n = this.config.plugins || [] 3762 , o = this.config.i18n || []; 3763 t && wt.extend(o, this.__i18n); 3764 var r = i.join("||").toLowerCase().split("||") 3765 , s = this.plugins; 3766 n.forEach((function(i) { 3767 try { 3768 var n = i.plugin ? i.plugin.pluginName : i.pluginName; 3769 if (n && r.indexOf(n.toLowerCase()) > -1) 3770 return null; 3771 if (!t && s[n.toLowerCase()]) 3772 return; 3773 if (i.lazy && i.loader) { 3774 var o = at.lazyRegister(e, i); 3775 return void (i.forceBeforeInit && (o.then((function() { 3776 e._loadingPlugins.splice(e._loadingPlugins.indexOf(o), 1) 3777 } 3778 )).catch((function(t) { 3779 w.logError("_registerPlugins:loadingPlugin", t), 3780 e._loadingPlugins.splice(e._loadingPlugins.indexOf(o), 1) 3781 } 3782 )), 3783 e._loadingPlugins.push(o))) 3784 } 3785 return e.registerPlugin(i) 3786 } catch (a) { 3787 w.logError("_registerPlugins:", a) 3788 } 3789 } 3790 )) 3791 } 3792 }, { 3793 key: "_registerPresets", 3794 value: function() { 3795 var e = this; 3796 this.config.presets.forEach((function(t) { 3797 !function(e, t) { 3798 var i, n, o = t.preset && t.options ? new t.preset(t.options,e.config) : new t({},e.config), r = o.plugins, s = void 0 === r ? [] : r, a = o.ignores, l = void 0 === a ? [] : a, c = o.icons, u = void 0 === c ? {} : c, h = o.i18n, d = void 0 === h ? [] : h; 3799 e.config.plugins || (e.config.plugins = []), 3800 e.config.ignores || (e.config.ignores = []), 3801 (i = e.config.plugins).push.apply(i, g(s)), 3802 (n = e.config.ignores).push.apply(n, g(l)), 3803 Object.keys(u).map((function(t) { 3804 e.config.icons[t] || (e.config.icons[t] = u[t]) 3805 } 3806 )); 3807 var f = e.config.i18n || []; 3808 d.push.apply(d, g(f)), 3809 e.config.i18n = d 3810 }(e, t) 3811 } 3812 )) 3813 } 3814 }, { 3815 key: "_getRootByPosition", 3816 value: function(e) { 3817 var t = null; 3818 switch (e) { 3819 case et.ROOT_RIGHT: 3820 this.rightBar || (this.rightBar = x.createPositionBar("xg-right-bar", this.root)), 3821 t = this.rightBar; 3822 break; 3823 case et.ROOT_LEFT: 3824 this.leftBar || (this.leftBar = x.createPositionBar("xg-left-bar", this.root)), 3825 t = this.leftBar; 3826 break; 3827 case et.ROOT_TOP: 3828 this.topBar || (this.topBar = x.createPositionBar("xg-top-bar", this.root), 3829 this.config.topBarAutoHide && x.addClass(this.topBar, lt.TOP_BAR_AUTOHIDE)), 3830 t = this.topBar; 3831 break; 3832 default: 3833 t = this.innerContainer || this.root 3834 } 3835 return t 3836 } 3837 }, { 3838 key: "registerPlugin", 3839 value: function(e, t) { 3840 var i = at.formatPluginInfo(e, t) 3841 , n = i.PLUFGIN 3842 , o = i.options 3843 , r = this.config.plugins; 3844 !at.checkPluginIfExits(n.pluginName, r) && r.push(n); 3845 var s = at.getRootByConfig(n.pluginName, this.config); 3846 s.root && (o.root = s.root),
3847 s.position && (o.position = s.position); 3848 var a = o.position ? o.position : o.config && o.config.position || n.defaultConfig && n.defaultConfig.position; 3849 return !o.root && "string" == typeof a && a.indexOf("controls") > -1 ? this.controls && this.controls.registerPlugin(n, o, n.pluginName) : (o.root || (o.root = this._getRootByPosition(a)), 3850 at.register(this, n, o)) 3851 } 3852 }, { 3853 key: "deregister", 3854 value: function(e) { 3855 "string" == typeof e ? at.unRegister(this, e) : e instanceof Ke && at.unRegister(this, e.pluginName) 3856 } 3857 }, { 3858 key: "unRegisterPlugin", 3859 value: function(e) { 3860 var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; 3861 this.deregister(e), 3862 t && this.removePluginFromConfig(e) 3863 } 3864 }, { 3865 key: "removePluginFromConfig", 3866 value: function(e) { 3867 var t; 3868 if ("string" == typeof e ? t = e : e instanceof Ke && (t = e.pluginName), 3869 t) 3870 for (var i = this.config.plugins.length - 1; i > -1; i--) { 3871 if (this.config.plugins[i].pluginName.toLowerCase() === t.toLowerCase()) { 3872 this.config.plugins.splice(i, 1); 3873 break 3874 } 3875 } 3876 } 3877 }, { 3878 key: "plugins", 3879 get: function() { 3880 return at.getPlugins(this) 3881 } 3882 }, { 3883 key: "getPlugin", 3884 value: function(e) { 3885 var t = at.findPlugin(this, e); 3886 return t && t.pluginName ? t : null 3887 } 3888 }, { 3889 key: "addClass", 3890 value: function(e) { 3891 this.root && (x.hasClass(this.root, e) || x.addClass(this.root, e)) 3892 } 3893 }, { 3894 key: "removeClass", 3895 value: function(e) { 3896 this.root && x.removeClass(this.root, e) 3897 } 3898 }, { 3899 key: "hasClass", 3900 value: function(e) { 3901 if (this.root) 3902 return x.hasClass(this.root, e) 3903 } 3904 }, { 3905 key: "setAttribute", 3906 value: function(e, t) { 3907 this.root && this.root.setAttribute(e, t) 3908 } 3909 }, { 3910 key: "removeAttribute", 3911 value: function(e, t) { 3912 this.root && this.root.removeAttribute(e, t) 3913 } 3914 }, { 3915 key: "start", 3916 value: function(e) { 3917 var t = this; 3918 if (!(this.state > dt)) 3919 return e || this.config.url || this.getInitDefinition(), 3920 this.hasStart = !0, 3921 this.setState(dt), 3922 this._registerPlugins(!1), 3923 at.beforeInit(this).then((function() { 3924 if (t.config) 3925 return e || (e = t.url || t.config.url), 3926 t._startInit(e) 3927 } 3928 )).catch((function(e) { 3929 throw e.fileName = "player", 3930 e.lineNumber = "236", 3931 w.logError("start:beforeInit:", e), 3932 e 3933 } 3934 )) 3935 } 3936 }, { 3937 key: "switchURL", 3938 value: function(e, t) { 3939 var i = this 3940 , n = e; 3941 "Object" === x.typeOf(e) && (n = e.url); 3942 var o = this.currentTime 3943 , r = this.paused && !this.isError; 3944 return this.src = n, 3945 new Promise((function(e) { 3946 var t = function() { 3947 i.currentTime = o, 3948 r && i.once("canplay", (function() { 3949 i.pause() 3950 } 3951 )), 3952 e() 3953 }; 3954 O.os.isAndroid ? i.once("timeupdate", (function() { 3955 t() 3956 }
vendor: 11,869 bytes, lines 3957-4260
3957 )) : i.once("canplay", (function() { 3958 t() 3959 } 3960 )), 3961 i.play() 3962 } 3963 )) 3964 } 3965 }, { 3966 key: "videoPlay", 3967 value: function() { 3968 this.mediaPlay() 3969 } 3970 }, { 3971 key: "mediaPlay", 3972 value: function() { 3973 var e = this; 3974 if (!this.hasStart && this.state < ft) 3975 return this.removeClass(lt.NO_START), 3976 this.addClass(lt.ENTER), 3977 this.start(), 3978 void (this._useAutoplay = !0); 3979 this.state < gt && (this.removeClass(lt.NO_START), 3980 !this.isCanplay && this.addClass(lt.ENTER)); 3981 var t = p(l(o.prototype), "play", this).call(this); 3982 return void 0 !== t && t && t.then ? t.then((function() { 3983 e.removeClass(lt.NOT_ALLOW_AUTOPLAY), 3984 e.addClass(lt.PLAYING), 3985 e.state < gt && (w.logInfo(">>>>playPromise.then"), 3986 e.setState(gt), 3987 e.emit(oe)) 3988 } 3989 )).catch((function(t) { 3990 if (w.logWarn(">>>>playPromise.catch", t.name), 3991 e.media && e.media.error) 3992 return e.onError(), 3993 void e.removeClass(lt.ENTER); 3994 "NotAllowedError" === t.name && (e._errorTimer = x.setTimeout(e, (function() { 3995 e._errorTimer = null, 3996 e.emit(re), 3997 e.addClass(lt.NOT_ALLOW_AUTOPLAY), 3998 e.removeClass(lt.ENTER), 3999 e.pause(), 4000 e.setState(pt) 4001 } 4002 ), 0)) 4003 } 4004 )) : (w.logWarn("video.play not return promise"), 4005 this.state < gt && (this.setState(gt), 4006 this.removeClass(lt.NOT_ALLOW_AUTOPLAY), 4007 this.removeClass(lt.NO_START), 4008 this.removeClass(lt.ENTER), 4009 this.addClass(lt.PLAYING), 4010 this.emit(oe))), 4011 t 4012 } 4013 }, { 4014 key: "mediaPause", 4015 value: function() { 4016 p(l(o.prototype), "pause", this).call(this) 4017 } 4018 }, { 4019 key: "videoPause", 4020 value: function() { 4021 p(l(o.prototype), "pause", this).call(this) 4022 } 4023 }, { 4024 key: "play", 4025 value: function() { 4026 var e = this; 4027 return this.removeClass(lt.PAUSED), 4028 qe(this, "play", (function() { 4029 return e.mediaPlay() 4030 } 4031 )) 4032 } 4033 }, { 4034 key: "pause", 4035 value: function() { 4036 var e = this; 4037 qe(this, "pause", (function() { 4038 p(l(o.prototype), "pause", e).call(e) 4039 } 4040 )) 4041 } 4042 }, { 4043 key: "seek", 4044 value: function(e, t) { 4045 var i = this; 4046 if (this.media && !Number.isNaN(Number(e) || !this.hasStart)) { 4047 var n = this.config 4048 , o = n.isSeekedPlay 4049 , r = n.seekedStatus 4050 , s = t || (o ? "play" : r); 4051 e = e < 0 ? 0 : e > this.duration ? parseInt(this.duration, 10) : e, 4052 !this._isPauseBeforeSeek && (this._isPauseBeforeSeek = this.paused ? 2 : 1), 4053 this._onceSeekCanplay && this.off(z, this._onceSeekCanplay), 4054 this._onceSeekCanplay = function() { 4055 switch (i.removeClass(lt.ENTER), 4056 i.isSeeking = !1, 4057 s) { 4058 case "play": 4059 i.play(); 4060 break; 4061 case "pause": 4062 i.pause(); 4063 break; 4064 default: 4065 i._isPauseBeforeSeek > 1 || i.paused ? i.pause() : i.play() 4066 } 4067 i._isPauseBeforeSeek = 0, 4068 i._onceSeekCanplay = null 4069 } 4070 , 4071 this.once(z, this._onceSeekCanplay), 4072 this.state < gt ? (this.removeClass(lt.NO_START), 4073 this.addClass(lt.ENTER), 4074 this.currentTime = e, 4075 this.play()) : this.currentTime = e 4076 } 4077 } 4078 }, { 4079 key: "getInitDefinition", 4080 value: function() { 4081 var e = this 4082 , t = this.config 4083 , i = t.definition; 4084 !t.url && i && i.list && i.list.length > 0 && i.defaultDefinition && i.list.map((function(t) { 4085 t.definition === i.defaultDefinition && (e.config.url = t.url, 4086 e.curDefinition = t) 4087 } 4088 )) 4089 } 4090 }, { 4091 key: "changeDefinition", 4092 value: function(e, i) { 4093 var n = this 4094 , o = this.config.definition; 4095 if (Array.isArray(null == o ? void 0 : o.list) && o.list.forEach((function(t) { 4096 (null == e ? void 0 : e.definition) === t.definition && (n.curDefinition = t) 4097 } 4098 )), 4099 null != e && e.bitrate && "number" != typeof e.bitrate && (e.bitrate = parseInt(e.bitrate, 10) || 0), 4100 this.emit(pe, { 4101 from: i, 4102 to: e 4103 }), 4104 this.hasStart) { 4105 var r = this.switchURL(e.url, t({ 4106 seamless: !1 !== o.seamless && "undefined" != typeof MediaSource && "function" == typeof MediaSource.isTypeSupported 4107 }, e)); 4108 r && r.then ? r.then((function() { 4109 n.emit(ge, { 4110 from: i, 4111 to: e 4112 }) 4113 } 4114 )) : this.emit(ge, { 4115 from: i, 4116 to: e 4117 }) 4118 } else 4119 this.config.url = e.url 4120 } 4121 }, { 4122 key: "reload", 4123 value: function() { 4124 this.load(), 4125 this.reloadFunc = function() { 4126 this.play() 4127 } 4128 , 4129 this.once(X, this.reloadFunc) 4130 } 4131 }, { 4132 key: "resetState", 4133 value: function() { 4134 var e = this 4135 , t = [lt.NOT_ALLOW_AUTOPLAY, lt.PLAYING, lt.NO_START, lt.PAUSED, lt.REPLAY, lt.ENTER, lt.ENDED, lt.ERROR, lt.LOADING]; 4136 this.hasStart = !1, 4137 this.isError = !1, 4138 this._useAutoplay = !1, 4139 this.mediaPause(), 4140 this._accPlayed.acc = 0, 4141 this._accPlayed.t = 0, 4142 this._accPlayed.loopAcc = 0, 4143 t.forEach((function(t) { 4144 e.removeClass(t) 4145 } 4146 )), 4147 this.addClass(lt.ENTER), 4148 this.emit(Te) 4149 } 4150 }, { 4151 key: "reset", 4152 value: function() { 4153 var e = this 4154 , t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [] 4155 , i = arguments.length > 1 ? arguments[1] : void 0; 4156 this.resetState(); 4157 var n = this.plugins; 4158 if (n && (t.map((function(t) { 4159 e.deregister(t) 4160 } 4161 )), 4162 i)) { 4163 var o = ct(); 4164 Object.keys(this.config).keys((function(t) { 4165 "undefined" === e.config[t] || "plugins" !== t && "presets" !== t && "el" !== t && "id" !== t || (e.config[t] = o[t]) 4166 } 4167 )) 4168 } 4169 } 4170 }, { 4171 key: "destroy", 4172 value: function() { 4173 var e = this 4174 , t = this.innerContainer 4175 , i = this.root 4176 , n = this.media; 4177 if (i && n) { 4178 if (this.hasStart = !1, 4179 this._useAutoplay = !1, 4180 i.removeAttribute(je), 4181 this.updateAcc("destroy"), 4182 this._unbindEvents(), 4183 this._detachSourceEvents(this.media), 4184 x.clearAllTimers(this), 4185 this.emit(le), 4186 at.destroy(this), 4187 We(this), 4188 p(l(o.prototype), "destroy", this).call(this), 4189 this.fullscreen && this._fullscreenEl === this.root && this.exitFullscreen(), 4190 t) 4191 for (var r = t.children, s = 0; s < r.length; s++) 4192 t.removeChild(r[s]); 4193 !t && n instanceof window.Node && i.contains(n) && i.removeChild(n), 4194 ["topBar", "leftBar", "rightBar", "innerContainer"].map((function(t) { 4195 e[t] && i.removeChild(e[t]), 4196 e[t] = null 4197 } 4198 )); 4199 var a = i.className.split(" "); 4200 a.length > 0 ? i.className = a.filter((function(e) { 4201 return e.indexOf("xgplayer") < 0 4202 } 4203 )).join(" ") : i.className = "", 4204 this.removeAttribute("data-xgfill"), 4205 ["isSeeking", "isCanplay", "isActive", "cssfullscreen", "fullscreen"].forEach((function(t) { 4206 e[t] = !1 4207 } 4208 )) 4209 } 4210 } 4211 }, { 4212 key: "replay", 4213 value: function() { 4214 var e = this; 4215 this.removeClass(lt.ENDED), 4216 this.currentTime = 0, 4217 this.isSeeking = !1, 4218 qe(this, "replay", (function() { 4219 e.once(z, (function() { 4220 var t = e.mediaPlay(); 4221 t && t.catch && t.catch((function(e) { 4222 console.log(e) 4223 } 4224 )) 4225 } 4226 )), 4227 e.play(), 4228 e.emit(ae), 4229 e.onPlay() 4230 } 4231 )) 4232 } 4233 }, { 4234 key: "retry", 4235 value: function() { 4236 var e = this; 4237 this.removeClass(lt.ERROR), 4238 this.addClass(lt.LOADING), 4239 qe(this, "retry", (function() { 4240 var t = e.currentTime; 4241 e.src = e.config.url, 4242 !e.config.isLive && (e.currentTime = t), 4243 e.once(z, (function() { 4244 e.mediaPlay() 4245 } 4246 )) 4247 } 4248 )) 4249 } 4250 }, { 4251 key: "changeFullStyle", 4252 value: function(e, t, i, n) { 4253 e && (n || (n = lt.PARENT_FULLSCREEN), 4254 this._orgCss || (this._orgCss = x.filterStyleFromText(e)), 4255 x.addClass(e, i), 4256 t && t !== e && !this._orgPCss && (this._orgPCss = x.filterStyleFromText(t), 4257 x.addClass(t, n), 4258 t.setAttribute(je, this.playerId))) 4259 } 4260 }, {
4261 key: "recoverFullStyle", 4262 value: function(e, t, i, n) { 4263 n || (n = lt.PARENT_FULLSCREEN), 4264 this._orgCss && (x.setStyleFromCsstext(e, this._orgCss), 4265 this._orgCss = ""), 4266 x.removeClass(e, i), 4267 t && t !== e && this._orgPCss && (x.setStyleFromCsstext(t, this._orgPCss), 4268 this._orgPCss = "", 4269 x.removeClass(t, n), 4270 t.removeAttribute(je)) 4271 } 4272 }, { 4273 key: "getFullscreen", 4274 value: function() { 4275 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.config.fullscreenTarget 4276 , t = this.root 4277 , i = this.media; 4278 e || (e = t), 4279 this._fullScreenOffset = { 4280 top: x.scrollTop(), 4281 left: x.scrollLeft() 4282 }, 4283 this._fullscreenEl = e, 4284 this._fullActionFrom = "get"; 4285 var n = x.getFullScreenEl(); 4286 if (n !== this._fullscreenEl) 4287 try { 4288 for (var o = 0; o < De.length; o++) { 4289 var r = De[o]; 4290 if (e[r]) { 4291 var s = "webkitRequestFullscreen" === r ? e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT) : e[r](); 4292 return s && s.then ? s : Promise.resolve() 4293 } 4294 } 4295 return i.fullscreenEnabled || i.webkitSupportsFullscreen ? (i.webkitEnterFullscreen(), 4296 Promise.resolve()) : Promise.reject(new Error("call getFullscreen fail")) 4297 } catch (a) { 4298 return Promise.reject(new Error("call getFullscreen fail")) 4299 } 4300 else 4301 this.onFullscreenChange() 4302 } 4303 }, { 4304 key: "exitFullscreen", 4305 value: function(e) { 4306 if (this.isRotateFullscreen && this.exitRotateFullscreen(), 4307 this._fullscreenEl || x.getFullScreenEl()) { 4308 this.root; 4309 var t = this.media; 4310 this._fullActionFrom = "exit"; 4311 try { 4312 for (var i = 0; i < Me.length; i++) { 4313 var n = Me[i]; 4314 if (document[n]) { 4315 var o = document[n](); 4316 return o && o.then ? o : Promise.resolve() 4317 } 4318 } 4319 return t && t.webkitSupportsFullscreen ? (t.webkitExitFullScreen(), 4320 Promise.resolve()) : Promise.reject(new Error("call exitFullscreen fail")) 4321 } catch (r) { 4322 return Promise.reject(new Error("call exitFullscreen fail")) 4323 } 4324 } 4325 } 4326 }, { 4327 key: "getCssFullscreen", 4328 value: function() { 4329 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.config.fullscreenTarget; 4330 this.isRotateFullscreen ? this.exitRotateFullscreen() : this.fullscreen && this.exitFullscreen(); 4331 var t = e ? "".concat(lt.INNER_FULLSCREEN, " ").concat(lt.CSS_FULLSCREEN) : lt.CSS_FULLSCREEN; 4332 this.changeFullStyle(this.root, e, t); 4333 var i = this.config.fullscreen 4334 , n = void 0 === i ? {} : i 4335 , o = !0 === n.useCssFullscreen || "function" == typeof n.useCssFullscreen && n.useCssFullscreen(); 4336 o && (this.fullscreen = !0, 4337 this.emit(he, !0)), 4338 this._cssfullscreenEl = e, 4339 this.cssfullscreen = !0, 4340 this.emit(de, !0) 4341 } 4342 }, { 4343 key: "exitCssFullscreen", 4344 value: function() { 4345 var e = this._cssfullscreenEl ? "".concat(lt.INNER_FULLSCREEN, " ").concat(lt.CSS_FULLSCREEN) : lt.CSS_FULLSCREEN; 4346 if (this.fullscreen) { 4347 var t = this.config.fullscreen 4348 , i = void 0 === t ? {} : t; 4349 !0 === i.useCssFullscreen || "function" == typeof i.useCssFullscreen && i.useCssFullscreen() ? (this.recoverFullStyle(this.root, this._cssfullscreenEl, e),
4350 this.fullscreen = !1, 4351 this.emit(he, !1)) : this.removeClass(e) 4352 } else 4353 this.recoverFullStyle(this.root, this._cssfullscreenEl, e); 4354 this._cssfullscreenEl = null, 4355 this.cssfullscreen = !1, 4356 this.emit(de, !1) 4357 } 4358 }, { 4359 key: "getRotateFullscreen", 4360 value: function(e) { 4361 this.cssfullscreen && this.exitCssFullscreen(e); 4362 var t = e ? "".concat(lt.INNER_FULLSCREEN, " ").concat(lt.ROTATE_FULLSCREEN) : lt.ROTATE_FULLSCREEN; 4363 this._fullscreenEl = e || this.root, 4364 this.changeFullStyle(this.root, e, t, lt.PARENT_ROTATE_FULLSCREEN), 4365 this.isRotateFullscreen = !0, 4366 this.fullscreen = !0, 4367 this.setRotateDeg(90), 4368 this.emit(he, !0) 4369 } 4370 }, { 4371 key: "exitRotateFullscreen", 4372 value: function(e) { 4373 var t = this._fullscreenEl !== this.root ? "".concat(lt.INNER_FULLSCREEN, " ").concat(lt.ROTATE_FULLSCREEN) : lt.ROTATE_FULLSCREEN; 4374 this.recoverFullStyle(this.root, this._fullscreenEl, t, lt.PARENT_ROTATE_FULLSCREEN), 4375 this.isRotateFullscreen = !1, 4376 this.fullscreen = !1, 4377 this.setRotateDeg(0), 4378 this.emit(he, !1) 4379 } 4380 }, { 4381 key: "setRotateDeg", 4382 value: function(e) { 4383 90 === window.orientation || -90 === window.orientation ? this.rotateDeg = 0 : this.rotateDeg = e 4384 } 4385 }, { 4386 key: "focus", 4387 value: function() { 4388 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { 4389 autoHide: !this.config.closeDelayBlur, 4390 delay: this.config.inactive 4391 }; 4392 this.isActive ? this.onFocus(e) : this.emit(ee, t({ 4393 paused: this.paused, 4394 ended: this.ended 4395 }, e)) 4396 } 4397 }, { 4398 key: "blur", 4399 value: function() { 4400 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { 4401 ignorePaused: !1 4402 }; 4403 this.isActive ? this.emit(te, t({ 4404 paused: this.paused, 4405 ended: this.ended 4406 }, e)) : this.onBlur(e) 4407 } 4408 }, { 4409 key: "onFocus", 4410 value: function() { 4411 var e = this 4412 , t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 4413 , i = t.autoHide 4414 , n = void 0 === i ? !this.config.closePlayerBlur : i 4415 , o = t.delay 4416 , r = void 0 === o ? this.config.inactive : o; 4417 this.isActive = !0, 4418 this.removeClass(lt.INACTIVE), 4419 this.userTimer && (x.clearTimeout(this, this.userTimer), 4420 this.userTimer = null), 4421 n ? this.userTimer = x.setTimeout(this, (function() { 4422 e.userTimer = null, 4423 e.blur() 4424 } 4425 ), r) : this.userTimer && (x.clearTimeout(this, this.userTimer), 4426 this.userTimer = null) 4427 } 4428 }, { 4429 key: "onBlur", 4430 value: function() { 4431 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 4432 , t = e.ignorePaused 4433 , i = void 0 !== t && t; 4434 if (this.isActive) { 4435 var n = this.config.closePauseVideoFocus; 4436 this.isActive = !1, 4437 (i || n || !this.paused && !this.ended) && this.addClass(lt.INACTIVE) 4438 } 4439 } 4440 }, { 4441 key: "onEmptied", 4442 value: function() { 4443 this.updateAcc("emptied") 4444 } 4445 }, { 4446 key: "onCanplay", 4447 value: function() { 4448 this.removeClass(lt.ENTER), 4449 this.removeClass(lt.ERROR), 4450 this.removeClass(lt.LOADING), 4451 this.isCanplay = !0, 4452 this.waitTimer && x.clearTimeout(this, this.waitTimer) 4453 } 4454 }, { 4455 key: "onLoadeddata", 4456 value: function() { 4457 this.isError = !1, 4458 this.isSeeking = !1 4459 } 4460 }, { 4461 key: "onLoadstart", 4462 value: function() { 4463 this.removeClass(lt.ERROR), 4464 this.isCanplay = !1 4465 } 4466 }, { 4467 key: "onPlay", 4468 value: function() { 4469 this.state === vt && this.setState(gt), 4470 this.removeClass(lt.PAUSED), 4471 this.ended && this.removeClass(lt.ENDED), 4472 !this.config.closePlayVideoFocus && this.focus() 4473 } 4474 }, { 4475 key: "onPause", 4476 value: function() { 4477 this.addClass(lt.PAUSED), 4478 this.updateAcc("pause"), 4479 this.config.closePauseVideoFocus || (this.userTimer && (x.clearTimeout(this, this.userTimer), 4480 this.userTimer = null),
4481 this.focus()) 4482 } 4483 }, { 4484 key: "onEnded", 4485 value: function() { 4486 this.updateAcc("ended"), 4487 this.addClass(lt.ENDED), 4488 this.setState(vt) 4489 } 4490 }, { 4491 key: "onError", 4492 value: function() { 4493 this.isError = !0, 4494 this.updateAcc("error"), 4495 this.removeClass(lt.NOT_ALLOW_AUTOPLAY), 4496 this.removeClass(lt.NO_START), 4497 this.removeClass(lt.ENTER), 4498 this.removeClass(lt.LOADING), 4499 this.addClass(lt.ERROR) 4500 } 4501 }, { 4502 key: "onSeeking", 4503 value: function() { 4504 this.isSeeking || this.updateAcc("seeking"), 4505 this.isSeeking = !0, 4506 this.addClass(lt.SEEKING) 4507 } 4508 }, { 4509 key: "onSeeked", 4510 value: function() { 4511 this.isSeeking = !1, 4512 this.waitTimer && x.clearTimeout(this, this.waitTimer), 4513 this.removeClass(lt.LOADING), 4514 this.removeClass(lt.SEEKING) 4515 } 4516 }, { 4517 key: "onWaiting", 4518 value: function() { 4519 var e = this; 4520 this.waitTimer && x.clearTimeout(this, this.waitTimer), 4521 this.updateAcc("waiting"), 4522 this.waitTimer = x.setTimeout(this, (function() { 4523 e.addClass(lt.LOADING), 4524 x.clearTimeout(e, e.waitTimer), 4525 e.waitTimer = null 4526 } 4527 ), 200) 4528 } 4529 }, { 4530 key: "onPlaying", 4531 value: function() { 4532 var e = this; 4533 this.isError = !1, 4534 [lt.NO_START, lt.PAUSED, lt.ENDED, lt.ERROR, lt.REPLAY, lt.LOADING].forEach((function(t) { 4535 e.removeClass(t) 4536 } 4537 )) 4538 } 4539 }, { 4540 key: "onTimeupdate", 4541 value: function() { 4542 !this._videoHeight && this.resize(), 4543 (this.waitTimer || this.hasClass(lt.LOADING)) && this.media.readyState > 2 && (this.removeClass(lt.LOADING), 4544 x.clearTimeout(this, this.waitTimer), 4545 this.waitTimer = null), 4546 !this.paused && this.state < gt && this.duration && (this.setState(gt), 4547 this.emit(oe)), 4548 this._accPlayed.t || this.paused || this.ended || (this._accPlayed.t = (new Date).getTime()) 4549 } 4550 }, { 4551 key: "onVolumechange", 4552 value: function() { 4553 "Number" === x.typeOf(this.config.volume) && (this.config.volume = this.volume) 4554 } 4555 }, { 4556 key: "onRatechange", 4557 value: function() { 4558 this.config.defaultPlaybackRate = this.playbackRate 4559 } 4560 }, { 4561 key: "emitUserAction", 4562 value: function(e, i, n) { 4563 if (this.media && i && e) { 4564 var o = "String" === x.typeOf(e) ? e : e.type || ""; 4565 n.props && "Array" !== x.typeOf(n.props) && (n.props = [n.props]), 4566 this.emit(we, t({ 4567 eventType: o, 4568 action: i, 4569 currentTime: this.currentTime, 4570 duration: this.duration, 4571 ended: this.ended, 4572 event: e 4573 }, n)) 4574 } 4575 } 4576 }, { 4577 key: "updateAcc", 4578 value: function(e) { 4579 if (this._accPlayed.t) { 4580 var t = (new Date).getTime() - this._accPlayed.t; 4581 this._accPlayed.acc += t, 4582 this._accPlayed.t = 0, 4583 ("ended" === e || this.ended) && (this._accPlayed.loopAcc = this._accPlayed.acc) 4584 } 4585 } 4586 }, { 4587 key: "checkBuffer", 4588 value: function(e) { 4589 var t = this.media.buffered; 4590 if (!t || 0 === t.length || !this.duration) 4591 return !0; 4592 for (var i = e || this.media.currentTime || .2, n = t.length, o = 0; o < n; o++) 4593 if (t.start(o) <= i && t.end(o) > i) 4594 return !0; 4595 return !1 4596 } 4597 }, { 4598 key: "position", 4599 value: function() { 4600 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { 4601 h: 0, 4602 y: 0, 4603 x: 0, 4604 w: 0 4605 }; 4606 if (this.media && e && e.h) { 4607 var t = 1 / e.h 4608 , i = 1 !== t ? "scale(".concat(t, ")") : "" 4609 , n = 0 4610 , o = 0; 4611 e.y && (o = (100 - 100 * e.h) / 2 - 100 * e.y),
vendor: 96,425 bytes, lines 4612-7173
4612 e.w && e.x && (n = (100 - 100 * e.w) / 2 - 100 * e.x), 4613 i += " translate(".concat(n, "%, ").concat(o, "%)"), 4614 this.media.style.transform = i, 4615 this.media.style.webkitTransform = i 4616 } 4617 } 4618 }, { 4619 key: "setConfig", 4620 value: function(e) { 4621 var t = this; 4622 e && Object.keys(e).map((function(i) { 4623 if ("plugins" !== i) { 4624 t.config[i] = e[i]; 4625 var n = t.plugins[i.toLowerCase()]; 4626 n && "Function" === x.typeOf(n.setConfig) && n.setConfig(e[i]) 4627 } 4628 } 4629 )) 4630 } 4631 }, { 4632 key: "playNext", 4633 value: function(e) { 4634 var t = this; 4635 this.resetState(), 4636 this.setConfig(e), 4637 this._currentTime = 0, 4638 this._duration = 0, 4639 qe(this, "playnext", (function() { 4640 t.start(), 4641 t.emit(be, e) 4642 } 4643 )) 4644 } 4645 }, { 4646 key: "resize", 4647 value: function() { 4648 var e = this; 4649 if (this.media) { 4650 var t = this.media 4651 , i = t.videoWidth 4652 , n = t.videoHeight 4653 , o = this.config 4654 , r = o.fitVideoSize 4655 , s = o.videoFillMode; 4656 if ("fill" !== s && "cover" !== s || this.setAttribute("data-xgfill", s), 4657 n && i) { 4658 this._videoHeight = n, 4659 this._videoWidth = i; 4660 var a = this.root.getBoundingClientRect() 4661 , l = this.controls && this.innerContainer ? this.controls.root.getBoundingClientRect().height : 0 4662 , c = a.width 4663 , u = a.height - l 4664 , h = parseInt(i / n * 1e3, 10) 4665 , d = parseInt(c / u * 1e3, 10) 4666 , f = c 4667 , p = u 4668 , g = {}; 4669 "auto" === r && d > h || "fixWidth" === r ? (p = c / h * 1e3, 4670 this.config.fluid ? g.paddingTop = "".concat(100 * p / f, "%") : g.height = "".concat(p + l, "px")) : ("auto" === r && d < h || "fixHeight" === r) && (f = h * u / 1e3, 4671 g.width = "".concat(f, "px")), 4672 this.fullscreen || this.cssfullscreen || Object.keys(g).forEach((function(t) { 4673 e.root.style[t] = g[t] 4674 } 4675 )), 4676 ("fillHeight" === s && d < h || "fillWidth" === s && d > h) && this.setAttribute("data-xgfill", "cover"); 4677 var v = { 4678 videoScale: h, 4679 vWidth: f, 4680 vHeight: p, 4681 cWidth: f, 4682 cHeight: p + l 4683 }; 4684 this.emit(ve, v) 4685 } 4686 } 4687 } 4688 }, { 4689 key: "updateObjectPosition", 4690 value: function() { 4691 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0 4692 , t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; 4693 this.media.updateObjectPosition ? this.media.updateObjectPosition(e, t) : this.media.style.objectPosition = "".concat(100 * e, "% ").concat(100 * t, "%") 4694 } 4695 }, { 4696 key: "setState", 4697 value: function(e) { 4698 w.logInfo("setState", "state from:".concat(yt[this.state], " to:").concat(yt[e])), 4699 this._state = e 4700 } 4701 }, { 4702 key: "state", 4703 get: function() { 4704 return this._state 4705 } 4706 }, { 4707 key: "isFullscreen", 4708 get: function() { 4709 return this.fullscreen 4710 } 4711 }, { 4712 key: "isCssfullScreen", 4713 get: function() { 4714 return this.cssfullscreen 4715 } 4716 }, { 4717 key: "hasStart", 4718 get: function() { 4719 return this._hasStart 4720 }, 4721 set: function(e) { 4722 "boolean" == typeof e && (this._hasStart = e, 4723 !1 === e && this.setState(ht), 4724 this.emit("hasstart")) 4725 } 4726 }, { 4727 key: "isPlaying", 4728 get: function() { 4729 return this._state === gt || this._state === vt 4730 }, 4731 set: function(e) { 4732 e ? this.setState(gt) : this._state >= gt && this.setState(ft) 4733 } 4734 }, { 4735 key: "definitionList", 4736 get: function() { 4737 return this.config && this.config.definition && this.config.definition.list || [] 4738 }, 4739 set: function(e) { 4740 var t = this 4741 , i = this.config.definition 4742 , n = null 4743 , o = null; 4744 i.list = e, 4745 this.emit("resourceReady", e), 4746 e.forEach((function(e) { 4747 var r; 4748 (null === (r = t.curDefinition) || void 0 === r ? void 0 : r.definition) === e.definition && (n = e), 4749 i.defaultDefinition === e.definition && (o = e) 4750 } 4751 )), 4752 !o && e.length > 0 && (o = e[0]), 4753 n ? this.changeDefinition(n) : o && this.changeDefinition(o) 4754 } 4755 }, { 4756 key: "videoFrameInfo", 4757 get: function() { 4758 var e = { 4759 total: 0, 4760 dropped: 0, 4761 corrupted: 0, 4762 droppedRate: 0, 4763 droppedDuration: 0 4764 }; 4765 if (!this.media || !this.media.getVideoPlaybackQuality) 4766 return e; 4767 var t = this.media.getVideoPlaybackQuality(); 4768 return e.dropped = t.droppedVideoFrames || 0, 4769 e.total = t.totalVideoFrames || 0, 4770 e.corrupted = t.corruptedVideoFrames || 0, 4771 e.total > 0 && (e.droppedRate = e.dropped / e.total * 100, 4772 e.droppedDuration = parseInt(this.cumulateTime / e.total * e.dropped, 0)), 4773 e 4774 } 4775 }, { 4776 key: "lang", 4777 get: function() { 4778 return this.config.lang 4779 }, 4780 set: function(e) { 4781 0 !== wt.langKeys.filter((function(t) { 4782 return t === e 4783 } 4784 )).length || "zh" === e ? (this.config.lang = e, 4785 at.setLang(e, this)) : console.error("Sorry, set lang fail, because the language [".concat(e, "] is not supported now, list of all supported languages is [").concat(wt.langKeys.join(), "] ")) 4786 } 4787 }, { 4788 key: "i18n", 4789 get: function() { 4790 var e = this.config.lang; 4791 return "zh" === e && (e = "zh-cn"), 4792 this.__i18n.lang[e] || this.__i18n.lang.en 4793 } 4794 }, { 4795 key: "i18nKeys", 4796 get: function() { 4797 return this.__i18n.textKeys || {} 4798 } 4799 }, { 4800 key: "version", 4801 get: function() { 4802 return R 4803 } 4804 }, { 4805 key: "playerId", 4806 get: function() { 4807 return this._pluginInfoId 4808 } 4809 }, { 4810 key: "url", 4811 get: function() { 4812 return this.__url || this.config.url 4813 }, 4814 set: function(e) { 4815 this.__url = e 4816 } 4817 }, { 4818 key: "poster", 4819 get: function() { 4820 return this.plugins.poster ? this.plugins.poster.config.poster : this.config.poster 4821 }, 4822 set: function(e) { 4823 this.plugins.poster && this.plugins.poster.update(e) 4824 } 4825 }, { 4826 key: "readyState", 4827 get: function() { 4828 return p(l(o.prototype), "readyState", this) 4829 } 4830 }, { 4831 key: "error", 4832 get: function() { 4833 var e = p(l(o.prototype), "error", this); 4834 return this.i18n[e] || e 4835 } 4836 }, { 4837 key: "networkState", 4838 get: function() { 4839 return p(l(o.prototype), "networkState", this) 4840 } 4841 }, { 4842 key: "fullscreenChanging", 4843 get: function() { 4844 return !(null === this._fullScreenOffset) 4845 } 4846 }, { 4847 key: "cumulateTime", 4848 get: function() { 4849 var e = this._accPlayed; 4850 return this.updateAcc("get"), 4851 e.acc 4852 } 4853 }, { 4854 key: "zoom", 4855 get: function() { 4856 return this.config.zoom 4857 }, 4858 set: function(e) { 4859 this.config.zoom = e 4860 } 4861 }, { 4862 key: "avgSpeed", 4863 get: function() { 4864 return Et 4865 }, 4866 set: function(e) { 4867 Et = e 4868 } 4869 }, { 4870 key: "realTimeSpeed", 4871 get: function() { 4872 return xt 4873 }, 4874 set: function(e) { 4875 xt = e 4876 } 4877 }, { 4878 key: "hook", 4879 value: function(e, t) { 4880 return Fe.call.apply(Fe, [this].concat(Array.prototype.slice.call(arguments))) 4881 } 4882 }, { 4883 key: "useHooks", 4884 value: function(e, t) { 4885 return He.call.apply(He, [this].concat(Array.prototype.slice.call(arguments))) 4886 } 4887 }, { 4888 key: "removeHooks", 4889 value: function(e, t) { 4890 return Be.call.apply(Be, [this].concat(Array.prototype.slice.call(arguments))) 4891 } 4892 }, { 4893 key: "usePluginHooks", 4894 value: function(e, t, i) { 4895 for (var n = arguments.length, o = new Array(n > 3 ? n - 3 : 0), r = 3; r < n; r++) 4896 o[r - 3] = arguments[r]; 4897 return Ue.call.apply(Ue, [this].concat(Array.prototype.slice.call(arguments))) 4898 } 4899 }, { 4900 key: "removePluginHooks", 4901 value: function(e, t, i) { 4902 for (var n = arguments.length, o = new Array(n > 3 ? n - 3 : 0), r = 3; r < n; r++) 4903 o[r - 3] = arguments[r]; 4904 return Ve.call.apply(Ve, [this].concat(Array.prototype.slice.call(arguments))) 4905 } 4906 }, { 4907 key: "setUserActive", 4908 value: function(e, t) { 4909 "boolean" == typeof t && t !== this.muted && (this.addInnerOP("volumechange"), 4910 this.muted = t), 4911 at.setCurrentUserActive(this.playerId, e) 4912 } 4913 }], [{ 4914 key: "debugger", 4915 get: function() { 4916 return w.config.debug 4917 }, 4918 set: function(e) { 4919 w.config.debug = e 4920 } 4921 }, { 4922 key: "getCurrentUserActivePlayerId", 4923 value: function() { 4924 return at.getCurrentUseActiveId() 4925 } 4926 }, { 4927 key: "setCurrentUserActive", 4928 value: function(e, t) { 4929 at.setCurrentUserActive(e, t) 4930 } 4931 }, { 4932 key: "isHevcSupported", 4933 value: function() { 4934 return O.isHevcSupported() 4935 } 4936 }, { 4937 key: "probeConfigSupported", 4938 value: function(e) { 4939 return O.probeConfigSupported(e) 4940 } 4941 }, { 4942 key: "install", 4943 value: function(e, t) { 4944 o.plugins || (o.plugins = {}), 4945 o.plugins[e] || (o.plugins[e] = t) 4946 } 4947 }, { 4948 key: "use", 4949 value: function(e, t) { 4950 o.plugins || (o.plugins = {}), 4951 o.plugins[e] = t 4952 } 4953 }]), 4954 o 4955 }(Ae); 4956 s(St, "defaultPreset", null), 4957 s(St, "XgVideoProxy", null); 4958 function Pt() { 4959 return (new Date).getTime() 4960 } 4961 var Lt = "loadstart" 4962 , It = "loadeddata" 4963 , At = "firstFrame" 4964 , Ot = "waitingStart" 4965 , Rt = "waitingEnd" 4966 , Dt = "seekStart" 4967 , Mt = "seekEnd" 4968 , jt = function(e) { 4969 a(o, e); 4970 var i = d(o); 4971 function o() { 4972 var e; 4973 n(this, o); 4974 for (var t = arguments.length, r = new Array(t), a = 0; a < t; a++) 4975 r[a] = arguments[a]; 4976 return s(u(e = i.call.apply(i, [this].concat(r))), "_onTimeupdate", (function() { 4977 e._state.isTimeUpdate = !0, 4978 e._state.autoplayStart && (w.logInfo("[xgLogger]".concat(e.player.playerId, " _onTimeupdate")), 4979 e._sendFF("onTimeupdate")) 4980 } 4981 )), 4982 s(u(e), "_onAutoplayStart", (function() { 4983 w.logInfo("[xgLogger]".concat(e.player.playerId, " _onAutoplayStart")), 4984 e._state.autoplayStart = !0, 4985 e.vt && e._sendFF("onAutoplayStart") 4986 } 4987 )), 4988 s(u(e), "_onReset", (function() { 4989 e._state = { 4990 autoplayStart: !1, 4991 isFFLoading: !1, 4992 isTimeUpdate: !1, 4993 isFFSend: !1, 4994 isLs: !1 4995 }, 4996 e.vt = 0, 4997 e.pt = 0, 4998 e.fvt = 0, 4999 e.newPointTime = Pt(), 5000 e.loadedCostTime = 0, 5001 e.startCostTime = 0, 5002 e._isSeeking = !1, 5003 e.seekingStart = 0, 5004 e.waitingStart = 0, 5005 e.fixedWaitingStart = 0, 5006 e._isWaiting = !1, 5007 e._waitTimer && x.clearTimeout(u(e), e._waitTimer), 5008 e._waittTimer && x.clearTimeout(u(e), e._waittTimer), 5009 e._waitTimer = null, 5010 e._waittTimer = null, 5011 e._waitType = 0 5012 } 5013 )), 5014 s(u(e), "_onSeeking", (function() { 5015 e.seekingStart || (e.suspendWaitingStatus("seek"), 5016 e.seekingStart = Pt(), 5017 e.emitLog(Dt, { 5018 start: Pt() 5019 })) 5020 } 5021 )), 5022 s(u(e), "_onSeeked", (function() { 5023 e.suspendSeekingStatus("seeked") 5024 } 5025 )), 5026 s(u(e), "_onWaitingLoadStart", (function() { 5027 e._isWaiting || e.vt || (e._isWaiting = !0, 5028 e.waitingStart = Pt(), 5029 e.fixedWaitingStart = Pt(), 5030 e._waitType = 1, 5031 e.emitLog(Ot, { 5032 fixedStart: e.fixedWaitingStart, 5033 start: e.waitingStart, 5034 type: 1, 5035 endType: "loadstart" 5036 })) 5037 } 5038 )), 5039 s(u(e), "_onWaiting", (function() { 5040 !e._isWaiting && e.vt && (e._isWaiting = !0, 5041 e.vt ? e.seekingStart ? e._waitType = 2 : e._waitType = 0 : e._waitType = 1, 5042 e.fixedWaitingStart = Pt(), 5043 e._waitTimer = x.setTimeout(u(e), (function() { 5044 e._isWaiting && (e.waitingStart = Pt(), 5045 x.clearTimeout(u(e), e._waitTimer), 5046 e._waitTimer = null, 5047 e._startWaitTimeout(), 5048 e.emitLog(Ot, { 5049 fixedStart: e.fixedWaitingStart, 5050 start: e.waitingStart, 5051 type: e._waitType, 5052 endType: 2 === e._waitType ? "seek" : "playing" 5053 })) 5054 } 5055 ), 200)) 5056 } 5057 )), 5058 s(u(e), "_onError", (function() { 5059 e.suspendSeekingStatus("error"), 5060 e.suspendWaitingStatus("error") 5061 } 5062 )), 5063 s(u(e), "_onPlaying", (function() { 5064 e._isWaiting && e.suspendWaitingStatus("playing") 5065 } 5066 )), 5067 e 5068 } 5069 return r(o, [{ 5070 key: "afterCreate", 5071 value: function() { 5072 var e = this; 5073 this._onReset(), 5074 this._waitType = "firstFrame", 5075 this._initOnceEvents(), 5076 this.newPointTime = Pt(), 5077 this.loadedCostTime = 0, 5078 this.startCostTime = 0, 5079 this.on($, (function() { 5080 var t = e._state 5081 , i = t.autoplayStart 5082 , n = t.isFFSend; 5083 e.startCostTime = Pt() - e.newPointTime, 5084 w.logInfo("[xgLogger]".concat(e.player.playerId, " LOAD_START"), "autoplayStart:".concat(i, " isFFSend:").concat(n, " startCostTime:").concat(e.startCostTime, " newPointTime").concat(e.newPointTime)), 5085 n || (!t.isLs && e.emitLog(Lt, {}), 5086 t.isLs = !0, 5087 t.isTimeUpdate = !1, 5088 t.isFFLoading = !0, 5089 e.pt = Pt(), 5090 e.vt = 0, 5091 e.fvt = 0, 5092 e._initOnceEvents(), 5093 e._onWaitingLoadStart()) 5094 } 5095 )), 5096 this.on(X, (function() { 5097 e.vt = Pt(), 5098 e.fvt = e.vt - e.pt, 5099 e.loadedCostTime = e.vt - e.newPointTime; 5100 var t = e._state 5101 , i = t.isTimeUpdate 5102 , n = t.isFFSend 5103 , o = t.autoplayStart; 5104 w.logInfo("[xgLogger]".concat(e.player.playerId, " LOADED_DATA"), "fvt:".concat(e.fvt, " isTimeUpdate:").concat(e._state.isTimeUpdate, " loadedCostTime:").concat(e.loadedCostTime)), 5105 (i || o) && e._sendFF("loadedData"), 5106 n || e.emitLog(It, {}), 5107 e.suspendWaitingStatus("loadeddata") 5108 } 5109 )), 5110 this.on(V, this._onSeeking), 5111 this.on(G, this._onSeeked), 5112 this.on(le, (function() { 5113 e.endState("destroy") 5114 } 5115 )), 5116 this.on(ce, (function() { 5117 e.endState("urlChange"), 5118 w.logInfo("[xgLogger]".concat(e.player.playerId, " URL_CHANGE")), 5119 e._state.isFFSend && e._onReset() 5120 } 5121 )), 5122 this.on([F, z], this._onPlaying), 5123 this.on(q, this._onWaiting), 5124 this.on(U, this._onError), 5125 this.on(Te, (function() { 5126 w.logInfo("[xgLogger]".concat(e.player.playerId, " RESET")), 5127 e.endState("reset"), 5128 e._initOnceEvents(), 5129 e._onReset() 5130 } 5131 )) 5132 } 5133 }, { 5134 key: "_initOnceEvents", 5135 value: function() { 5136 this.off(oe, this._onAutoplayStart), 5137 this.off(W, this._onTimeupdate), 5138 this.once(oe, this._onAutoplayStart), 5139 this.once(W, this._onTimeupdate) 5140 } 5141 }, { 5142 key: "_sendFF", 5143 value: function(e) { 5144 this.s = Pt(); 5145 var t = this._state 5146 , i = t.isFFLoading 5147 , n = t.isFFSend; 5148 w.logInfo("[xgLogger]".concat(this.player.playerId, " _sendFF"), "".concat(e, " fvt:").concat(this.fvt, " isFFLoading:").concat(i, " !isFFSend:").concat(!n)), 5149 this.vt > 0 && i && !n && (w.logInfo("[xgLogger]".concat(this.player.playerId, " emitLog_firstFrame"), e), 5150 this._state.isFFLoading = !1, 5151 this._state.isFFSend = !0, 5152 this.emitLog(At, { 5153 fvt: this.fvt, 5154 costTime: this.fvt, 5155 vt: this.vt, 5156 startCostTime: this.startCostTime, 5157 loadedCostTime: this.loadedCostTime 5158 })) 5159 } 5160 }, { 5161 key: "_startWaitTimeout", 5162 value: function() { 5163 var e = this; 5164 this._waittTimer && x.clearTimeout(this, this._waittTimer), 5165 this._waittTimer = x.setTimeout(this, (function() { 5166 e.suspendWaitingStatus("timeout"), 5167 x.clearTimeout(e, e._waittTimer), 5168 e._waittTimer = null 5169 } 5170 ), this.config.waitTimeout) 5171 } 5172 }, { 5173 key: "endState", 5174 value: function(e) { 5175 this.suspendWaitingStatus(e), 5176 this.suspendSeekingStatus(e) 5177 } 5178 }, { 5179 key: "suspendSeekingStatus", 5180 value: function(e) { 5181 if (this.seekingStart) { 5182 var t = Pt() 5183 , i = t - this.seekingStart; 5184 this.seekingStart = 0, 5185 this.emitLog(Mt, { 5186 end: t, 5187 costTime: i, 5188 endType: e 5189 }) 5190 } 5191 } 5192 }, { 5193 key: "suspendWaitingStatus", 5194 value: function(e) { 5195 if (this._waitTimer && (x.clearTimeout(this, this._waitTimer), 5196 this._waitTimer = null), 5197 this._waittTimer && (x.clearTimeout(this, this._waittTimer), 5198 this._waittTimer = null), 5199 this._isWaiting = !1, 5200 this.waitingStart) { 5201 var t = Pt() 5202 , i = t - this.waitingStart 5203 , n = t - this.fixedWaitingStart 5204 , o = this.config.waitTimeout; 5205 this._isWaiting = !1, 5206 this.waitingStart = 0, 5207 this.fixedWaitingStart = 0, 5208 this.emitLog(Rt, { 5209 fixedCostTime: n > o ? o : n, 5210 costTime: i > o ? o : i, 5211 type: "loadeddata" === e ? 1 : this._waitType, 5212 endType: 2 === this._waitType ? "seek" : e 5213 }) 5214 } 5215 } 5216 }, { 5217 key: "emitLog", 5218 value: function(e, i) { 5219 var n = this.player; 5220 this.emit(_e, t({ 5221 t: Pt(), 5222 host: x.getHostFromUrl(n.currentSrc), 5223 vtype: n.vtype, 5224 eventType: e, 5225 currentTime: this.player.currentTime, 5226 readyState: n.video.readyState, 5227 networkState: n.video.networkState 5228 }, i)) 5229 } 5230 }], [{ 5231 key: "pluginName", 5232 get: function() { 5233 return "xgLogger" 5234 } 5235 }, { 5236 key: "defaultConfig", 5237 get: function() { 5238 return { 5239 waitTimeout: 1e4 5240 } 5241 } 5242 }]), 5243 o 5244 }(ot); 5245 function Nt() { 5246 return (new DOMParser).parseFromString('<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">\n <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>\n</svg>\n', "image/svg+xml").firstChild 5247 } 5248 var Ft = function(e) { 5249 a(i, e); 5250 var t = d(i); 5251 function i() { 5252 return n(this, i), 5253 t.apply(this, arguments) 5254 } 5255 return r(i, [{ 5256 key: "registerIcons", 5257 value: function() { 5258 return { 5259 replay: Nt 5260 } 5261 } 5262 }, { 5263 key: "afterCreate", 5264 value: function() { 5265 var e = this; 5266 ot.insert(this.icons.replay, this.root, 0), 5267 this.__handleReplay = this.hook("replayClick", (function() { 5268 e.player.replay() 5269 } 5270 ), { 5271 pre: function(e) { 5272 e.preventDefault(), 5273 e.stopPropagation() 5274 } 5275 }), 5276 this.bind(".xgplayer-replay", ["click", "touchend"], this.__handleReplay), 5277 this.on(H, (function() { 5278 if (e.playerConfig.loop || x.addClass(e.player.root, "replay"), 5279 !e.config.disable) { 5280 e.show(); 5281 var t = e.root.querySelector("path"); 5282 if (t) { 5283 var i = window.getComputedStyle(t).getPropertyValue("transform"); 5284 if ("string" == typeof i && i.indexOf("none") > -1) 5285 return null; 5286 t.setAttribute("transform", i) 5287 } 5288 } 5289 } 5290 )), 5291 this.on(N, (function() { 5292 e.hide() 5293 } 5294 )) 5295 } 5296 }, { 5297 key: "handleReplay", 5298 value: function(e) { 5299 e.preventDefault(), 5300 e.stopPropagation(), 5301 this.player.replay(), 5302 x.removeClass(this.player.root, "replay") 5303 } 5304 }, { 5305 key: "show", 5306 value: function() { 5307 this.config.disable || (this.root.style.display = "flex") 5308 } 5309 }, { 5310 key: "enable", 5311 value: function() { 5312 this.config.disable = !1 5313 } 5314 }, { 5315 key: "disable", 5316 value: function() { 5317 this.config.disable = !0, 5318 this.hide() 5319 } 5320 }, { 5321 key: "destroy", 5322 value: function() { 5323 this.unbind(".xgplayer-replay", ["click", "touchend"], this.__handleReplay) 5324 } 5325 }, { 5326 key: "render", 5327 value: function() { 5328 return '<xg-replay class="xgplayer-replay">\n <xg-replay-txt class="xgplayer-replay-txt" lang-key="'.concat(this.i18nKeys.REPLAY, '">').concat(this.i18n.REPLAY, "</xg-replay-txt>\n </xg-replay>") 5329 } 5330 }], [{ 5331 key: "pluginName", 5332 get: function() { 5333 return "replay" 5334 } 5335 }, { 5336 key: "defaultConfig", 5337 get: function() { 5338 return { 5339 disable: !1 5340 } 5341 } 5342 }]), 5343 i 5344 }(ot) 5345 , Ht = function(e) { 5346 a(i, e); 5347 var t = d(i); 5348 function i() { 5349 return n(this, i), 5350 t.apply(this, arguments) 5351 } 5352 return r(i, [{ 5353 key: "isEndedShow", 5354 get: function() { 5355 return this.config.isEndedShow 5356 }, 5357 set: function(e) { 5358 this.config.isEndedShow = e 5359 } 5360 }, { 5361 key: "hide", 5362 value: function() { 5363 x.addClass(this.root, "hide") 5364 } 5365 }, { 5366 key: "show", 5367 value: function() { 5368 x.removeClass(this.root, "hide") 5369 } 5370 }, { 5371 key: "beforeCreate", 5372 value: function(e) { 5373 "string" == typeof e.player.config.poster && (e.config.poster = e.player.config.poster) 5374 } 5375 }, { 5376 key: "afterCreate", 5377 value: function() { 5378 var e = this; 5379 this.on(H, (function() { 5380 e.isEndedShow && x.removeClass(e.root, "hide") 5381 } 5382 )), 5383 this.config.hideCanplay ? (this.once(W, (function() { 5384 e.onTimeUpdate() 5385 } 5386 )), 5387 this.on(ce, (function() { 5388 x.removeClass(e.root, "hide"), 5389 x.addClass(e.root, "xg-showplay"), 5390 e.once(W, (function() { 5391 e.onTimeUpdate() 5392 } 5393 )) 5394 } 5395 ))) : this.on(N, (function() { 5396 x.addClass(e.root, "hide") 5397 } 5398 )) 5399 } 5400 }, { 5401 key: "onTimeUpdate", 5402 value: function() { 5403 var e = this; 5404 this.player.currentTime ? x.removeClass(this.root, "xg-showplay") : this.once(W, (function() { 5405 e.onTimeUpdate() 5406 } 5407 )) 5408 } 5409 }, { 5410 key: "update", 5411 value: function(e) { 5412 e && (this.config.poster = e, 5413 this.root.style.backgroundImage = "url(".concat(e, ")")) 5414 } 5415 }, { 5416 key: "render", 5417 value: function() { 5418 var e = this.config 5419 , t = e.poster 5420 , i = e.hideCanplay 5421 , n = t ? "background-image:url(".concat(t, ");") : ""; 5422 return '<xg-poster class="xgplayer-poster '.concat(i ? "xg-showplay" : "", '" style="').concat(n, '">\n </xg-poster>') 5423 } 5424 }], [{ 5425 key: "pluginName", 5426 get: function() { 5427 return "poster" 5428 } 5429 }, { 5430 key: "defaultConfig", 5431 get: function() { 5432 return { 5433 isEndedShow: !0, 5434 hideCanplay: !1, 5435 poster: "" 5436 } 5437 } 5438 }]), 5439 i 5440 }(ot); 5441 function Bt() { 5442 return (new DOMParser).parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n', "image/svg+xml").firstChild 5443 } 5444 function Ut() { 5445 return (new DOMParser).parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n', "image/svg+xml").firstChild 5446 } 5447 var Vt = {}; 5448 var Gt = function(e) { 5449 a(i, e); 5450 var t = d(i); 5451 function i(e) { 5452 var o; 5453 return n(this, i), 5454 s(u(o = t.call(this, e)), "onPlayerReset", (function() { 5455 o.autoPlayStart = !1; 5456 var e = "auto" === o.config.mode ? "auto-hide" : "hide"; 5457 o.setAttr("data-state", "play"), 5458 x.removeClass(o.root, e), 5459 o.show() 5460 } 5461 )), 5462 s(u(o), "onAutoplayStart", (function() { 5463 if (!o.autoPlayStart) { 5464 var e = "auto" === o.config.mode ? "auto-hide" : "hide"; 5465 x.addClass(o.root, e), 5466 o.autoPlayStart = !0, 5467 o.onPlayPause("play") 5468 } 5469 } 5470 )), 5471 o.autoPlayStart = !1, 5472 o 5473 } 5474 return r(i, [{ 5475 key: "afterCreate", 5476 value: function() { 5477 var e = this 5478 , t = this.player 5479 , i = this.playerConfig; 5480 this.initIcons(), 5481 this.once(ie, (function() { 5482 i && (i.lang && "en" === i.lang ? x.addClass(t.root, "lang-is-en") : "jp" === i.lang && x.addClass(t.root, "lang-is-jp")) 5483 } 5484 )), 5485 this.on(oe, this.onAutoplayStart), 5486 i.autoplay || this.show(), 5487 this.on(re, (function() { 5488 var t = "auto" === e.config.mode ? "auto-hide" : "hide"; 5489 e.setAttr("data-state", "play"), 5490 x.removeClass(e.root, t), 5491 e.show() 5492 } 5493 )), 5494 this.on(N, (function() { 5495 e.onPlayPause("play") 5496 } 5497 )), 5498 this.on(B, (function() { 5499 e.onPlayPause("pause") 5500 } 5501 )), 5502 this.on(Te, (function() { 5503 e.onPlayerReset() 5504 } 5505 )), 5506 this.clickHandler = this.hook("startClick", this.switchPausePlay, { 5507 pre: function(t) { 5508 t.cancelable && t.preventDefault(), 5509 t.stopPropagation(); 5510 var i = e.player.paused; 5511 e.emitUserAction(t, "switch_play_pause", { 5512 props: "paused", 5513 from: i, 5514 to: !i 5515 }) 5516 } 5517 }), 5518 this.bind(["click", "touchend"], this.clickHandler) 5519 } 5520 }, { 5521 key: "registerIcons", 5522 value: function() { 5523 return { 5524 startPlay: { 5525 icon: Bt, 5526 class: "xg-icon-play" 5527 }, 5528 startPause: { 5529 icon: Ut, 5530 class: "xg-icon-pause" 5531 } 5532 } 5533 } 5534 }, { 5535 key: "initIcons", 5536 value: function() { 5537 var e = this.icons; 5538 this.appendChild("xg-start-inner", e.startPlay), 5539 this.appendChild("xg-start-inner", e.startPause) 5540 } 5541 }, { 5542 key: "hide", 5543 value: function() { 5544 x.addClass(this.root, "hide") 5545 } 5546 }, { 5547 key: "show", 5548 value: function() { 5549 x.removeClass(this.root, "hide") 5550 } 5551 }, { 5552 key: "focusHide", 5553 value: function() { 5554 x.addClass(this.root, "focus-hide") 5555 } 5556 }, { 5557 key: "recover", 5558 value: function() { 5559 x.removeClass(this.root, "focus-hide") 5560 } 5561 }, { 5562 key: "switchStatus", 5563 value: function(e) { 5564 e ? this.setAttr("data-state", this.player.paused ? "pause" : "play") : this.setAttr("data-state", this.player.paused ? "play" : "pause") 5565 } 5566 }, { 5567 key: "animate", 5568 value: function(e) { 5569 var t = this; 5570 !function(e, t) { 5571 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { 5572 start: null, 5573 end: null 5574 }; 5575 Vt[e] && window.clearTimeout(Vt[e].id), 5576 Vt[e] = {}, 5577 i.start && i.start(), 5578 Vt[e].id = window.setTimeout((function() { 5579 i.end && i.end(), 5580 window.clearTimeout(Vt[e].id), 5581 delete Vt[e] 5582 } 5583 ), t) 5584 }("pauseplay", 400, { 5585 start: function() { 5586 x.addClass(t.root, "interact"), 5587 t.show(), 5588 t.switchStatus(!0) 5589 }, 5590 end: function() { 5591 x.removeClass(t.root, "interact"), 5592 !e && t.hide() 5593 } 5594 }) 5595 } 5596 }, { 5597 key: "switchPausePlay", 5598 value: function(e) { 5599 var t = this.player; 5600 (e.cancelable && e.preventDefault(), 5601 e.stopPropagation(), 5602 t.state < ht) || (this.player.paused || t.state !== gt ? t.play() : t.pause()) 5603 } 5604 }, { 5605 key: "onPlayPause", 5606 value: function(e) { 5607 var t = this.config 5608 , i = this.player; 5609 if (!(i.state < gt) && this.autoPlayStart) { 5610 if ("show" === t.mode) 5611 return this.switchStatus(), 5612 void this.show(); 5613 if ("auto" !== t.mode) { 5614 if (t.isShowPause && i.paused && !i.ended || t.isShowEnd && i.ended) 5615 return this.switchStatus(), 5616 void this.show(); 5617 if (t.disableAnimate) 5618 return this.switchStatus(), 5619 void this.hide(); 5620 if ("play" === e) 5621 this.autoPlayStart ? this.animate() : this.hide(); 5622 else { 5623 if (!this.autoPlayStart || i.ended) 5624 return; 5625 this.animate() 5626 } 5627 } else 5628 this.switchStatus() 5629 } 5630 } 5631 }, { 5632 key: "destroy", 5633 value: function() { 5634 this.unbind(["click", "touchend"], this.clickHandler), 5635 Object.keys(Vt).map((function(e) { 5636 window.clearTimeout(Vt[e].id), 5637 delete Vt[e] 5638 } 5639 )) 5640 } 5641 }, { 5642 key: "render", 5643 value: function() { 5644 var e = this.playerConfig.autoplay ? "auto" === this.config.mode ? "auto-hide" : "hide" : ""; 5645 return '\n <xg-start class="xgplayer-start '.concat(e, '">\n <xg-start-inner></xg-start-inner>\n </xg-start>') 5646 } 5647 }], [{ 5648 key: "pluginName", 5649 get: function() { 5650 return "start" 5651 } 5652 }, { 5653 key: "defaultConfig", 5654 get: function() { 5655 return { 5656 isShowPause: !1, 5657 isShowEnd: !1, 5658 disableAnimate: !1, 5659 mode: "hide" 5660 } 5661 } 5662 }]), 5663 i 5664 }(ot) 5665 , Wt = function(e) { 5666 a(i, e); 5667 var t = d(i); 5668 function i() { 5669 return n(this, i), 5670 t.apply(this, arguments) 5671 } 5672 return r(i, [{ 5673 key: "render", 5674 value: function() { 5675 var e = this.config.innerHtml 5676 , t = x.createDom("xg-enter", "", {}, "xgplayer-enter"); 5677 if (e && e instanceof window.HTMLElement) 5678 t.appendChild(e); 5679 else if (e && "string" == typeof e) 5680 t.innerHTML = e; 5681 else { 5682 for (var i = "", n = 1; n <= 12; n++) 5683 i += '<div class="xgplayer-enter-bar'.concat(n, '"></div>'); 5684 t.innerHTML = '<div class="xgplayer-enter-spinner">'.concat(i, "</div>") 5685 } 5686 return t 5687 } 5688 }], [{ 5689 key: "pluginName", 5690 get: function() { 5691 return "enter" 5692 } 5693 }, { 5694 key: "defaultConfig", 5695 get: function() { 5696 return { 5697 innerHtml: "", 5698 logo: "" 5699 } 5700 } 5701 }]), 5702 i 5703 }(ot); 5704 function qt(e, t, i) { 5705 try { 5706 return ' <div class="xg-tips '.concat(i ? "hide" : " ", '" lang-key="').concat(e.i18nKeys[t], '">\n ').concat(e.i18n[t], "\n </div>") 5707 } catch (n) { 5708 return '<div class="xg-tips hide"></div>' 5709 } 5710 } 5711 var zt = function(e) { 5712 a(i, e); 5713 var t = d(i); 5714 function i() { 5715 return n(this, i), 5716 t.apply(this, arguments) 5717 } 5718 return r(i, [{ 5719 key: "afterCreate", 5720 value: function() { 5721 this.getMini = this.getMini.bind(this), 5722 this.exitMini = this.exitMini.bind(this), 5723 this.bind("click", this.getMini) 5724 } 5725 }, { 5726 key: "getMini", 5727 value: function() { 5728 this.config.onClick && this.config.onClick() 5729 } 5730 }, { 5731 key: "exitMini", 5732 value: function() { 5733 this.config.onClick && this.config.onClick() 5734 } 5735 }, { 5736 key: "destroy", 5737 value: function() { 5738 this.unbind(["click", "touchend"], this.getMini) 5739 } 5740 }, { 5741 key: "render", 5742 value: function() { 5743 var e = "MINISCREEN"; 5744 return '\n <xg-icon class="xgplayer-miniicon">\n <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[e], '">').concat(this.i18n[e], "</span></div>\n </xg-icon>") 5745 } 5746 }], [{ 5747 key: "pluginName", 5748 get: function() { 5749 return "miniscreenIcon" 5750 } 5751 }, { 5752 key: "defaultConfig", 5753 get: function() { 5754 return { 5755 position: et.CONTROLS_RIGHT, 5756 index: 10 5757 } 5758 } 5759 }]), 5760 i 5761 }(ot); 5762 function Kt(e) { 5763 var t = parseFloat(e); 5764 return -1 === e.indexOf("%") && !Number.isNaN(t) && t 5765 } 5766 var Yt = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "marginLeft", "marginRight", "marginTop", "marginBottom", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"] 5767 , Xt = Yt.length; 5768 function Zt(e) { 5769 if ("string" == typeof e && (e = document.querySelector(e)), 5770 e && "object" === i(e) && e.nodeType) { 5771 var t = function(e) { 5772 return window.getComputedStyle(e) 5773 }(e); 5774 if ("none" === t.display) 5775 return function() { 5776 for (var e = { 5777 width: 0, 5778 height: 0, 5779 innerWidth: 0, 5780 innerHeight: 0, 5781 outerWidth: 0, 5782 outerHeight: 0 5783 }, t = 0; t < Xt; t++) 5784 e[Yt[t]] = 0; 5785 return e 5786 }(); 5787 var n = {}; 5788 n.width = e.offsetWidth, 5789 n.height = e.offsetHeight; 5790 for (var o = n.isBorderBox = "border-box" === t.boxSizing, r = 0; r < Xt; r++) { 5791 var s = Yt[r] 5792 , a = t[s] 5793 , l = parseFloat(a); 5794 n[s] = Number.isNaN(l) ? 0 : l 5795 } 5796 var c = n.paddingLeft + n.paddingRight 5797 , u = n.paddingTop + n.paddingBottom 5798 , h = n.marginLeft + n.marginRight 5799 , d = n.marginTop + n.marginBottom 5800 , f = n.borderLeftWidth + n.borderRightWidth 5801 , p = n.borderTopWidth + n.borderBottomWidth 5802 , g = o 5803 , v = Kt(t.width); 5804 !1 !== v && (n.width = v + (g ? 0 : c + f)); 5805 var y = Kt(t.height); 5806 return !1 !== y && (n.height = y + (g ? 0 : u + p)), 5807 n.innerWidth = n.width - (c + f), 5808 n.innerHeight = n.height - (u + p), 5809 n.outerWidth = n.width + h, 5810 n.outerHeight = n.height + d, 5811 n 5812 } 5813 } 5814 function Jt(e, t) { 5815 for (var i = 0; i < e.length; i++) { 5816 var n = e[i]; 5817 if (n.identifier === t) 5818 return n 5819 } 5820 } 5821 var $t = "dragStart" 5822 , Qt = "dragMove" 5823 , ei = "dragEnded" 5824 , ti = { 5825 mousedown: ["mousemove", "mouseup"], 5826 touchstart: ["touchmove", "touchend", "touchcancel"], 5827 pointerdown: ["pointermove", "pointerup", "pointercancel"] 5828 } 5829 , ii = function(e) { 5830 a(i, e); 5831 var t = d(i); 5832 function i(e) { 5833 var o, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 5834 return n(this, i), 5835 (o = t.call(this)).isEnabled = !0, 5836 o.isDragging = !1, 5837 o.isDown = !1, 5838 o.position = {}, 5839 o.downPoint = {}, 5840 o.dragPoint = { 5841 x: 0, 5842 y: 0 5843 }, 5844 o.startPos = { 5845 x: 0, 5846 y: 0 5847 }, 5848 o._root = e instanceof Element ? e : document.querySelector(e), 5849 o._handlerDom = r.handle instanceof Element ? r.handle : document.querySelector(r.handle), 5850 o._root && o._handlerDom ? (o._bindStartEvent(), 5851 o) : h(o) 5852 } 5853 return r(i, [{ 5854 key: "_bindStartEvent", 5855 value: function() { 5856 var e = this; 5857 "ontouchstart"in window ? this._startKey = "touchstart" : this._startKey = "mousedown", 5858 this["on".concat(this._startKey)] = this["on".concat(this._startKey)].bind(this), 5859 this._handlerDom.addEventListener(this._startKey, this["on".concat(this._startKey)]), 5860 ti[this._startKey].map((function(t) { 5861 e["on".concat(t)] = e["on".concat(t)].bind(e) 5862 } 5863 )) 5864 } 5865 }, { 5866 key: "_unbindStartEvent", 5867 value: function() { 5868 this._handlerDom.removeEventListener(this._startKey, this["on".concat(this._startKey)]) 5869 } 5870 }, { 5871 key: "_bindPostStartEvents", 5872 value: function(e) { 5873 var t = this; 5874 if (e) { 5875 var i = ti[this._startKey]; 5876 i.map((function(e) { 5877 window.addEventListener(e, t["on".concat(e)]) 5878 } 5879 )), 5880 this._boundPointerEvents = i 5881 } 5882 } 5883 }, { 5884 key: "_unbindPostStartEvents", 5885 value: function() { 5886 var e = this; 5887 this._boundPointerEvents && (this._boundPointerEvents.map((function(t) { 5888 window.removeEventListener(t, e["on".concat(t)]) 5889 } 5890 )), 5891 delete this._boundPointerEvents) 5892 } 5893 }, { 5894 key: "enable", 5895 value: function() { 5896 this.isEnabled = !0 5897 } 5898 }, { 5899 key: "disable", 5900 value: function() { 5901 this.isEnabled = !1, 5902 this.isDragging && this.onUp() 5903 } 5904 }, { 5905 key: "onDocUp", 5906 value: function(e) { 5907 this.onUp() 5908 } 5909 }, { 5910 key: "animate", 5911 value: function() { 5912 var e = this; 5913 this.isDragging && (this.positionDrag(), 5914 window.requestAnimationFrame((function() { 5915 e.animate() 5916 } 5917 ))) 5918 } 5919 }, { 5920 key: "positionDrag", 5921 value: function() { 5922 var e = "translate3d(".concat(this.dragPoint.x, "px, ").concat(this.dragPoint.y, "px, 0)"); 5923 this._root.style.transform = e, 5924 this._root.style.webKitTransform = e 5925 } 5926 }, { 5927 key: "setLeftTop", 5928 value: function() { 5929 this._root.style.left = this.position.x + "px", 5930 this._root.style.top = this.position.y + "px" 5931 } 5932 }, { 5933 key: "onmousedown", 5934 value: function(e) { 5935 this.dragStart(e, e) 5936 } 5937 }, { 5938 key: "onmousemove", 5939 value: function(e) { 5940 this.dragMove(e, e) 5941 } 5942 }, { 5943 key: "onmouseup", 5944 value: function(e) { 5945 this.dragEnd(e, e) 5946 } 5947 }, { 5948 key: "ontouchstart", 5949 value: function(e) { 5950 var t = e.changedTouches[0]; 5951 this.dragStart(e, t), 5952 this.touchIdentifier = void 0 !== t.pointerId ? t.pointerId : t.identifier, 5953 e.preventDefault() 5954 } 5955 }, { 5956 key: "ontouchmove", 5957 value: function(e) { 5958 var t = Jt(e.changedTouches, this.touchIdentifier); 5959 t && this.dragMove(e, t) 5960 } 5961 }, { 5962 key: "ontouchend", 5963 value: function(e) { 5964 var t = Jt(e.changedTouches, this.touchIdentifier); 5965 t && this.dragEnd(e, t), 5966 e.preventDefault() 5967 } 5968 }, { 5969 key: "ontouchcancel", 5970 value: function(e) { 5971 var t = Jt(e.changedTouches, this.touchIdentifier); 5972 t && this.dragCancel(e, t) 5973 } 5974 }, { 5975 key: "dragStart", 5976 value: function(e, t) { 5977 if (this._root && !this.isDown && this.isEnabled) { 5978 this.downPoint = t, 5979 this.dragPoint.x = 0, 5980 this.dragPoint.y = 0, 5981 this._getPosition(); 5982 var i = Zt(this._root); 5983 this.startPos.x = this.position.x, 5984 this.startPos.y = this.position.y, 5985 this.startPos.maxY = window.innerHeight - i.height, 5986 this.startPos.maxX = window.innerWidth - i.width, 5987 this.setLeftTop(), 5988 this.isDown = !0, 5989 this._bindPostStartEvents(e) 5990 } 5991 } 5992 }, { 5993 key: "dragRealStart", 5994 value: function(e, t) { 5995 this.isDragging = !0, 5996 this.animate(), 5997 this.emit($t, this.startPos) 5998 } 5999 }, { 6000 key: "dragEnd", 6001 value: function(e, t) { 6002 this._root && (this._unbindPostStartEvents(), 6003 this.isDragging && (this._root.style.transform = "", 6004 this.setLeftTop(), 6005 this.emit(ei)), 6006 this.presetInfo()) 6007 } 6008 }, { 6009 key: "_dragPointerMove", 6010 value: function(e, t) { 6011 var i = { 6012 x: t.pageX - this.downPoint.pageX, 6013 y: t.pageY - this.downPoint.pageY 6014 }; 6015 return !this.isDragging && this.hasDragStarted(i) && this.dragRealStart(e, t), 6016 i 6017 } 6018 }, { 6019 key: "dragMove", 6020 value: function(e, t) { 6021 if (e = e || window.event, 6022 this.isDown) { 6023 var i = this.startPos 6024 , n = i.x 6025 , o = i.y 6026 , r = this._dragPointerMove(e, t) 6027 , s = r.x 6028 , a = r.y; 6029 s = this.checkContain("x", s, n), 6030 a = this.checkContain("y", a, o), 6031 this.position.x = n + s, 6032 this.position.y = o + a, 6033 this.dragPoint.x = s, 6034 this.dragPoint.y = a, 6035 this.emit(Qt, this.position) 6036 } 6037 } 6038 }, { 6039 key: "dragCancel", 6040 value: function(e, t) { 6041 this.dragEnd(e, t) 6042 } 6043 }, { 6044 key: "presetInfo", 6045 value: function() { 6046 this.isDragging = !1, 6047 this.startPos = { 6048 x: 0, 6049 y: 0 6050 }, 6051 this.dragPoint = { 6052 x: 0, 6053 y: 0 6054 }, 6055 this.isDown = !1 6056 } 6057 }, { 6058 key: "destroy", 6059 value: function() { 6060 this._unbindStartEvent(), 6061 this._unbindPostStartEvents(), 6062 this.isDragging && this.dragEnd(), 6063 this.removeAllListeners(), 6064 this._handlerDom = null 6065 } 6066 }, { 6067 key: "hasDragStarted", 6068 value: function(e) { 6069 return Math.abs(e.x) > 3 || Math.abs(e.y) > 3 6070 } 6071 }, { 6072 key: "checkContain", 6073 value: function(e, t, i) { 6074 return t + i < 0 ? 0 - i : "x" === e && t + i > this.startPos.maxX ? this.startPos.maxX - i : "y" === e && t + i > this.startPos.maxY ? this.startPos.maxY - i : t 6075 } 6076 }, { 6077 key: "_getPosition", 6078 value: function() { 6079 var e = window.getComputedStyle(this._root) 6080 , t = this._getPositionCoord(e.left, "width") 6081 , i = this._getPositionCoord(e.top, "height"); 6082 this.position.x = Number.isNaN(t) ? 0 : t, 6083 this.position.y = Number.isNaN(i) ? 0 : i, 6084 this._addTransformPosition(e) 6085 } 6086 }, { 6087 key: "_addTransformPosition", 6088 value: function(e) { 6089 var t = e.transform; 6090 if (0 === t.indexOf("matrix")) { 6091 var i = t.split(",") 6092 , n = 0 === t.indexOf("matrix3d") ? 12 : 4 6093 , o = parseInt(i[n], 10) 6094 , r = parseInt(i[n + 1], 10); 6095 this.position.x += o, 6096 this.position.y += r 6097 } 6098 } 6099 }, { 6100 key: "_getPositionCoord", 6101 value: function(e, t) { 6102 if (-1 !== e.indexOf("%")) { 6103 var i = Zt(this._root.parentNode); 6104 return i ? parseFloat(e) / 100 * i[t] : 0 6105 } 6106 return parseInt(e, 10) 6107 } 6108 }]), 6109 i 6110 }(k) 6111 , ni = function(e) { 6112 a(i, e); 6113 var t = d(i); 6114 function i(e) { 6115 var o; 6116 n(this, i), 6117 s(u(o = t.call(this, e)), "onCancelClick", (function(e) { 6118 o.exitMini(), 6119 o.isClose = !0 6120 } 6121 )), 6122 s(u(o), "onCenterClick", (function(e) { 6123 var t = u(o).player; 6124 t.paused ? t.play() : t.pause() 6125 } 6126 )), 6127 s(u(o), "onScroll", (function(e) { 6128 if (!(!window.scrollY && 0 !== window.scrollY || Math.abs(window.scrollY - o.pos.scrollY) < 50)) { 6129 var t = parseInt(x.getCss(o.player.root, "height")); 6130 t += o.config.scrollTop, 6131 o.pos.scrollY = window.scrollY, 6132 window.scrollY > t + 5 ? !o.isMini && !o.isClose && o.getMini() : window.scrollY <= t && (o.isMini && o.exitMini(), 6133 o.isClose = !1) 6134 } 6135 } 6136 )), 6137 o.isMini = !1, 6138 o.isClose = !1; 6139 var r = u(o).config; 6140 return o.pos = { 6141 left: r.left < 0 ? window.innerWidth - r.width - 20 : r.left, 6142 top: r.top < 0 ? window.innerHeight - r.height - 20 : r.top, 6143 height: o.config.height, 6144 width: o.config.width, 6145 scrollY: window.scrollY || 0 6146 }, 6147 o.lastStyle = null, 6148 o 6149 } 6150 return r(i, [{ 6151 key: "beforeCreate", 6152 value: function(e) { 6153 "boolean" == typeof e.player.config.mini && (e.config.isShowIcon = e.player.config.mini) 6154 } 6155 }, { 6156 key: "afterCreate", 6157 value: function() { 6158 var e = this; 6159 this.initIcons(), 6160 this.on(B, (function() { 6161 e.setAttr("data-state", "pause") 6162 } 6163 )), 6164 this.on(N, (function() { 6165 e.setAttr("data-state", "play") 6166 } 6167 )) 6168 } 6169 }, { 6170 key: "onPluginsReady", 6171 value: function() { 6172 var e = this 6173 , t = this.player; 6174 if (!this.config.disable) { 6175 if (this.config.isShowIcon) { 6176 var i = { 6177 config: { 6178 onClick: function() { 6179 e.getMini() 6180 } 6181 } 6182 }; 6183 t.controls.registerPlugin(zt, i, zt.pluginName) 6184 } 6185 var n = x.checkTouchSupport() ? "touchend" : "click"; 6186 this.bind(".mini-cancel-btn", n, this.onCancelClick), 6187 this.bind(".play-icon", n, this.onCenterClick), 6188 this.config.disableDrag || (this._draggabilly = new ii(this.player.root,{ 6189 handle: this.root 6190 })), 6191 this.config.isScrollSwitch && window.addEventListener("scroll", this.onScroll) 6192 } 6193 } 6194 }, { 6195 key: "registerIcons", 6196 value: function() { 6197 return { 6198 play: { 6199 icon: Bt, 6200 class: "xg-icon-play" 6201 }, 6202 pause: { 6203 icon: Ut, 6204 class: "xg-icon-pause" 6205 } 6206 } 6207 } 6208 }, { 6209 key: "initIcons", 6210 value: function() { 6211 var e = this.icons; 6212 this.appendChild(".play-icon", e.play), 6213 this.appendChild(".play-icon", e.pause) 6214 } 6215 }, { 6216 key: "getMini", 6217 value: function() { 6218 var e = this; 6219 if (!this.isMini) { 6220 var t = this.player 6221 , i = this.playerConfig 6222 , n = this.config.target || this.player.root; 6223 this.lastStyle = {}, 6224 x.addClass(t.root, "xgplayer-mini"), 6225 ["width", "height", "top", "left"].map((function(t) { 6226 e.lastStyle[t] = n.style[t], 6227 n.style[t] = "".concat(e.pos[t], "px") 6228 } 6229 )), 6230 i.fluid && (n.style["padding-top"] = ""), 6231 this.emit(fe, !0), 6232 t.isMini = this.isMini = !0 6233 } 6234 } 6235 }, { 6236 key: "exitMini", 6237 value: function() { 6238 var e = this; 6239 if (!this.isMini) 6240 return !1; 6241 var t = this.player 6242 , i = this.playerConfig 6243 , n = this.config.target || this.player.root; 6244 x.removeClass(t.root, "xgplayer-mini"), 6245 this.lastStyle && Object.keys(this.lastStyle).map((function(t) { 6246 n.style[t] = e.lastStyle[t] 6247 } 6248 )), 6249 this.lastStyle = null, 6250 i.fluid && (t.root.style.width = "100%", 6251 t.root.style.height = "0", 6252 t.root.style["padding-top"] = "".concat(100 * i.height / i.width, "%")), 6253 this.emit(fe, !1), 6254 this.isMini = t.isMini = !1 6255 } 6256 }, { 6257 key: "destroy", 6258 value: function() { 6259 window.removeEventListener("scroll", this.onScroll); 6260 var e = x.checkTouchSupport() ? "touchend" : "click"; 6261 this.unbind(".mini-cancel-btn", e, this.onCancelClick), 6262 this.unbind(".play-icon", e, this.onCenterClick), 6263 this._draggabilly && this._draggabilly.destroy(), 6264 this._draggabilly = null, 6265 this.exitMini() 6266 } 6267 }, { 6268 key: "render", 6269 value: function() { 6270 if (!this.config.disable) 6271 return '\n <xg-mini-layer class="xg-mini-layer">\n <xg-mini-header class="xgplayer-mini-header">\n '.concat(qt(this, "MINI_DRAG", this.playerConfig.isHideTips), '\n </xg-mini-header>\n <div class="mini-cancel-btn">\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">\n <path fill="#fff" fill-rule="evenodd" d="M3.99 3.49a1 1 0 0 1 1.414 0L10 8.085l4.596-4.595a1 1 0 1 1 1.414 1.414L11.414 9.5l4.596 4.596a1 1 0 0 1 .084 1.32l-.084.094a1 1 0 0 1-1.414 0L10 10.914 5.404 15.51a1 1 0 0 1-1.414-1.414L8.585 9.5 3.99 4.904a1 1 0 0 1-.084-1.32z"></path>\n </svg>\n </div>\n <div class="play-icon">\n </div>\n </xg-mini-layer>') 6272 } 6273 }], [{ 6274 key: "pluginName", 6275 get: function() { 6276 return "miniscreen" 6277 } 6278 }, { 6279 key: "defaultConfig", 6280 get: function() { 6281 return { 6282 index: 10, 6283 disable: !1, 6284 width: 320, 6285 height: 180, 6286 left: -1, 6287 top: -1, 6288 isShowIcon: !1, 6289 isScrollSwitch: !1, 6290 scrollTop: 0, 6291 disableDrag: !1 6292 } 6293 } 6294 }]), 6295 i 6296 }(ot) 6297 , oi = { 6298 mouseenter: "onMouseEnter", 6299 mouseleave: "onMouseLeave", 6300 mousemove: "onMouseMove" 6301 } 6302 , ri = ["videoClick", "videoDbClick"] 6303 , si = function(e) { 6304 a(i, e); 6305 var t = d(i); 6306 function i() { 6307 var e; 6308 n(this, i); 6309 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 6310 r[a] = arguments[a]; 6311 return s(u(e = t.call.apply(t, [this].concat(r))), "onMouseMove", (function(t) { 6312 var i = u(e) 6313 , n = i.player 6314 , o = i.playerConfig; 6315 n.isActive || (n.focus({ 6316 autoHide: !o.closeDelayBlur 6317 }), 6318 !o.closeFocusVideoFocus && n.media.focus()) 6319 } 6320 )), 6321 s(u(e), "onMouseEnter", (function(t) { 6322 var i = u(e) 6323 , n = i.playerConfig 6324 , o = i.player; 6325 !n.closeFocusVideoFocus && o.media.focus(), 6326 n.closeDelayBlur ? o.focus({ 6327 autoHide: !1 6328 }) : o.focus() 6329 } 6330 )), 6331 s(u(e), "onMouseLeave", (function(t) { 6332 var i = e.playerConfig 6333 , n = i.closePlayerBlur 6334 , o = i.leavePlayerTime 6335 , r = i.closeDelayBlur; 6336 n || r || (o ? e.player.focus({ 6337 autoHide: !0, 6338 delay: o 6339 }) : e.player.blur()) 6340 } 6341 )), 6342 s(u(e), "onVideoClick", (function(t) { 6343 var i = u(e) 6344 , n = i.player 6345 , o = i.playerConfig; 6346 t.target && o.closeVideoClick || t.target !== n.root && t.target !== n.media && t.target !== n.innerContainer && t.target !== n.media.__canvas || (t.preventDefault(), 6347 o.closeVideoStopPropagation || t.stopPropagation(), 6348 e._clickCount++, 6349 e.clickTimer && (clearTimeout(e.clickTimer), 6350 e.clickTimer = null), 6351 e.clickTimer = setTimeout((function() { 6352 e._clickCount && (e._clickCount--, 6353 qe(u(e), ri[0], (function(t, i) { 6354 e.switchPlayPause(i.e) 6355 } 6356 ), { 6357 e: t, 6358 paused: n.paused 6359 }), 6360 clearTimeout(e.clickTimer), 6361 e.clickTimer = null) 6362 } 6363 ), 300)) 6364 } 6365 )), 6366 s(u(e), "onVideoDblClick", (function(t) { 6367 var i = u(e) 6368 , n = i.player; 6369 i.playerConfig.closeVideoDblclick || !t.target || t.target !== n.media && t.target !== n.media.__canvas || (e._clickCount < 2 ? e._clickCount = 0 : (e._clickCount = 0, 6370 e.clickTimer && (clearTimeout(e.clickTimer), 6371 e.clickTimer = null), 6372 t.preventDefault(), 6373 t.stopPropagation(), 6374 qe(u(e), ri[1], (function(t, i) { 6375 e.emitUserAction(i.e, "switch_fullscreen", { 6376 props: "fullscreen", 6377 from: n.fullscreen, 6378 to: !n.fullscreen 6379 }), 6380 n.fullscreen ? n.exitFullscreen() : n.getFullscreen() 6381 } 6382 ), { 6383 e: t, 6384 fullscreen: n.fullscreen 6385 }))) 6386 } 6387 )), 6388 e 6389 } 6390 return r(i, [{ 6391 key: "afterCreate", 6392 value: function() { 6393 var e = this; 6394 this._clickCount = 0, 6395 ri.map((function(t) { 6396 e.__hooks[t] = null 6397 } 6398 )), 6399 "mobile" === this.playerConfig.isMobileSimulateMode || "mobile" === O.device && !O.os.isIpad || this.initEvents() 6400 } 6401 }, { 6402 key: "initEvents", 6403 value: function() { 6404 var e = this 6405 , t = this.player 6406 , i = t.video 6407 , n = t.root 6408 , o = this.playerConfig.enableContextmenu; 6409 n && n.addEventListener("click", this.onVideoClick, !1), 6410 n && n.addEventListener("dblclick", this.onVideoDblClick, !1), 6411 Object.keys(oi).map((function(t) { 6412 n.addEventListener(t, e[oi[t]], !1) 6413 } 6414 )), 6415 o && i && i.addEventListener("contextmenu", this.onContextmenu, !1) 6416 } 6417 }, { 6418 key: "switchPlayPause", 6419 value: function(e) { 6420 var t = this.player; 6421 this.emitUserAction(e, "switch_play_pause", { 6422 props: "paused", 6423 from: t.paused, 6424 to: !t.paused 6425 }), 6426 t.ended ? t.duration !== 1 / 0 && t.duration > 0 && t.replay() : t.paused ? t.play() : t.pause() 6427 } 6428 }, { 6429 key: "onContextmenu", 6430 value: function(e) { 6431 (e = e || window.event).preventDefault && e.preventDefault(), 6432 e.stopPropagation ? e.stopPropagation() : (e.returnValue = !1, 6433 e.cancelBubble = !0) 6434 } 6435 }, { 6436 key: "destroy", 6437 value: function() { 6438 var e = this 6439 , t = this.player 6440 , i = t.video 6441 , n = t.root; 6442 this.clickTimer && clearTimeout(this.clickTimer), 6443 n.removeEventListener("click", this.onVideoClick, !1), 6444 n.removeEventListener("dblclick", this.onVideoDblClick, !1), 6445 i.removeEventListener("contextmenu", this.onContextmenu, !1), 6446 Object.keys(oi).map((function(t) { 6447 n.removeEventListener(t, e[oi[t]], !1) 6448 } 6449 )) 6450 } 6451 }], [{ 6452 key: "pluginName", 6453 get: function() { 6454 return "pc" 6455 } 6456 }, { 6457 key: "defaultConfig", 6458 get: function() { 6459 return {} 6460 } 6461 }]), 6462 i 6463 }(Ke) 6464 , ai = "press" 6465 , li = "pressend" 6466 , ci = "doubleclick" 6467 , ui = "click" 6468 , hi = "touchmove" 6469 , di = "touchstart" 6470 , fi = "touchend" 6471 , pi = { 6472 start: "touchstart", 6473 end: "touchend", 6474 move: "touchmove", 6475 cancel: "touchcancel" 6476 } 6477 , gi = { 6478 start: "mousedown", 6479 end: "mouseup", 6480 move: "mousemove", 6481 cancel: "mouseleave" 6482 }; 6483 function vi(e) { 6484 return e && e.length > 0 ? e[e.length - 1] : null 6485 } 6486 function yi(e) { 6487 var t = navigator.userAgent; 6488 /(?:iPhone|iPad)/.test(t) && e.cancelable && e.preventDefault() 6489 } 6490 var mi = function() { 6491 function e(t) { 6492 var i = this 6493 , o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { 6494 eventType: "touch" 6495 }; 6496 n(this, e), 6497 this._pos = { 6498 moving: !1, 6499 start: !1, 6500 x: 0, 6501 y: 0 6502 }, 6503 this.config = { 6504 pressDelay: 600, 6505 dbClickDelay: 200, 6506 disablePress: !1, 6507 disableDbClick: !1, 6508 miniStep: 2, 6509 needPreventDefault: !0 6510 }, 6511 Object.keys(o).map((function(e) { 6512 i.config[e] = o[e] 6513 } 6514 )), 6515 this.root = t, 6516 this.events = "mouse" === o.eventType ? gi : pi, 6517 this.pressIntrvalId = null, 6518 this.dbIntrvalId = null, 6519 this.__handlers = {}, 6520 this._initEvent() 6521 } 6522 return r(e, [{ 6523 key: "_initEvent", 6524 value: function() { 6525 this.onTouchStart = this.onTouchStart.bind(this), 6526 this.onTouchMove = this.onTouchMove.bind(this), 6527 this.onTouchEnd = this.onTouchEnd.bind(this), 6528 this.onTouchCancel = this.onTouchCancel.bind(this), 6529 this.root.addEventListener(this.events.start, this.onTouchStart) 6530 } 6531 }, { 6532 key: "__setPress", 6533 value: function(e) { 6534 var t = this 6535 , i = this.config; 6536 this.pressIntrvalId && this.__clearPress(), 6537 this.pressIntrvalId = setTimeout((function() { 6538 t.trigger(ai, e), 6539 t._pos.press = !0, 6540 t.__clearPress() 6541 } 6542 ), i.pressDelay) 6543 } 6544 }, { 6545 key: "__clearPress", 6546 value: function() { 6547 window.clearTimeout(this.pressIntrvalId), 6548 this.pressIntrvalId = null 6549 } 6550 }, { 6551 key: "__setDb", 6552 value: function(e) { 6553 var t = this 6554 , i = this.config; 6555 if (this.dbIntrvalId) 6556 return this.__clearDb(), 6557 void this.trigger(ci, e); 6558 this.dbIntrvalId = setTimeout((function() { 6559 t.__clearDb(), 6560 t._pos.start || t._pos.press || t._pos.moving || t.trigger(ui, e) 6561 } 6562 ), i.dbClickDelay) 6563 } 6564 }, { 6565 key: "__clearDb", 6566 value: function() { 6567 clearTimeout(this.dbIntrvalId), 6568 this.dbIntrvalId = null 6569 } 6570 }, { 6571 key: "on", 6572 value: function(e, t) { 6573 this.__handlers[e] || (this.__handlers[e] = []), 6574 this.__handlers[e].push(t) 6575 } 6576 }, { 6577 key: "off", 6578 value: function(e, t) { 6579 if (this.__handlers[e]) { 6580 for (var i = this.__handlers[e], n = -1, o = 0; o < i.length; o++) 6581 if (i[o] === t) { 6582 n = o; 6583 break 6584 } 6585 n >= 0 && this.__handlers[e].splice(n, 1) 6586 } 6587 } 6588 }, { 6589 key: "trigger", 6590 value: function(e, t) { 6591 this.__handlers[e] && this.__handlers[e].map((function(i) { 6592 try { 6593 i(t) 6594 } catch (n) { 6595 console.error("trigger>>:".concat(e), n) 6596 } 6597 } 6598 )) 6599 } 6600 }, { 6601 key: "onTouchStart", 6602 value: function(e) { 6603 var t = this._pos 6604 , i = this.root; 6605 this.config.needPreventDefault && yi(e); 6606 var n = vi(e.touches); 6607 t.x = n ? parseInt(n.pageX, 10) : e.pageX, 6608 t.y = n ? parseInt(n.pageX, 10) : e.pageX, 6609 t.start = !0, 6610 this.__setPress(e), 6611 i.addEventListener(this.events.end, this.onTouchEnd), 6612 i.addEventListener(this.events.cancel, this.onTouchCancel), 6613 i.addEventListener(this.events.move, this.onTouchMove), 6614 this.trigger(di, e) 6615 } 6616 }, { 6617 key: "onTouchCancel", 6618 value: function(e) { 6619 this.onTouchEnd(e) 6620 } 6621 }, { 6622 key: "onTouchEnd", 6623 value: function(e) { 6624 var t = this._pos 6625 , i = this.root; 6626 this.config.needPreventDefault && yi(e), 6627 this.__clearPress(), 6628 i.removeEventListener(this.events.cancel, this.onTouchCancel), 6629 i.removeEventListener(this.events.end, this.onTouchEnd), 6630 i.removeEventListener(this.events.move, this.onTouchMove), 6631 e.moving = t.moving, 6632 e.press = t.press, 6633 t.press && this.trigger(li, e), 6634 this.trigger(fi, e), 6635 !t.press && !t.moving && this.__setDb(e), 6636 t.press = !1, 6637 t.start = !1, 6638 t.moving = !1 6639 } 6640 }, { 6641 key: "onTouchMove", 6642 value: function(e) { 6643 var t = this._pos 6644 , i = this.config 6645 , n = vi(e.touches) 6646 , o = n ? parseInt(n.pageX, 10) : e.pageX 6647 , r = n ? parseInt(n.pageY, 10) : e.pageX 6648 , s = o - t.x 6649 , a = r - t.y; 6650 Math.abs(a) < i.miniStep && Math.abs(s) < i.miniStep || (this.__clearPress(), 6651 t.press && this.trigger(li, e), 6652 t.press = !1, 6653 t.moving = !0, 6654 this.trigger(hi, e)) 6655 } 6656 }, { 6657 key: "destroy", 6658 value: function() { 6659 var e = this 6660 , t = { 6661 touchend: "onTouchEnd", 6662 touchmove: "onTouchMove", 6663 touchstart: "onTouchStart" 6664 }; 6665 Object.keys(t).map((function(i) { 6666 e.root.removeEventListener("touchend", e[t[i]]) 6667 } 6668 )) 6669 } 6670 }]), 6671 e 6672 }(); 6673 function ki() { 6674 return (new DOMParser).parseFromString('<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <path opacity="0.54"\n d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"\n fill="white" />\n <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>\n</svg>', "image/svg+xml").firstChild 6675 } 6676 var bi = "auto" 6677 , Ci = "seeking" 6678 , _i = "playbackrate" 6679 , wi = ["videoClick", "videoDbClick"] 6680 , Ti = function(e) { 6681 a(i, e); 6682 var t = d(i); 6683 function i(e) { 6684 var o; 6685 return n(this, i), 6686 s(u(o = t.call(this, e)), "onTouchStart", (function(e) { 6687 var t = u(o) 6688 , i = t.player 6689 , n = t.config 6690 , r = t.pos 6691 , s = t.playerConfig 6692 , a = o.getTouche(e); 6693 if (a && !n.disableGesture && o.duration > 0 && !i.ended) { 6694 r.isStart = !0, 6695 x.checkIsFunction(s.disableSwipeHandler) && s.disableSwipeHandler(), 6696 o.find(".xg-dur").innerHTML = x.format(o.duration); 6697 var l = o.root.getBoundingClientRect(); 6698 90 === i.rotateDeg ? (r.top = l.left, 6699 r.left = l.top, 6700 r.width = l.height, 6701 r.height = l.width) : (r.top = l.top, 6702 r.left = l.left, 6703 r.width = l.width, 6704 r.height = l.height); 6705 var c = parseInt(a.pageX - r.left, 10) 6706 , h = parseInt(a.pageY - r.top, 10); 6707 r.x = 90 === i.rotateDeg ? h : c, 6708 r.y = 90 === i.rotateDeg ? c : h, 6709 r.scopeL = n.scopeL * r.width, 6710 r.scopeR = (1 - n.scopeR) * r.width, 6711 r.scopeM1 = r.width * (1 - n.scopeM) / 2, 6712 r.scopeM2 = r.width - r.scopeM1 6713 } 6714 } 6715 )), 6716 s(u(o), "onTouchMove", (function(e) { 6717 var t = o.getTouche(e) 6718 , i = u(o) 6719 , n = i.pos 6720 , r = i.config 6721 , s = i.player; 6722 if (t && !r.disableGesture && o.duration && n.isStart) { 6723 var a = r.miniMoveStep 6724 , l = r.hideControlsActive 6725 , c = parseInt(t.pageX - n.left, 10) 6726 , h = parseInt(t.pageY - n.top, 10) 6727 , d = 90 === s.rotateDeg ? h : c 6728 , f = 90 === s.rotateDeg ? c : h; 6729 if (Math.abs(d - n.x) > a || Math.abs(f - n.y) > a) { 6730 var p = d - n.x 6731 , g = f - n.y 6732 , v = n.scope; 6733 if (-1 === v && (0 === (v = o.checkScope(d, f, p, g, n)) && (l ? s.blur() : s.focus({ 6734 autoHide: !1 6735 }), 6736 !n.time && (n.time = parseInt(1e3 * s.currentTime, 10) + 1e3 * o.timeOffset)), 6737 n.scope = v), 6738 -1 === v || v > 0 && !r.gestureY || 0 === v && !r.gestureX) 6739 return; 6740 e.cancelable && e.preventDefault(), 6741 o.executeMove(p, g, v, n.width, n.height), 6742 n.x = d, 6743 n.y = f 6744 } 6745 } 6746 } 6747 )), 6748 s(u(o), "onTouchEnd", (function(e) { 6749 var t = u(o) 6750 , i = t.player 6751 , n = t.pos 6752 , r = t.playerConfig; 6753 if (n.isStart) { 6754 n.scope > -1 && e.cancelable && e.preventDefault(); 6755 var s = o.config 6756 , a = s.disableGesture 6757 , l = s.gestureX; 6758 !a && l ? (o.endLastMove(n.scope), 6759 setTimeout((function() { 6760 i.getPlugin("progress") && i.getPlugin("progress").resetSeekState() 6761 } 6762 ), 10)) : n.time = 0, 6763 n.scope = -1, 6764 o.resetPos(), 6765 x.checkIsFunction(r.enableSwipeHandler) && r.enableSwipeHandler(), 6766 o.changeAction(bi) 6767 } 6768 } 6769 )), 6770 s(u(o), "onRootTouchMove", (function(e) { 6771 !o.config.disableGesture && o.config.gestureX && o.checkIsRootTarget(e) && (e.stopPropagation(), 6772 o.pos.isStart ? o.onTouchMove(e) : o.onTouchStart(e)) 6773 } 6774 )), 6775 s(u(o), "onRootTouchEnd", (function(e) { 6776 o.pos.isStart && o.checkIsRootTarget(e) && (e.stopPropagation(), 6777 o.onTouchEnd(e)) 6778 } 6779 )), 6780 o.pos = { 6781 isStart: !1, 6782 x: 0, 6783 y: 0, 6784 time: 0, 6785 volume: 0, 6786 rate: 1, 6787 light: 0, 6788 width: 0, 6789 height: 0, 6790 scopeL: 0, 6791 scopeR: 0, 6792 scopeM1: 0, 6793 scopeM2: 0, 6794 scope: -1 6795 }, 6796 o.timer = null, 6797 o 6798 } 6799 return r(i, [{ 6800 key: "duration", 6801 get: function() { 6802 return this.playerConfig.customDuration || this.player.duration 6803 } 6804 }, { 6805 key: "timeOffset", 6806 get: function() { 6807 return this.playerConfig.timeOffset || 0 6808 } 6809 }, { 6810 key: "registerIcons", 6811 value: function() { 6812 return { 6813 seekTipIcon: { 6814 icon: ki, 6815 class: "xg-seek-pre" 6816 } 6817 } 6818 } 6819 }, { 6820 key: "afterCreate", 6821 value: function() { 6822 var e = this; 6823 wi.map((function(t) { 6824 e.__hooks[t] = null 6825 } 6826 )); 6827 var t = this.playerConfig 6828 , i = this.config 6829 , n = this.player; 6830 !0 === t.closeVideoDblclick && (i.closedbClick = !0), 6831 this.resetPos(), 6832 x.isUndefined(t.disableGesture) || (i.disableGesture = !!t.disableGesture), 6833 this.appendChild(".xg-seek-icon", this.icons.seekTipIcon), 6834 this.xgMask = x.createDom("xg-mask", "", {}, "xgmask"), 6835 n.root.appendChild(this.xgMask), 6836 this.initCustomStyle(), 6837 this.registerThumbnail(); 6838 var o = "mouse" === this.domEventType ? "mouse" : "touch"; 6839 this.touch = new mi(this.root,{ 6840 eventType: o, 6841 needPreventDefault: !this.config.disableGesture 6842 }), 6843 this.root.addEventListener("contextmenu", (function(e) { 6844 e.preventDefault() 6845 } 6846 )), 6847 n.root.addEventListener("touchmove", this.onRootTouchMove, !0), 6848 n.root.addEventListener("touchend", this.onRootTouchEnd, !0), 6849 this.on(K, (function() { 6850 var t = e.player 6851 , i = e.config; 6852 1e3 * t.duration < i.moveDuration && (i.moveDuration = 1e3 * t.duration) 6853 } 6854 )), 6855 this.on([z, H], (function() { 6856 var t = e.pos 6857 , i = t.time; 6858 !t.isStart && i > 0 && (e.pos.time = 0) 6859 } 6860 )); 6861 var r = { 6862 touchstart: "onTouchStart", 6863 touchmove: "onTouchMove", 6864 touchend: "onTouchEnd", 6865 press: "onPress", 6866 pressend: "onPressEnd", 6867 click: "onClick", 6868 doubleclick: "onDbClick" 6869 }; 6870 if (Object.keys(r).map((function(t) { 6871 e.touch.on(t, (function(i) { 6872 e[r[t]](i) 6873 } 6874 )) 6875 } 6876 )), 6877 !i.disableActive) { 6878 var s = n.plugins.progress; 6879 s && (s.addCallBack("dragmove", (function(t) { 6880 e.activeSeekNote(t.currentTime, t.forward) 6881 } 6882 )), 6883 s.addCallBack("dragend", (function() { 6884 e.changeAction(bi) 6885 } 6886 ))) 6887 } 6888 } 6889 }, { 6890 key: "registerThumbnail", 6891 value: function() { 6892 var e = this.player.plugins.thumbnail; 6893 if (e && e.usable) { 6894 this.thumbnail = e.createThumbnail(null, "mobile-thumbnail"); 6895 var t = this.find(".time-preview"); 6896 t.insertBefore(this.thumbnail, t.children[0]) 6897 } 6898 } 6899 }, { 6900 key: "initCustomStyle", 6901 value: function() { 6902 var e = (this.playerConfig || {}).commonStyle 6903 , t = e.playedColor 6904 , i = e.progressColor; 6905 t && (this.find(".xg-curbar").style.backgroundColor = t, 6906 this.find(".xg-cur").style.color = t), 6907 i && (this.find(".xg-bar").style.backgroundColor = i, 6908 this.find(".time-preview").style.color = i), 6909 this.config.disableTimeProgress && x.addClass(this.find(".xg-timebar"), "hide") 6910 } 6911 }, { 6912 key: "resetPos", 6913 value: function() { 6914 var e = this; 6915 this.pos ? (this.pos.isStart = !1, 6916 this.pos.scope = -1, 6917 ["x", "y", "width", "height", "scopeL", "scopeR", "scopeM1", "scopeM2"].map((function(t) { 6918 e.pos[t] = 0 6919 } 6920 ))) : this.pos = { 6921 isStart: !1, 6922 x: 0, 6923 y: 0, 6924 volume: 0, 6925 rate: 1, 6926 light: 0, 6927 width: 0, 6928 height: 0, 6929 scopeL: 0, 6930 scopeR: 0, 6931 scopeM1: 0, 6932 scopeM2: 0, 6933 scope: -1, 6934 time: 0 6935 } 6936 } 6937 }, { 6938 key: "changeAction", 6939 value: function(e) { 6940 var t = this.player; 6941 this.root.setAttribute("data-xg-action", e); 6942 var i = t.plugins.start; 6943 i && i.recover() 6944 } 6945 }, { 6946 key: "getTouche", 6947 value: function(e) { 6948 this.player.rotateDeg; 6949 var t = e.touches && e.touches.length > 0 ? e.touches[e.touches.length - 1] : e; 6950 return { 6951 pageX: t.pageX, 6952 pageY: t.pageY 6953 } 6954 } 6955 }, { 6956 key: "checkScope", 6957 value: function(e, t, i, n, o) { 6958 var r = o.width 6959 , s = -1; 6960 if (e < 0 || e > r) 6961 return s; 6962 var a = 0 === n ? Math.abs(i) : Math.abs(i / n); 6963 return Math.abs(i) > 0 && a >= 1.73 && e > o.scopeM1 && e < o.scopeM2 ? s = 0 : (0 === Math.abs(i) || a <= .57) && (s = e < o.scopeL ? 1 : e > o.scopeR ? 2 : 3), 6964 s 6965 } 6966 }, { 6967 key: "executeMove", 6968 value: function(e, t, i, n, o) { 6969 switch (i) { 6970 case 0: 6971 this.updateTime(e / n * this.config.scopeM); 6972 break; 6973 case 1: 6974 this.updateBrightness(t / o); 6975 break; 6976 case 2: 6977 O.os.isIos || this.updateVolume(t / o) 6978 } 6979 } 6980 }, { 6981 key: "endLastMove", 6982 value: function(e) { 6983 var t = this 6984 , i = this.pos 6985 , n = this.player 6986 , o = this.config 6987 , r = (i.time - this.timeOffset) / 1e3; 6988 if (0 === e) 6989 n.seek(Number(r).toFixed(1)), 6990 o.hideControlsEnd ? n.blur() : n.focus(), 6991 this.timer = setTimeout((function() { 6992 t.pos.time = 0 6993 } 6994 ), 500); 6995 this.changeAction(bi) 6996 } 6997 }, { 6998 key: "checkIsRootTarget", 6999 value: function(e) { 7000 var t = this.player.plugins || {}; 7001 return (!t.progress || !t.progress.root.contains(e.target)) && (t.start && t.start.root.contains(e.target) || t.controls && t.controls.root.contains(e.target)) 7002 } 7003 }, { 7004 key: "sendUseAction", 7005 value: function(e) { 7006 var t = this.player.paused; 7007 this.emitUserAction(e, "switch_play_pause", { 7008 prop: "paused", 7009 from: t, 7010 to: !t 7011 }) 7012 } 7013 }, { 7014 key: "clickHandler", 7015 value: function(e) { 7016 var t = this.player 7017 , i = this.config 7018 , n = this.playerConfig; 7019 t.state < gt ? n.closeVideoClick || (this.sendUseAction(x.createEvent("click")), 7020 t.play()) : !i.closedbClick || n.closeVideoClick ? t.isActive ? t.blur() : t.focus() : n.closeVideoClick || ((t.isActive || i.focusVideoClick) && (this.sendUseAction(x.createEvent("click")), 7021 this.switchPlayPause()), 7022 t.focus()) 7023 } 7024 }, { 7025 key: "dbClickHandler", 7026 value: function(e) { 7027 var t = this.config 7028 , i = this.player; 7029 !t.closedbClick && i.state >= gt && (this.sendUseAction(x.createEvent("dblclick")), 7030 this.switchPlayPause()) 7031 } 7032 }, { 7033 key: "onClick", 7034 value: function(e) { 7035 var t = this 7036 , i = this.player; 7037 qe(this, wi[0], (function(e, i) { 7038 t.clickHandler(i.e) 7039 } 7040 ), { 7041 e: e, 7042 paused: i.paused 7043 }) 7044 } 7045 }, { 7046 key: "onDbClick", 7047 value: function(e) { 7048 var t = this 7049 , i = this.player; 7050 qe(this, wi[1], (function(e, i) { 7051 t.dbClickHandler(i.e) 7052 } 7053 ), { 7054 e: e, 7055 paused: i.paused 7056 }) 7057 } 7058 }, { 7059 key: "onPress", 7060 value: function(e) { 7061 var t = this.pos 7062 , i = this.config 7063 , n = this.player; 7064 i.disablePress || (t.rate = this.player.playbackRate, 7065 this.emitUserAction("press", "change_rate", { 7066 prop: "playbackRate", 7067 from: n.playbackRate, 7068 to: i.pressRate 7069 }), 7070 n.playbackRate = i.pressRate, 7071 this.changeAction(_i)) 7072 } 7073 }, { 7074 key: "onPressEnd", 7075 value: function(e) { 7076 var t = this.pos 7077 , i = this.config 7078 , n = this.player; 7079 i.disablePress || (this.emitUserAction("pressend", "change_rate", { 7080 prop: "playbackRate", 7081 from: n.playbackRate, 7082 to: t.rate 7083 }), 7084 n.playbackRate = t.rate, 7085 t.rate = 1, 7086 this.changeAction(bi)) 7087 } 7088 }, { 7089 key: "updateTime", 7090 value: function(e) { 7091 var t = this.player 7092 , i = this.config 7093 , n = this.player.duration; 7094 e = Number(e.toFixed(4)); 7095 var o = parseInt(e * i.moveDuration, 10) + this.timeOffset; 7096 o = (o += this.pos.time) < 0 ? 0 : o > 1e3 * n ? 1e3 * n - 200 : o, 7097 t.getPlugin("time") && t.getPlugin("time").updateTime(o / 1e3), 7098 t.getPlugin("progress") && t.getPlugin("progress").updatePercent(o / 1e3 / this.duration, !0), 7099 this.activeSeekNote(o / 1e3, e > 0), 7100 i.isTouchingSeek && t.seek(Number((o - this.timeOffset) / 1e3).toFixed(1)), 7101 this.pos.time = o 7102 } 7103 }, { 7104 key: "updateVolume", 7105 value: function(e) { 7106 this.player.rotateDeg && (e = -e); 7107 var t = this.player 7108 , i = this.pos; 7109 if (e = parseInt(100 * e, 10), 7110 i.volume += e, 7111 !(Math.abs(i.volume) < 10)) { 7112 var n = parseInt(10 * t.volume, 10) - parseInt(i.volume / 10, 10); 7113 n = n > 10 ? 10 : n < 1 ? 0 : n, 7114 t.volume = n / 10, 7115 i.volume = 0 7116 } 7117 } 7118 }, { 7119 key: "updateBrightness", 7120 value: function(e) { 7121 this.player.rotateDeg && (e = -e); 7122 var t = this.pos 7123 , i = this.config 7124 , n = this.xgMask 7125 , o = t.light + .8 * e; 7126 o = o > i.maxDarkness ? i.maxDarkness : o < 0 ? 0 : o, 7127 n && (n.style.backgroundColor = "rgba(0,0,0,".concat(o, ")")), 7128 t.light = o 7129 } 7130 }, { 7131 key: "activeSeekNote", 7132 value: function(e) { 7133 var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1] 7134 , i = this.player 7135 , n = this.config 7136 , o = !(this.duration !== 1 / 0 && this.duration > 0); 7137 if (e && "number" == typeof e && !o && !n.disableActive) { 7138 e < 0 ? e = 0 : e > i.duration && (e = i.duration - .2), 7139 this.changeAction(Ci); 7140 var r = i.plugins.start; 7141 r && r.focusHide(), 7142 this.find(".xg-dur").innerHTML = x.format(this.duration), 7143 this.find(".xg-cur").innerHTML = x.format(e), 7144 this.find(".xg-curbar").style.width = "".concat(e / this.duration * 100, "%"), 7145 t ? x.removeClass(this.find(".xg-seek-show"), "xg-back") : x.addClass(this.find(".xg-seek-show"), "xg-back"), 7146 this.updateThumbnails(e) 7147 } 7148 } 7149 }, { 7150 key: "updateThumbnails", 7151 value: function(e) { 7152 var t = this.player.plugins.thumbnail; 7153 t && t.usable && this.thumbnail && t.update(this.thumbnail, e, 160, 90) 7154 } 7155 }, { 7156 key: "switchPlayPause", 7157 value: function() { 7158 var e = this.player; 7159 if (e.state < ft) 7160 return !1; 7161 e.ended || (e.paused ? e.play() : e.pause()) 7162 } 7163 }, { 7164 key: "disableGesture", 7165 value: function() { 7166 this.config.disableGesture = !1 7167 } 7168 }, { 7169 key: "enableGesture", 7170 value: function() { 7171 this.config.disableGesture = !0 7172 } 7173 }, {
7174 key: "destroy", 7175 value: function() { 7176 var e = this.player; 7177 this.timer && clearTimeout(this.timer), 7178 this.thumbnail = null, 7179 e.root.removeChild(this.xgMask), 7180 this.xgMask = null, 7181 this.touch && this.touch.destroy(), 7182 this.touch = null, 7183 e.root.removeEventListener("touchmove", this.onRootTouchMove, !0), 7184 e.root.removeEventListener("touchend", this.onRootTouchEnd, !0) 7185 } 7186 }, { 7187 key: "render", 7188 value: function() { 7189 var e = "normal" !== this.config.gradient ? "gradient ".concat(this.config.gradient) : "gradient"; 7190 return '\n <xg-trigger class="trigger">\n <div class="'.concat(e, '"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon ? " hide-seek-icon" : "", '">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span>/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate, "X</i>").concat(this.i18n.FORWARD, "</span>\n </div>\n </xg-trigger>\n ") 7191 } 7192 }], [{ 7193 key: "pluginName", 7194 get: function() { 7195 return "mobile" 7196 } 7197 }, { 7198 key: "defaultConfig", 7199 get: function() { 7200 return { 7201 index: 0, 7202 disableGesture: !1, 7203 gestureX: !0, 7204 gestureY: !0, 7205 gradient: "normal", 7206 isTouchingSeek: !1, 7207 miniMoveStep: 5, 7208 miniYPer: 5, 7209 scopeL: .25, 7210 scopeR: .25, 7211 scopeM: .9, 7212 pressRate: 2, 7213 darkness: !0, 7214 maxDarkness: .8, 7215 disableActive: !1, 7216 disableTimeProgress: !1, 7217 hideControlsActive: !1, 7218 hideControlsEnd: !1, 7219 moveDuration: 36e4, 7220 closedbClick: !1, 7221 disablePress: !0, 7222 disableSeekIcon: !1, 7223 focusVideoClick: !1 7224 } 7225 } 7226 }]), 7227 i 7228 }(ot); 7229 function xi(e) { 7230 e.preventDefault(), 7231 e.returnValue = !1 7232 } 7233 function Ei(e) { 7234 var t = e.tagName; 7235 return !("INPUT" !== t && "TEXTAREA" !== t && !e.isContentEditable) 7236 } 7237 var Si = function(e) { 7238 a(o, e); 7239 var i = d(o); 7240 function o() { 7241 var e; 7242 n(this, o); 7243 for (var t = arguments.length, r = new Array(t), a = 0; a < t; a++) 7244 r[a] = arguments[a]; 7245 return s(u(e = i.call.apply(i, [this].concat(r))), "onBodyKeyDown", (function(t) { 7246 var i = t || window.event; 7247 if (e.player && (e.player.isUserActive || e.config.isIgnoreUserActive) && !(e.config.disable || e.config.disableBodyTrigger || !e.checkIsVisible() || i.metaKey || i.altKey || i.ctrlKey)) { 7248 var n = i.keyCode; 7249 return !(i.target !== document.body && (!e.config.isGlobalTrigger || Ei(i.target)) || !e.checkCode(n, !0)) && (xi(i), 7250 e.handleKeyCode(n, t), 7251 !1) 7252 } 7253 } 7254 )), 7255 s(u(e), "onKeydown", (function(t) { 7256 var i = t || window.event; 7257 if (!(e.config.disable || e.config.disableRootTrigger || i.metaKey || i.altKey || i.ctrlKey) && (e.player.isUserActive || e.config.isIgnoreUserActive) && (e.player.isUserActive || e.config.isIgnoreUserActive)) { 7258 if (!i || 37 !== i.keyCode && !e.checkCode(i.keyCode) || i.target !== e.player.root && i.target !== e.player.video && i.target !== e.player.controls.el) 7259 return !0; 7260 xi(i), 7261 e.handleKeyCode(i.keyCode, t) 7262 } 7263 } 7264 )), 7265 e 7266 } 7267 return r(o, [{ 7268 key: "mergekeyCodeMap", 7269 value: function() { 7270 var e = this 7271 , t = this.config.keyCodeMap; 7272 t && Object.keys(t).map((function(i) { 7273 e.keyCodeMap[i] ? ["keyCode", "action", "disable", "isBodyTarget"].map((function(n) { 7274 t[i][n] && (e.keyCodeMap[i][n] = t[i][n]) 7275 } 7276 )) : e.keyCodeMap[i] = t[i] 7277 } 7278 )) 7279 } 7280 }, { 7281 key: "afterCreate", 7282 value: function() { 7283 this.config.disable = !this.playerConfig.keyShortcut; 7284 var e = "function" == typeof this.config.seekStep ? this.config.seekStep(this.player) : this.config.seekStep; 7285 e && "number" == typeof e && (this.seekStep = e), 7286 this.keyCodeMap = { 7287 space: { 7288 keyCode: 32, 7289 action: "playPause", 7290 disable: !1, 7291 noBodyTarget: !1 7292 }, 7293 up: { 7294 keyCode: 38, 7295 action: "upVolume", 7296 disable: !1, 7297 noBodyTarget: !0 7298 }, 7299 down: { 7300 keyCode: 40, 7301 action: "downVolume", 7302 disable: !1, 7303 noBodyTarget: !0 7304 }, 7305 left: { 7306 keyCode: 37, 7307 action: "seekBack", 7308 disable: !1 7309 }, 7310 right: { 7311 keyCode: 39, 7312 action: "seek", 7313 disable: !1 7314 }, 7315 esc: { 7316 keyCode: 27, 7317 action: "exitFullscreen", 7318 disable: !1 7319 } 7320 }, 7321 this.mergekeyCodeMap(), 7322 this.player.root.addEventListener("keydown", this.onKeydown), 7323 document.addEventListener("keydown", this.onBodyKeyDown) 7324 } 7325 }, { 7326 key: "checkIsVisible", 7327 value: function() { 7328 if (!this.config.checkVisible) 7329 return !0; 7330 var e = this.player.root.getBoundingClientRect() 7331 , t = e.height 7332 , i = e.top 7333 , n = e.bottom 7334 , o = window.innerHeight; 7335 return !(i < 0 && i < 0 - .9 * t || n > 0 && n - o > .9 * t) 7336 } 7337 }, { 7338 key: "checkCode", 7339 value: function(e, t) { 7340 var i = this 7341 , n = !1; 7342 return Object.keys(this.keyCodeMap).map((function(o) { 7343 i.keyCodeMap[o] && e === i.keyCodeMap[o].keyCode && !i.keyCodeMap[o].disable && (n = !t || t && !i.keyCodeMap[o].noBodyTarget) 7344 } 7345 )), 7346 n 7347 } 7348 }, { 7349 key: "downVolume", 7350 value: function(e) { 7351 var t = this.player 7352 , i = parseFloat((t.volume - .1).toFixed(1)) 7353 , n = { 7354 volume: { 7355 from: t.volume, 7356 to: i 7357 } 7358 }; 7359 this.emitUserAction(e, "change_volume", { 7360 props: n 7361 }), 7362 t.volume = i >= 0 ? i : 0 7363 } 7364 }, { 7365 key: "upVolume", 7366 value: function(e) { 7367 var t = this.player 7368 , i = parseFloat((t.volume + .1).toFixed(1)) 7369 , n = { 7370 volume: { 7371 from: t.volume, 7372 to: i 7373 } 7374 }; 7375 this.emitUserAction(e, "change_volume", { 7376 props: n 7377 }), 7378 t.volume = i <= 1 ? i : 1 7379 } 7380 }, { 7381 key: "seek", 7382 value: function(e) { 7383 var t = this.player 7384 , i = t.currentTime 7385 , n = t.duration 7386 , o = i 7387 , r = { 7388 currentTime: { 7389 from: i, 7390 to: o = i + this.seekStep <= n ? i + this.seekStep : n - 1 7391 } 7392 }; 7393 this.emitUserAction(e, "seek", { 7394 props: r 7395 }), 7396 this.player.currentTime = o 7397 } 7398 }, { 7399 key: "seekBack", 7400 value: function(e) { 7401 var t = this.player.currentTime 7402 , i = 0; 7403 t - this.seekStep >= 0 && (i = t - this.seekStep); 7404 var n = { 7405 currentTime: { 7406 from: t, 7407 to: i 7408 } 7409 }; 7410 this.emitUserAction(e, "seek", { 7411 props: n 7412 }), 7413 this.player.currentTime = i 7414 } 7415 }, { 7416 key: "playPause", 7417 value: function(e) { 7418 var t = this.player; 7419 t && (this.emitUserAction(e, "switch_play_pause"), 7420 t.paused ? t.play() : t.pause()) 7421 } 7422 }, { 7423 key: "exitFullscreen", 7424 value: function(e) { 7425 var t = this.player 7426 , i = t.fullscreen 7427 , n = t.cssfullscreen; 7428 i && (this.emitUserAction("keyup", "switch_fullscreen", { 7429 prop: "fullscreen", 7430 from: i, 7431 to: !i 7432 }), 7433 t.exitFullscreen()), 7434 n && (this.emitUserAction("keyup", "switch_css_fullscreen", { 7435 prop: "cssfullscreen", 7436 from: n, 7437 to: !n 7438 }),
7439 t.exitCssFullscreen()) 7440 } 7441 }, { 7442 key: "handleKeyCode", 7443 value: function(e, i) { 7444 var n = this; 7445 Object.keys(this.keyCodeMap).map((function(o) { 7446 var r = n.keyCodeMap[o] 7447 , s = r.action 7448 , a = r.keyCode 7449 , l = r.disable; 7450 a !== e || l || ("function" == typeof s ? s(i, n.player) : "string" == typeof s && "function" == typeof n[s] && n[s](i, n.player), 7451 n.emit(Ce, t({ 7452 key: o, 7453 target: i.target 7454 }, n.keyCodeMap[o]))) 7455 } 7456 )) 7457 } 7458 }, { 7459 key: "destroy", 7460 value: function() { 7461 this.player.root.removeEventListener("keydown", this.onKeydown), 7462 document.removeEventListener("keydown", this.onBodyKeyDown) 7463 } 7464 }, { 7465 key: "disable", 7466 value: function() { 7467 this.config.disable = !0 7468 } 7469 }, { 7470 key: "enable", 7471 value: function() { 7472 this.config.disable = !1 7473 } 7474 }], [{ 7475 key: "pluginName", 7476 get: function() { 7477 return "keyboard" 7478 } 7479 }, { 7480 key: "defaultConfig", 7481 get: function() { 7482 return { 7483 seekStep: 10, 7484 checkVisible: !0, 7485 disableBodyTrigger: !1, 7486 disableRootTrigger: !1, 7487 isGlobalTrigger: !1, 7488 keyCodeMap: {}, 7489 disable: !1, 7490 isIgnoreUserActive: !1 7491 } 7492 } 7493 }]), 7494 o 7495 }(Ke); 7496 function Pi() { 7497 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">\n <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>\n</svg>\n', "image/svg+xml").firstChild 7498 } 7499 var Li = function(e) { 7500 a(i, e); 7501 var t = d(i); 7502 function i() { 7503 return n(this, i), 7504 t.apply(this, arguments) 7505 } 7506 return r(i, [{ 7507 key: "registerIcons", 7508 value: function() { 7509 return { 7510 loadingIcon: Pi 7511 } 7512 } 7513 }, { 7514 key: "afterCreate", 7515 value: function() { 7516 this.appendChild("xg-loading-inner", this.icons.loadingIcon) 7517 } 7518 }, { 7519 key: "render", 7520 value: function() { 7521 return '\n <xg-loading class="xgplayer-loading">\n <xg-loading-inner></xg-loading-inner>\n </xg-loading>' 7522 } 7523 }], [{ 7524 key: "pluginName", 7525 get: function() { 7526 return "loading" 7527 } 7528 }, { 7529 key: "defaultConfig", 7530 get: function() { 7531 return { 7532 position: et.ROOT 7533 } 7534 } 7535 }]), 7536 i 7537 }(ot) 7538 , Ii = [{ 7539 tag: "xg-cache", 7540 className: "xgplayer-progress-cache", 7541 styleKey: "cachedColor" 7542 }, {
vendor: 24,920 bytes, lines 7543-8175
7543 tag: "xg-played", 7544 className: "xgplayer-progress-played", 7545 styleKey: "playedColor" 7546 }] 7547 , Ai = function() { 7548 function e(t) { 7549 n(this, e), 7550 this.fragments = t.fragments || [], 7551 0 === this.fragments.length && this.fragments.push({ 7552 percent: 1 7553 }), 7554 this._callBack = t.actionCallback, 7555 this.fragConfig = { 7556 fragFocusClass: t.fragFocusClass || "inner-focus-point", 7557 fragAutoFocus: !!t.fragAutoFocus, 7558 fragClass: t.fragClass || "" 7559 }, 7560 this.style = t.style || { 7561 playedColor: "", 7562 cachedColor: "", 7563 progressColor: "" 7564 }, 7565 this.duration = 0, 7566 this.cachedIndex = 0, 7567 this.playedIndex = 0, 7568 this.focusIndex = -1 7569 } 7570 return r(e, [{ 7571 key: "updateDuration", 7572 value: function(e) { 7573 var t = this; 7574 this.duration = e; 7575 var i = 0 7576 , n = this.fragments; 7577 this.fragments = n.map((function(e) { 7578 return e.start = parseInt(i, 10), 7579 e.end = parseInt(i + e.percent * t.duration, 10), 7580 e.duration = parseInt(e.percent * t.duration, 10), 7581 i += e.percent * t.duration, 7582 e 7583 } 7584 )) 7585 } 7586 }, { 7587 key: "updateProgress", 7588 value: function() { 7589 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "played" 7590 , t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { 7591 newIndex: 0, 7592 curIndex: 0, 7593 millisecond: 0 7594 } 7595 , i = this.progressList 7596 , n = this.fragments; 7597 if (!(i.length < 1)) { 7598 var o = t.newIndex 7599 , r = t.curIndex 7600 , s = t.millisecond; 7601 o !== r && i.map((function(t, i) { 7602 i < o ? t[e].style.width = "100%" : i > o && (t[e].style.width = 0) 7603 } 7604 )); 7605 var a = n[o] 7606 , l = 0 === s ? 0 : (s - a.start) / a.duration; 7607 i[o][e].style.width = l < 0 ? 0 : "".concat(100 * l, "%") 7608 } 7609 } 7610 }, { 7611 key: "updateFocus", 7612 value: function(e) { 7613 if (this.fragConfig.fragAutoFocus && !(this.fragments.length < 2)) 7614 if (e) { 7615 var t = this.findIndex(1e3 * e.currentTime, this.focusIndex); 7616 if (t >= 0 && t !== this.focusIndex) { 7617 this.focusIndex > -1 && this.unHightLight(this.focusIndex), 7618 this.setHightLight(t); 7619 var i = { 7620 index: t, 7621 preIndex: this.focusIndex, 7622 fragment: this.fragments[this.focusIndex] 7623 }; 7624 this.focusIndex = t, 7625 this._callBack && this._callBack(i) 7626 } 7627 } else if (this.focusIndex > -1) { 7628 this.unHightLight(this.focusIndex); 7629 var n = { 7630 index: -1, 7631 preIndex: this.focusIndex, 7632 fragment: null 7633 }; 7634 this._callBack && this._callBack(n), 7635 this.focusIndex = -1 7636 } 7637 } 7638 }, { 7639 key: "update", 7640 value: function() { 7641 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { 7642 cached: 0, 7643 played: 0 7644 } 7645 , t = arguments.length > 1 ? arguments[1] : void 0; 7646 if (!this.duration || parseInt(1e3 * t, 10) !== this.duration) { 7647 if (!t && 0 !== t) 7648 return; 7649 this.updateDuration(parseInt(1e3 * t, 10)) 7650 } 7651 var i = this.playedIndex 7652 , n = this.cachedIndex; 7653 if ("Undefined" !== x.typeOf(e.played)) { 7654 var o = this.findIndex(1e3 * e.played, i); 7655 if (o < 0) 7656 return; 7657 this.updateProgress("played", { 7658 newIndex: o, 7659 curIndex: i, 7660 millisecond: parseInt(1e3 * e.played, 10) 7661 }), 7662 this.playedIndex = o 7663 } 7664 if ("Undefined" !== x.typeOf(e.cached)) { 7665 var r = this.findIndex(1e3 * e.cached, n); 7666 if (r < 0) 7667 return; 7668 this.updateProgress("cached", { 7669 newIndex: r, 7670 curIndex: n, 7671 millisecond: parseInt(1e3 * e.cached, 10) 7672 }), 7673 this.cachedIndex = r 7674 } 7675 } 7676 }, { 7677 key: "findIndex", 7678 value: function(e, t) { 7679 var i = this.fragments; 7680 if (!i || 0 === i.length) 7681 return -1; 7682 if (1 === i.length) 7683 return 0; 7684 if (t > -1 && t < i.length && e > i[t].start && e < i[t].end) 7685 return t; 7686 if (e > i[i.length - 1].start) 7687 return i.length - 1; 7688 for (var n = 0; n < i.length; n++) 7689 if (e > i[n].start && e <= i[n].end) { 7690 t = n; 7691 break 7692 } 7693 return t 7694 } 7695 }, { 7696 key: "findHightLight", 7697 value: function() { 7698 for (var e = this.root.children, t = 0; t < e.length; t++) 7699 if (x.hasClass(e[t], this.fragConfig.fragFocusClass)) 7700 return { 7701 dom: e[t], 7702 pos: e[t].getBoundingClientRect() 7703 } 7704 } 7705 }, { 7706 key: "findFragment", 7707 value: function(e) { 7708 var t = this.root.children; 7709 return e < 0 || e >= t.length ? null : { 7710 dom: t[e], 7711 pos: t[e].getBoundingClientRect() 7712 } 7713 } 7714 }, { 7715 key: "unHightLight", 7716 value: function() { 7717 for (var e = this.root.children, t = 0; t < e.length; t++) 7718 x.removeClass(e[t], this.fragConfig.fragFocusClass) 7719 } 7720 }, { 7721 key: "setHightLight", 7722 value: function(e) { 7723 var t = this.root.children; 7724 if (e < t.length) 7725 return x.addClass(t[e], this.fragConfig.fragFocusClass), 7726 { 7727 dom: t[e], 7728 pos: t[e].getBoundingClientRect() 7729 } 7730 } 7731 }, { 7732 key: "destroy", 7733 value: function() { 7734 this.progressList = null, 7735 this.fragments = null, 7736 this.root.innerHTML = "" 7737 } 7738 }, { 7739 key: "reset", 7740 value: function(e) { 7741 var t = this; 7742 if (Object.keys(this.fragConfig).forEach((function(i) { 7743 void 0 !== e[i] && (t.fragConfig[i] = e[i]) 7744 } 7745 )), 7746 e.fragments) { 7747 if (this.fragments = 0 === e.fragments.length ? [{ 7748 percent: 1 7749 }] : e.fragments, 7750 this.updateDuration(this.duration), 7751 this.playedIndex = 0, 7752 this.cachedIndex = 0, 7753 this.root) 7754 for (var i = this.root.children; i.length > 0; ) 7755 this.root.removeChild(i[0]); 7756 this.render() 7757 } 7758 } 7759 }, { 7760 key: "render", 7761 value: function() { 7762 var e = this 7763 , t = this.style.progressColor; 7764 if (this.root || (this.root = x.createDom("xg-inners", "", {}, "progress-list")), 7765 this.fragments) { 7766 var i = this.fragConfig 7767 , n = i.fragClass 7768 , o = i.fragFocusClass; 7769 this.progressList = this.fragments.map((function(i) { 7770 var r = x.createDom("xg-inner", "", { 7771 style: t ? "background:".concat(t, "; flex: ").concat(i.percent) : "flex: ".concat(i.percent) 7772 }, "".concat(i.isFocus ? o : "", " xgplayer-progress-inner ").concat(n)); 7773 return e.root.appendChild(r), 7774 Ii.forEach((function(t) { 7775 r.appendChild(x.createDom(t.tag, "", { 7776 style: t.styleKey ? "background: ".concat(e.style[t.styleKey], "; width:0;") : "width:0;" 7777 }, t.className)) 7778 } 7779 )), 7780 { 7781 cached: r.children[0], 7782 played: r.children[1] 7783 } 7784 } 7785 )) 7786 } 7787 return this.root 7788 } 7789 }]), 7790 e 7791 }() 7792 , Oi = { 7793 POINT: "inner-focus-point", 7794 HIGHLIGHT: "inner-focus-highlight" 7795 } 7796 , Ri = function(e) { 7797 a(l, e); 7798 var o = d(l); 7799 function l(e) { 7800 var t; 7801 return n(this, l), 7802 s(u(t = o.call(this, e)), "onMoveOnly", (function(e, i) { 7803 var n = u(t) 7804 , o = n.pos 7805 , r = n.config 7806 , s = n.player 7807 , a = i; 7808 if (e) { 7809 x.event(e); 7810 var l = x.getEventPos(e, s.zoom) 7811 , c = 90 === s.rotateDeg ? l.clientY : l.clientX; 7812 if (o.moving && Math.abs(o.x - c) < r.miniMoveStep) 7813 return; 7814 o.moving = !0, 7815 o.x = c, 7816 a = t.computeTime(e, c) 7817 } 7818 t.triggerCallbacks("dragmove", a, e), 7819 t._updateInnerFocus(a) 7820 } 7821 )), 7822 s(u(t), "onBodyClick", (function(e) { 7823 t.pos.isLocked && (t.pos.isLocked = !1, 7824 e.preventDefault(), 7825 e.stopPropagation()) 7826 } 7827 )), 7828 s(u(t), "_mouseDownHandler", (function(e, i) { 7829 t._state.time = i.currentTime, 7830 t.updateWidth(i.currentTime, i.percent, 0), 7831 t._updateInnerFocus(i) 7832 } 7833 )), 7834 s(u(t), "_mouseUpHandler", (function(e, i) { 7835 u(t).pos.moving && t.updateWidth(i.currentTime, i.percent, 2) 7836 } 7837 )), 7838 s(u(t), "_mouseMoveHandler", (function(e, i) { 7839 var n = u(t) 7840 , o = n._state 7841 , r = n.pos 7842 , s = n.config 7843 , a = n.player; 7844 o.time < i.currentTime ? i.forward = !0 : i.forward = !1, 7845 o.time = i.currentTime, 7846 r.isDown && !r.moving && (r.moving = !0, 7847 s.isPauseMoving && a.pause(), 7848 t.triggerCallbacks("dragstart", i, e), 7849 t.emitUserAction("drag", "dragstart", i)), 7850 t.updateWidth(i.currentTime, i.percent, 1), 7851 t.triggerCallbacks("dragmove", i, e), 7852 t._updateInnerFocus(i) 7853 } 7854 )), 7855 s(u(t), "onMouseDown", (function(e) { 7856 var i = u(t) 7857 , n = i._state 7858 , o = i.player 7859 , r = i.pos 7860 , s = i.config 7861 , a = i.playerConfig 7862 , l = x.getEventPos(e, o.zoom) 7863 , c = 90 === o.rotateDeg ? l.clientY : l.clientX; 7864 if (!(o.isMini || s.closeMoveSeek || !a.allowSeekAfterEnded && o.ended)) { 7865 if (o.duration || o.isPlaying) { 7866 e.stopPropagation(), 7867 t.focus(), 7868 x.checkIsFunction(a.disableSwipeHandler) && a.disableSwipeHandler(), 7869 x.checkIsFunction(s.onMoveStart) && s.onMoveStart(), 7870 x.event(e), 7871 r.x = c, 7872 r.isDown = !0, 7873 r.moving = !1, 7874 n.prePlayTime = o.currentTime, 7875 o.focus({ 7876 autoHide: !1 7877 }), 7878 t.isProgressMoving = !0, 7879 x.addClass(t.progressBtn, "active"); 7880 var h = t.computeTime(e, c); 7881 return h.prePlayTime = n.prePlayTime, 7882 t._mouseDownHandlerHook(e, h), 7883 "touchstart" === e.type ? (t.root.addEventListener("touchmove", t.onMouseMove), 7884 t.root.addEventListener("touchend", t.onMouseUp)) : (t.unbind("mousemove", t.onMoveOnly), 7885 document.addEventListener("mousemove", t.onMouseMove, !1), 7886 document.addEventListener("mouseup", t.onMouseUp, !1)), 7887 !0 7888 } 7889 o.play() 7890 } 7891 } 7892 )), 7893 s(u(t), "onMouseUp", (function(e) { 7894 var i = u(t) 7895 , n = i.player 7896 , o = i.config 7897 , r = i.pos 7898 , s = i.playerConfig 7899 , a = i._state; 7900 e.stopPropagation(), 7901 e.preventDefault(), 7902 x.checkIsFunction(s.enableSwipeHandler) && s.enableSwipeHandler(), 7903 x.checkIsFunction(o.onMoveEnd) && o.onMoveEnd(), 7904 x.event(e), 7905 x.removeClass(t.progressBtn, "active"); 7906 var l = t.computeTime(e, r.x); 7907 l.prePlayTime = a.prePlayTime, 7908 r.moving ? (t.triggerCallbacks("dragend", l, e), 7909 t.emitUserAction("drag", "dragend", l)) : (t.triggerCallbacks("click", l, e), 7910 t.emitUserAction("click", "click", l)), 7911 t._mouseUpHandlerHook(e, l), 7912 r.moving = !1, 7913 r.isDown = !1, 7914 r.x = 0, 7915 r.y = 0, 7916 r.isLocked = !0, 7917 a.prePlayTime = 0, 7918 a.time = 0, 7919 "touchend" === e.type ? (t.root.removeEventListener("touchmove", t.onMouseMove), 7920 t.root.removeEventListener("touchend", t.onMouseUp), 7921 t.blur()) : (document.removeEventListener("mousemove", t.onMouseMove, !1), 7922 document.removeEventListener("mouseup", t.onMouseUp, !1), 7923 r.isEnter ? "mobile" !== s.isMobileSimulateMode && t.bind("mousemove", t.onMoveOnly) : t.onMouseLeave(e)), 7924 x.setTimeout(u(t), (function() { 7925 t.resetSeekState() 7926 } 7927 ), 10), 7928 n.focus() 7929 } 7930 )), 7931 s(u(t), "onMouseMove", (function(e) { 7932 var i = u(t) 7933 , n = i._state 7934 , o = i.pos 7935 , r = i.player 7936 , s = i.config; 7937 x.checkTouchSupport() && e.preventDefault(), 7938 x.event(e); 7939 var a = x.getEventPos(e, r.zoom) 7940 , l = 90 === r.rotateDeg ? a.clientY : a.clientX 7941 , c = Math.abs(o.x - l); 7942 if (!(o.moving && c < s.miniMoveStep || !o.moving && c < s.miniStartStep)) { 7943 o.x = l; 7944 var h = t.computeTime(e, l); 7945 h.prePlayTime = n.prePlayTime, 7946 t._mouseMoveHandlerHook(e, h) 7947 } 7948 } 7949 )), 7950 s(u(t), "onMouseOut", (function(e) { 7951 t.triggerCallbacks("mouseout", null, e) 7952 } 7953 )), 7954 s(u(t), "onMouseOver", (function(e) { 7955 t.triggerCallbacks("mouseover", null, e) 7956 } 7957 )), 7958 s(u(t), "onMouseEnter", (function(e) { 7959 var i = u(t) 7960 , n = i.player 7961 , o = i.pos; 7962 if (!(o.isDown || o.isEnter || n.isMini || !n.config.allowSeekAfterEnded && n.ended)) { 7963 o.isEnter = !0, 7964 t.bind("mousemove", t.onMoveOnly), 7965 t.bind("mouseleave", t.onMouseLeave), 7966 x.event(e); 7967 var r = x.getEventPos(e, n.zoom) 7968 , s = 90 === n.rotateDeg ? r.clientY : r.clientX 7969 , a = t.computeTime(e, s); 7970 t.triggerCallbacks("mouseenter", a, e), 7971 t.focus() 7972 } 7973 } 7974 )), 7975 s(u(t), "onMouseLeave", (function(e) { 7976 t.triggerCallbacks("mouseleave", null, e), 7977 t.unlock(), 7978 t._updateInnerFocus(null) 7979 } 7980 )), 7981 s(u(t), "onVideoResize", (function() { 7982 var e = t.pos 7983 , i = e.x 7984 , n = e.isDown; 7985 if (e.isEnter && !n) { 7986 var o = t.computeTime(null, i); 7987 t.onMoveOnly(null, o) 7988 } 7989 } 7990 )), 7991 t.useable = !1, 7992 t.isProgressMoving = !1, 7993 t.__dragCallBacks = [], 7994 t._state = { 7995 now: -1, 7996 direc: 0, 7997 time: 0, 7998 prePlayTime: -1 7999 }, 8000 t._disableBlur = !1, 8001 t 8002 } 8003 return r(l, [{ 8004 key: "duration", 8005 get: function() { 8006 return this.playerConfig.customDuration || this.player.duration 8007 } 8008 }, { 8009 key: "timeOffset", 8010 get: function() { 8011 return this.playerConfig.timeOffset || 0 8012 } 8013 }, { 8014 key: "changeState", 8015 value: function() { 8016 var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]; 8017 this.useable = e 8018 } 8019 }, { 8020 key: "show", 8021 value: function() { 8022 this.root && (this.root.style.display = "flex") 8023 } 8024 }, { 8025 key: "_initInner", 8026 value: function() { 8027 var e = this 8028 , i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [] 8029 , n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 8030 i && 0 !== i.length || (i = [{ 8031 percent: 1 8032 }]); 8033 var o = t(t({ 8034 fragments: i 8035 }, n), {}, { 8036 actionCallback: function(t) { 8037 e.emitUserAction("fragment_focus", "fragment_focus", t) 8038 } 8039 }); 8040 this.innerList ? this.innerList.reset(o) : (this.innerList = new Ai(o), 8041 this.outer.insertBefore(this.innerList.render(), this.outer.children[0]), 8042 ["findHightLight", "unHightLight", "setHightLight", "findFragment"].map((function(t) { 8043 e[t] = e.innerList[t].bind(e.innerList) 8044 } 8045 ))) 8046 } 8047 }, { 8048 key: "_updateInnerFocus", 8049 value: function(e) { 8050 this.innerList && this.innerList.updateFocus(e) 8051 } 8052 }, { 8053 key: "afterCreate", 8054 value: function() { 8055 var e = this; 8056 if (!this.config.disable && !this.playerConfig.isLive) { 8057 this.pos = { 8058 x: 0, 8059 y: 0, 8060 moving: !1, 8061 isDown: !1, 8062 isEnter: !1, 8063 isLocked: !1 8064 }, 8065 this.outer = this.find("xg-outer"); 8066 var t = this.config 8067 , i = t.fragFocusClass 8068 , n = t.fragAutoFocus 8069 , o = t.fragClass; 8070 this._initInner(this.config.fragments, { 8071 fragFocusClass: i, 8072 fragAutoFocus: n, 8073 fragClass: o, 8074 style: this.playerConfig.commonStyle || {} 8075 }), 8076 "mobile" === O.device && (this.config.isDragingSeek = !1, 8077 this.isMobile = !0), 8078 this.progressBtn = this.find(".xgplayer-progress-btn"), 8079 this.on(K, (function() { 8080 e.onMouseLeave() 8081 } 8082 )), 8083 this.on(W, (function() { 8084 e.onTimeupdate() 8085 } 8086 )), 8087 this.on(G, (function() { 8088 e.onTimeupdate(), 8089 e.onCacheUpdate() 8090 } 8091 )), 8092 this.on(J, (function() { 8093 e.onCacheUpdate() 8094 } 8095 )), 8096 this.on(H, (function() { 8097 e.onCacheUpdate(!0), 8098 e.onTimeupdate(!0), 8099 e._state.now = 0 8100 } 8101 )), 8102 this.on(Q, (function() { 8103 e.onReset() 8104 } 8105 )), 8106 this.on(ve, (function() { 8107 e.onVideoResize() 8108 } 8109 )), 8110 this.bindDomEvents(), 8111 this.initCustomStyle() 8112 } 8113 } 8114 }, { 8115 key: "setConfig", 8116 value: function(e) { 8117 var t = this 8118 , i = null; 8119 Object.keys(e).forEach((function(n) { 8120 t.config[n] = e[n], 8121 "fragments" === n && (i = e[n]) 8122 } 8123 )), 8124 i && this._initInner(i, e) 8125 } 8126 }, { 8127 key: "initCustomStyle", 8128 value: function() { 8129 var e = (this.playerConfig || {}).commonStyle.sliderBtnStyle 8130 , t = this.progressBtn; 8131 e && ("string" == typeof e ? t.style.boxShadow = e : "object" === i(e) && Object.keys(e).map((function(i) { 8132 t.style[i] = e[i] 8133 } 8134 ))) 8135 } 8136 }, { 8137 key: "triggerCallbacks", 8138 value: function(e, t, i) { 8139 this.__dragCallBacks.length > 0 && this.__dragCallBacks.map((function(n) { 8140 if (n && n.handler && n.type === e) 8141 try { 8142 n.handler(t, i) 8143 } catch (o) { 8144 console.error("[XGPLAYER][triggerCallbacks] ".concat(n, " error"), o) 8145 } 8146 } 8147 )) 8148 } 8149 }, { 8150 key: "addCallBack", 8151 value: function(e, t) { 8152 t && "function" == typeof t && this.__dragCallBacks.push({ 8153 type: e, 8154 handler: t 8155 }) 8156 } 8157 }, { 8158 key: "removeCallBack", 8159 value: function(e, t) { 8160 var i = this.__dragCallBacks 8161 , n = -1; 8162 i.map((function(i, o) { 8163 i && i.type === e && i.handler === t && (n = o) 8164 } 8165 )), 8166 n > -1 && i.splice(n, 1) 8167 } 8168 }, { 8169 key: "unlock", 8170 value: function() { 8171 var e = this.player 8172 , t = this.pos; 8173 t.isEnter = !1, 8174 e.isMini || (this.unbind("mousemove", this.onMoveOnly), 8175 t.isDown ? this.unbind("mouseleave", this.onMouseLeave) : this.blur()
8175) 8176 } 8177 }, { 8178 key: "bindDomEvents", 8179 value: function() { 8180 var e = this.player 8181 , t = e.controls 8182 , i = e.config; 8183 this._mouseDownHandlerHook = this.hook("dragstart", this._mouseDownHandler), 8184 this._mouseUpHandlerHook = this.hook("dragend", this._mouseUpHandler), 8185 this._mouseMoveHandlerHook = this.hook("drag", this._mouseMoveHandler), 8186 "touch" !== this.domEventType && "compatible" !== this.domEventType || (this.root.addEventListener("touchstart", this.onMouseDown), 8187 t && (t.root && t.root.addEventListener("touchmove", x.stopPropagation), 8188 t.center && t.center.addEventListener("touchend", x.stopPropagation))), 8189 "mouse" !== this.domEventType && "compatible" !== this.domEventType || (this.bind("mousedown", this.onMouseDown), 8190 "mobile" !== i.isMobileSimulateMode && this.bind("mouseenter", this.onMouseEnter), 8191 this.bind("mouseover", this.onMouseOver), 8192 this.bind("mouseout", this.onMouseOut), 8193 this.player.root.addEventListener("click", this.onBodyClick, !0)) 8194 } 8195 }, { 8196 key: "focus", 8197 value: function() { 8198 this.player.controls.pauseAutoHide(), 8199 x.addClass(this.root, "active") 8200 } 8201 }, { 8202 key: "blur", 8203 value: function() { 8204 this._disableBlur || (this.player.controls.recoverAutoHide(), 8205 x.removeClass(this.root, "active")) 8206 } 8207 }, { 8208 key: "disableBlur", 8209 value: function() { 8210 this._disableBlur = !0 8211 } 8212 }, { 8213 key: "enableBlur", 8214 value: function() { 8215 this._disableBlur = !1 8216 } 8217 }, { 8218 key: "updateWidth", 8219 value: function(e, t, i) { 8220 var n = this.config 8221 , o = this.player; 8222 if (!n.isCloseClickSeek || 0 !== i) { 8223 var r = e >= o.duration ? o.duration - n.endedDiff : Number(e).toFixed(1); 8224 this.updatePercent(t), 8225 this.updateTime(e), 8226 (1 !== i || n.isDragingSeek && "audio" !== o.config.mediaType) && (this._state.now = r, 8227 this._state.direc = r > o.currentTime ? 0 : 1, 8228 o.seek(r)) 8229 } 8230 } 8231 }, { 8232 key: "computeTime", 8233 value: function(e, t) { 8234 var i, n, o = this.player, r = this.root.getBoundingClientRect(), s = r.width, a = r.height, l = r.top, c = r.left, u = t; 8235 90 === o.rotateDeg ? (i = a, 8236 n = l) : (i = s, 8237 n = c); 8238 var h = u - n 8239 , d = (h = h > i ? i : h < 0 ? 0 : h) / i; 8240 return { 8241 percent: d = d < 0 ? 0 : d > 1 ? 1 : d, 8242 currentTime: parseInt(d * this.duration * 1e3, 10) / 1e3, 8243 offset: h, 8244 width: i, 8245 left: n, 8246 e: e 8247 } 8248 } 8249 }, { 8250 key: "updateTime", 8251 value: function(e) { 8252 var t = this.player 8253 , i = this.duration; 8254 e > i ? e = i : e < 0 && (e = 0); 8255 var n = t.plugins.time; 8256 n && n.updateTime(e) 8257 } 8258 }, { 8259 key: "resetSeekState", 8260 value: function() { 8261 this.isProgressMoving = !1; 8262 var e = this.player.plugins.time; 8263 e && e.resetActive() 8264 } 8265 }, { 8266 key: "updatePercent", 8267 value: function(e, t) { 8268 if (this.isProgressMoving = !0, 8269 !this.config.disable) { 8270 e = e > 1 ? 1 : e < 0 ? 0 : e, 8271 this.progressBtn.style.left = "".concat(100 * e, "%"), 8272 this.innerList.update({ 8273 played: e * this.duration 8274 }, this.duration); 8275 var i = this.player.plugins.miniprogress; 8276 i && i.update({ 8277 played: e * this.duration 8278 }, this.duration) 8279 } 8280 } 8281 }, { 8282 key: "onTimeupdate", 8283 value: function(e) { 8284 var t = this.player 8285 , i = this._state 8286 , n = this.duration; 8287 if (!t.isSeeking && !this.isProgressMoving) { 8288 if (i.now > -1) { 8289 var o = parseInt(1e3 * i.now, 10) - parseInt(1e3 * t.currentTime, 10); 8290 if (0 === i.direc && o > 300 || 1 === i.direc && o > -300) 8291 return void (i.now = -1); 8292 i.now = -1 8293 } 8294 var r = this.timeOffset + t.currentTime; 8295 r = x.adjustTimeByDuration(r, n, e), 8296 this.innerList.update({ 8297 played: r 8298 }, n), 8299 this.progressBtn.style.left = "".concat(r / n * 100, "%"); 8300 var s = this.player.plugins.miniprogress; 8301 s && s.update({ 8302 played: r 8303 }, n) 8304 } 8305 } 8306 }, { 8307 key: "onCacheUpdate", 8308 value: function(e) { 8309 var t = this.player 8310 , i = this.duration; 8311 if (t) { 8312 var n = t.bufferedPoint.end; 8313 n = x.adjustTimeByDuration(n, i, e), 8314 this.innerList.update({ 8315 cached: n 8316 }, i); 8317 var o = this.player.plugins.miniprogress; 8318 o && o.update({ 8319 cached: n 8320 }, i) 8321 } 8322 } 8323 }, { 8324 key: "onReset", 8325 value: function() { 8326 this.innerList.update({ 8327 played: 0, 8328 cached: 0 8329 }, 0); 8330 var e = this.player.plugins.miniprogress; 8331 e && e.update({ 8332 cached: 0, 8333 played: 0 8334 }, 0) 8335 } 8336 }, {
8337 key: "destroy", 8338 value: function() { 8339 var e = this.player 8340 , t = e.controls; 8341 this.thumbnailPlugin = null, 8342 this.innerList.destroy(), 8343 this.innerList = null; 8344 var i = this.domEventType; 8345 "touch" !== i && "compatible" !== i || (this.root.removeEventListener("touchstart", this.onMouseDown), 8346 this.root.removeEventListener("touchmove", this.onMouseMove), 8347 this.root.removeEventListener("touchend", this.onMouseUp), 8348 t && (t.root && t.root.removeEventListener("touchmove", x.stopPropagation), 8349 t.center && t.center.removeEventListener("touchend", x.stopPropagation))), 8350 "mouse" !== i && "compatible" !== i || (this.unbind("mousedown", this.onMouseDown), 8351 this.unbind("mouseenter", this.onMouseEnter), 8352 this.unbind("mousemove", this.onMoveOnly), 8353 this.unbind("mouseleave", this.onMouseLeave), 8354 document.removeEventListener("mousemove", this.onMouseMove, !1), 8355 document.removeEventListener("mouseup", this.onMouseUp, !1), 8356 e.root.removeEventListener("click", this.onBodyClick, !0)) 8357 } 8358 }, { 8359 key: "render", 8360 value: function() { 8361 if (!this.config.disable && !this.playerConfig.isLive) { 8362 var e = this.player.controls ? this.player.controls.config.mode : ""; 8363 return '\n <xg-progress class="xgplayer-progress '.concat("bottom" === e ? "xgplayer-progress-bottom" : "", '">\n <xg-outer class="xgplayer-progress-outer">\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n </xg-outer>\n </xg-progress>\n ') 8364 } 8365 } 8366 }], [{ 8367 key: "pluginName", 8368 get: function() { 8369 return "progress" 8370 } 8371 }, { 8372 key: "defaultConfig", 8373 get: function() { 8374 return { 8375 position: et.CONTROLS_CENTER, 8376 index: 0, 8377 disable: !1, 8378 isDragingSeek: !0, 8379 closeMoveSeek: !1, 8380 isPauseMoving: !1, 8381 isCloseClickSeek: !1, 8382 fragments: [{ 8383 percent: 1 8384 }], 8385 fragFocusClass: Oi.POINT, 8386 fragClass: "", 8387 fragAutoFocus: !1, 8388 miniMoveStep: 5, 8389 miniStartStep: 2, 8390 onMoveStart: function() {}, 8391 onMoveEnd: function() {}, 8392 endedDiff: .2 8393 } 8394 } 8395 }, { 8396 key: "FRAGMENT_FOCUS_CLASS", 8397 get: function() { 8398 return Oi 8399 } 8400 }]), 8401 l 8402 }(ot) 8403 , Di = function(e) { 8404 a(i, e); 8405 var t = d(i); 8406 function i() { 8407 var e; 8408 n(this, i); 8409 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 8410 r[a] = arguments[a]; 8411 return s(u(e = t.call.apply(t, [this].concat(r))), "_onMouseenter", (function(t) { 8412 e.emit("icon_mouseenter", { 8413 pluginName: e.pluginName 8414 }) 8415 } 8416 )), 8417 s(u(e), "_onMouseLeave", (function(t) { 8418 e.emit("icon_mouseleave", { 8419 pluginName: e.pluginName 8420 }) 8421 } 8422 )), 8423 e 8424 } 8425 return r(i, [{ 8426 key: "afterCreate", 8427 value: function() { 8428 this.bind("mouseenter", this._onMouseenter), 8429 this.bind("mouseleave", this._onMouseLeave) 8430 } 8431 }, { 8432 key: "destroy", 8433 value: function() { 8434 this.unbind("mouseenter", this._onMouseenter), 8435 this.unbind("mouseleave", this._onMouseLeave) 8436 } 8437 }]), 8438 i 8439 }(ot) 8440 , Mi = function(e) { 8441 a(i, e); 8442 var t = d(i); 8443 function i() { 8444 return n(this, i), 8445 t.apply(this, arguments) 8446 } 8447 return r(i, [{ 8448 key: "afterCreate", 8449 value: function() { 8450 var e = this; 8451 p(l(i.prototype), "afterCreate", this).call(this); 8452 var t = this.player; 8453 this.config.disable || (this.initIcons(), 8454 this.btnClick = this.btnClick.bind(this), 8455 this.bind(["touchend", "click"], this.btnClick), 8456 this.on([B, U, Q], (function() { 8457 e.animate(t.paused) 8458 } 8459 )), 8460 this.on(N, (function() { 8461 e.animate(t.paused) 8462 } 8463 )), 8464 this.animate(!0)) 8465 } 8466 }, { 8467 key: "registerIcons", 8468 value: function() { 8469 return { 8470 play: { 8471 icon: Bt, 8472 class: "xg-icon-play" 8473 }, 8474 pause: { 8475 icon: Ut, 8476 class: "xg-icon-pause" 8477 } 8478 } 8479 } 8480 }, { 8481 key: "btnClick", 8482 value: function(e) { 8483 e.preventDefault(), 8484 e.stopPropagation(); 8485 var t = this.player; 8486 return this.emitUserAction(e, "switch_play_pause", { 8487 prop: "paused", 8488 from: t.paused, 8489 to: !t.paused 8490 }), 8491 t.ended ? t.replay() : t.paused ? (t.play(), 8492 this.animate(!1)) : (t.pause(), 8493 this.animate(!0)), 8494 !1 8495 } 8496 }, { 8497 key: "initIcons", 8498 value: function() { 8499 var e = this.icons; 8500 this.appendChild(".xgplayer-icon", e.play), 8501 this.appendChild(".xgplayer-icon", e.pause) 8502 } 8503 }, { 8504 key: "animate", 8505 value: function(e) { 8506 if (this.player) { 8507 var t = this.i18nKeys 8508 , i = this.find(".xg-tips"); 8509 e ? (this.setAttr("data-state", "pause"), 8510 i && this.changeLangTextKey(i, t.PLAY_TIPS)) : (this.setAttr("data-state", "play"), 8511 i && this.changeLangTextKey(i, t.PAUSE_TIPS)) 8512 } 8513 } 8514 }, {
vendor: 13,323 bytes, lines 8515-8839
8515 key: "destroy", 8516 value: function() { 8517 p(l(i.prototype), "destroy", this).call(this), 8518 this.unbind(["touchend", "click"], this.btnClick) 8519 } 8520 }, { 8521 key: "render", 8522 value: function() { 8523 if (!this.config.disable) 8524 return '<xg-icon class="xgplayer-play">\n <div class="xgplayer-icon">\n </div>\n '.concat(qt(this, "PLAY_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>") 8525 } 8526 }], [{ 8527 key: "pluginName", 8528 get: function() { 8529 return "play" 8530 } 8531 }, { 8532 key: "defaultConfig", 8533 get: function() { 8534 return { 8535 position: et.CONTROLS_LEFT, 8536 index: 0, 8537 disable: !1 8538 } 8539 } 8540 }]), 8541 i 8542 }(Di); 8543 function ji() { 8544 return (new DOMParser).parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n </g>\n</svg>', "image/svg+xml").firstChild 8545 } 8546 var Ni = function(e) { 8547 a(i, e); 8548 var t = d(i); 8549 function i() { 8550 return n(this, i), 8551 t.apply(this, arguments) 8552 } 8553 return r(i, [{ 8554 key: "afterCreate", 8555 value: function() { 8556 var e = this; 8557 this.initIcons(), 8558 this.onClick = function(t) { 8559 t.preventDefault(), 8560 t.stopPropagation(), 8561 e.config.onClick(t) 8562 } 8563 , 8564 this.bind(["click", "touchend"], this.onClick) 8565 } 8566 }, { 8567 key: "registerIcons", 8568 value: function() { 8569 return { 8570 screenBack: { 8571 icon: ji, 8572 class: "xg-fullscreen-back" 8573 } 8574 } 8575 } 8576 }, { 8577 key: "initIcons", 8578 value: function() { 8579 var e = this.icons; 8580 this.appendChild(this.root, e.screenBack) 8581 } 8582 }, { 8583 key: "show", 8584 value: function() { 8585 x.addClass(this.root, "show") 8586 } 8587 }, { 8588 key: "hide", 8589 value: function() { 8590 x.removeClass(this.root, "show") 8591 } 8592 }, { 8593 key: "render", 8594 value: function() { 8595 return '<xg-icon class="xgplayer-back">\n </xg-icon>' 8596 } 8597 }], [{ 8598 key: "pluginName", 8599 get: function() { 8600 return "topbackicon" 8601 } 8602 }, { 8603 key: "defaultConfig", 8604 get: function() { 8605 return { 8606 position: et.ROOT_TOP, 8607 index: 0 8608 } 8609 } 8610 }]), 8611 i 8612 }(ot); 8613 function Fi() { 8614 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n', "image/svg+xml").firstChild 8615 } 8616 function Hi() { 8617 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n', "image/svg+xml").firstChild 8618 } 8619 var Bi = function(e) { 8620 a(i, e); 8621 var t = d(i); 8622 function i() { 8623 var e; 8624 n(this, i); 8625 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 8626 r[a] = arguments[a]; 8627 return s(u(e = t.call.apply(t, [this].concat(r))), "_onOrientationChange", (function(t) { 8628 e.player.fullscreen && e.config.rotateFullscreen && (90 === window.orientation || -90 === window.orientation ? e.player.setRotateDeg(0) : e.player.setRotateDeg(90)) 8629 } 8630 )), 8631 e 8632 } 8633 return r(i, [{ 8634 key: "afterCreate", 8635 value: function() { 8636 var e = this; 8637 p(l(i.prototype), "afterCreate", this).call(this); 8638 var t = this.config 8639 , n = this.playerConfig; 8640 if (!t.disable) { 8641 t.target && (this.playerConfig.fullscreenTarget = this.config.target); 8642 var o = x.getFullScreenEl(); 8643 n.fullscreenTarget === o && this.player.getFullscreen().catch((function(e) {} 8644 )), 8645 this.initIcons(), 8646 this.handleFullscreen = this.hook("fullscreenChange", this.toggleFullScreen, { 8647 pre: function(t) { 8648 var i = e.player.fullscreen; 8649 e.emitUserAction(t, "switch_fullscreen", { 8650 prop: "fullscreen", 8651 from: i, 8652 to: !i 8653 }) 8654 } 8655 }), 8656 this.bind(".xgplayer-fullscreen", ["touchend", "click"], this.handleFullscreen), 8657 this.on(he, (function(t) { 8658 var i = e.find(".xg-tips"); 8659 i && e.changeLangTextKey(i, t ? e.i18nKeys.EXITFULLSCREEN_TIPS : e.i18nKeys.FULLSCREEN_TIPS), 8660 e.animate(t) 8661 } 8662 )), 8663 this.config.needBackIcon && (this.topBackIcon = this.player.registerPlugin({ 8664 plugin: Ni, 8665 options: { 8666 config: { 8667 onClick: function(t) { 8668 e.handleFullscreen(t) 8669 } 8670 } 8671 } 8672 })), 8673 "mobile" === O.device && window.addEventListener("orientationchange", this._onOrientationChange) 8674 } 8675 } 8676 }, { 8677 key: "registerIcons", 8678 value: function() { 8679 return { 8680 fullscreen: { 8681 icon: Fi, 8682 class: "xg-get-fullscreen" 8683 }, 8684 exitFullscreen: { 8685 icon: Hi, 8686 class: "xg-exit-fullscreen" 8687 } 8688 } 8689 } 8690 }, { 8691 key: "destroy", 8692 value: function() { 8693 p(l(i.prototype), "destroy", this).call(this), 8694 this.unbind(".xgplayer-icon", "mobile" === O.device ? "touchend" : "click", this.handleFullscreen), 8695 "mobile" === O.device && window.removeEventListener("orientationchange", this._onOrientationChange) 8696 } 8697 }, { 8698 key: "initIcons", 8699 value: function() { 8700 var e = this.icons; 8701 this.appendChild(".xgplayer-icon", e.fullscreen), 8702 this.appendChild(".xgplayer-icon", e.exitFullscreen) 8703 } 8704 }, { 8705 key: "toggleFullScreen", 8706 value: function(e) { 8707 e && (e.preventDefault(), 8708 e.stopPropagation()); 8709 var t = this.player 8710 , i = this.config; 8711 !0 === i.useCssFullscreen || "function" == typeof i.useCssFullscreen && i.useCssFullscreen() ? (t.fullscreen ? t.exitCssFullscreen() : t.getCssFullscreen(), 8712 this.animate(t.fullscreen)) : i.rotateFullscreen ? (t.fullscreen ? t.exitRotateFullscreen() : t.getRotateFullscreen(), 8713 this.animate(t.fullscreen)) : i.switchCallback && "function" == typeof i.switchCallback ? i.switchCallback(t.fullscreen) : t.fullscreen ? t.exitFullscreen() : t.getFullscreen().catch((function(e) {} 8714 )) 8715 } 8716 }, { 8717 key: "animate", 8718 value: function(e) { 8719 e ? this.setAttr("data-state", "full") : this.setAttr("data-state", "normal"), 8720 this.topBackIcon && (e ? (this.topBackIcon.show(), 8721 this.hide()) : (this.topBackIcon.hide(), 8722 this.show())) 8723 } 8724 }, { 8725 key: "show", 8726 value: function() { 8727 p(l(i.prototype), "show", this).call(this) 8728 } 8729 }, { 8730 key: "hide", 8731 value: function() { 8732 p(l(i.prototype), "hide", this).call(this) 8733 } 8734 }, { 8735 key: "render", 8736 value: function() { 8737 if (!this.config.disable) { 8738 return '<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(qt(this, "FULLSCREEN_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>") 8739 } 8740 } 8741 }], [{ 8742 key: "pluginName", 8743 get: function() { 8744 return "fullscreen" 8745 } 8746 }, { 8747 key: "defaultConfig", 8748 get: function() { 8749 return { 8750 position: et.CONTROLS_RIGHT, 8751 index: 0, 8752 useCssFullscreen: !1, 8753 rotateFullscreen: !1, 8754 switchCallback: null, 8755 target: null, 8756 disable: !1, 8757 needBackIcon: !1 8758 } 8759 } 8760 }]), 8761 i 8762 }(Di) 8763 , Ui = function(e) { 8764 a(i, e); 8765 var t = d(i); 8766 function i(e) { 8767 var o; 8768 return n(this, i), 8769 (o = t.call(this, e)).isActiving = !1, 8770 o 8771 } 8772 return r(i, [{ 8773 key: "duration", 8774 get: function() { 8775 return this.playerConfig.customDuration || this.player.duration 8776 } 8777 }, { 8778 key: "currentTime", 8779 get: function() { 8780 return this.player.currentTime || 0 8781 } 8782 }, { 8783 key: "timeOffset", 8784 get: function() { 8785 return this.playerConfig.timeOffset || 0 8786 } 8787 }, { 8788 key: "afterCreate", 8789 value: function() { 8790 var e = this 8791 , t = this.player.controls.config.mode; 8792 this.mode = "flex" === t ? "flex" : "normal", 8793 this.config.disable || ("flex" === this.mode && (this.createCenterTime(), 8794 this.root.style.display = "none"), 8795 this.durationDom = this.find(".time-duration"), 8796 this.timeDom = this.find(".time-current"), 8797 this.on(K, (function() { 8798 e.onTimeUpdate() 8799 } 8800 )), 8801 this.on(W, (function() { 8802 e.onTimeUpdate() 8803 } 8804 )), 8805 this.on(H, (function() { 8806 e.onTimeUpdate(!0) 8807 } 8808 )), 8809 this.on(Q, (function() { 8810 e.onReset() 8811 } 8812 ))) 8813 } 8814 }, { 8815 key: "show", 8816 value: function() { 8817 if ("flex" === this.mode) 8818 return this.centerCurDom && (this.centerCurDom.style.display = "block"), 8819 void (this.centerDurDom && (this.centerDurDom.style.display = "block")); 8820 this.root.style.display = "block" 8821 } 8822 }, { 8823 key: "hide", 8824 value: function() { 8825 if ("flex" === this.mode) 8826 return this.centerCurDom && (this.centerCurDom.style.display = "none"), 8827 void (this.centerDurDom && (this.centerDurDom.style.display = "none")); 8828 this.root.style.display = "none" 8829 } 8830 }, { 8831 key: "onTimeUpdate", 8832 value: function(e) { 8833 var t = this.player 8834 , i = this.config 8835 , n = this.duration; 8836 if (!i.disable && !this.isActiving && t.hasStart) { 8837 var o = t.currentTime + this.timeOffset; 8838 o = x.adjustTimeByDuration(o, n, e), 8839 "flex" === this.mode ? (this.centerCurDom.innerHTML = x.format(
8839o), 8840 n !== 1 / 0 && n > 0 && (this.centerDurDom.innerHTML = x.format(n))) : (this.timeDom.innerHTML = x.format(o), 8841 n !== 1 / 0 && n > 0 && (this.durationDom.innerHTML = x.format(n))) 8842 } 8843 } 8844 }, { 8845 key: "onReset", 8846 value: function() { 8847 "flex" === this.mode ? (this.centerCurDom.innerHTML = x.format(0), 8848 this.centerDurDom.innerHTML = x.format(0)) : (this.timeDom.innerHTML = x.format(0), 8849 this.durationDom.innerHTML = x.format(0)) 8850 } 8851 }, { 8852 key: "createCenterTime", 8853 value: function() { 8854 var e = this.player; 8855 if (e.controls && e.controls.center) { 8856 var t = e.controls.center; 8857 this.centerCurDom = x.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-left"), 8858 this.centerDurDom = x.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-right"), 8859 t.children.length > 0 ? t.insertBefore(this.centerCurDom, t.children[0]) : t.appendChild(this.centerCurDom), 8860 t.appendChild(this.centerDurDom) 8861 } 8862 } 8863 }, { 8864 key: "afterPlayerInit", 8865 value: function() { 8866 var e = this.config; 8867 this.duration === 1 / 0 || this.playerConfig.isLive ? (x.hide(this.durationDom), 8868 x.hide(this.timeDom), 8869 x.hide(this.find(".time-separator")), 8870 x.show(this.find(".time-live-tag"))) : x.hide(this.find(".time-live-tag")), 8871 e.hide ? this.hide() : this.show() 8872 } 8873 }, { 8874 key: "changeLiveState", 8875 value: function(e) { 8876 e ? (x.hide(this.durationDom), 8877 x.hide(this.timeDom), 8878 x.hide(this.find(".time-separator")), 8879 x.show(this.find(".time-live-tag"))) : (x.hide(this.find(".time-live-tag")), 8880 x.show(this.find(".time-separator")), 8881 x.show(this.durationDom), 8882 x.show(this.timeDom)) 8883 } 8884 }, { 8885 key: "updateTime", 8886 value: function(e) { 8887 this.isActiving = !0, 8888 !e && 0 !== e || e > this.duration || ("flex" !== this.mode ? this.timeDom.innerHTML = x.format(e) : this.centerCurDom.innerHTML = x.format(e)) 8889 } 8890 }, { 8891 key: "resetActive", 8892 value: function() { 8893 var e = this 8894 , t = this.player 8895 , i = function() { 8896 e.isActiving = !1 8897 }; 8898 this.off(G, i), 8899 t.isSeeking ? this.once(G, i) : this.isActiving = !1 8900 } 8901 }, { 8902 key: "destroy", 8903 value: function() { 8904 var e = this.player.controls.center; 8905 this.centerCurDom && e.removeChild(this.centerCurDom), 8906 this.centerCurDom = null, 8907 this.centerDurDom && e.removeChild(this.centerDurDom), 8908 this.centerDurDom = null 8909 } 8910 }, { 8911 key: "render", 8912 value: function() { 8913 if (!this.config.disable) 8914 return '<xg-icon class="xgplayer-time">\n <span class="time-current">00:00</span>\n <span class="time-separator">/</span>\n <span class="time-duration">00:00</span>\n <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP, "</span>\n </xg-icon>") 8915 } 8916 }], [{ 8917 key: "pluginName", 8918 get: function() { 8919 return "time" 8920 } 8921 }, { 8922 key: "defaultConfig", 8923 get: function() { 8924 return { 8925 position: et.CONTROLS_LEFT, 8926 index: 2, 8927 disable: !1 8928 } 8929 } 8930 }]), 8931 i 8932 }(ot); 8933 function Vi() { 8934 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.61
vendor: 27,244 bytes, lines 8934-9495
89347 181.227l-0.021 0.021z"></path>\n</svg>\n', "image/svg+xml").firstChild 8935 } 8936 function Gi() { 8937 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n', "image/svg+xml").firstChild 8938 } 8939 function Wi() { 8940 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>\n</svg>\n', "image/svg+xml").firstChild 8941 } 8942 var qi = function(e) { 8943 a(i, e); 8944 var t = d(i); 8945 function i() { 8946 var e; 8947 n(this, i); 8948 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 8949 r[a] = arguments[a]; 8950 return s(u(e = t.call.apply(t, [this].concat(r))), "onBarMousedown", (function(t) { 8951 var i = u(e).player 8952 , n = e.find(".xgplayer-bar"); 8953 x.event(t); 8954 var o = n.getBoundingClientRect() 8955 , r = x.getEventPos(t, i.zoom) 8956 , s = o.height - (r.clientY - o.top); 8957 if (r.h = s, 8958 r.barH = o.height, 8959 e.pos = r, 8960 !(s < -2)) 8961 return e.updateVolumePos(s, t), 8962 document.addEventListener("mouseup", e.onBarMouseUp), 8963 e._d.isStart = !0, 8964 !1 8965 } 8966 )), 8967 s(u(e), "onBarMouseMove", (function(t) { 8968 var i = u(e)._d; 8969 if (i.isStart) { 8970 var n = u(e) 8971 , o = n.pos 8972 , r = n.player; 8973 t.preventDefault(), 8974 t.stopPropagation(), 8975 x.event(t); 8976 var s = x.getEventPos(t, r.zoom); 8977 i.isMoving = !0; 8978 var a = o.h - s.clientY + o.clientY; 8979 a > o.barH || e.updateVolumePos(a, t) 8980 } 8981 } 8982 )), 8983 s(u(e), "onBarMouseUp", (function(t) { 8984 x.event(t), 8985 document.removeEventListener("mouseup", e.onBarMouseUp); 8986 var i = u(e)._d; 8987 i.isStart = !1, 8988 i.isMoving = !1 8989 } 8990 )), 8991 s(u(e), "onMouseenter", (function(t) { 8992 e._d.isActive = !0, 8993 e.focus(), 8994 e.emit("icon_mouseenter", { 8995 pluginName: e.pluginName 8996 }) 8997 } 8998 )), 8999 s(u(e), "onMouseleave", (function(t) { 9000 e._d.isActive = !1, 9001 e.unFocus(100, !1, t), 9002 e.emit("icon_mouseleave", { 9003 pluginName: e.pluginName 9004 }) 9005 } 9006 )), 9007 s(u(e), "onVolumeChange", (function(t) { 9008 if (e.player) { 9009 var i = e.player 9010 , n = i.muted 9011 , o = i.volume; 9012 e._d.isMoving || (e.find(".xgplayer-drag").style.height = n || 0 === o ? "4px" : "".concat(100 * o, "%"), 9013 e.config.showValueLabel && e.updateVolumeValue()), 9014 e.animate(n, o) 9015 } 9016 } 9017 )), 9018 e 9019 } 9020 return r(i, [{ 9021 key: "registerIcons", 9022 value: function() { 9023 return { 9024 volumeSmall: { 9025 icon: Gi, 9026 class: "xg-volume-small" 9027 }, 9028 volumeLarge: { 9029 icon: Vi, 9030 class: "xg-volume" 9031 }, 9032 volumeMuted: { 9033 icon: Wi, 9034 class: "xg-volume-mute" 9035 } 9036 } 9037 } 9038 }, { 9039 key: "afterCreate", 9040 value: function() { 9041 var e = this; 9042 if (this._timerId = null, 9043 this._d = { 9044 isStart: !1, 9045 isMoving: !1, 9046 isActive: !1 9047 }, 9048 !this.config.disable) { 9049 this.initIcons(); 9050 var t = this.playerConfig 9051 , i = t.commonStyle 9052 , n = t.volume; 9053 i.volumeColor && (this.find(".xgplayer-drag").style.backgroundColor = i.volumeColor), 9054 this.changeMutedHandler = this.hook("mutedChange", (function(t) { 9055 e.changeMuted(t) 9056 } 9057 ), { 9058 pre: function(e) { 9059 e.preventDefault(), 9060 e.stopPropagation() 9061 } 9062 }), 9063 this._onMouseenterHandler = this.hook("mouseenter", this.onMouseenter), 9064 this._onMouseleaveHandler = this.hook("mouseleave", this.onMouseleave), 9065 "mobile" !== O.device && "mobile" !== this.playerConfig.isMobileSimulateMode && (this.bind("mouseenter", this._onMouseenterHandler), 9066 this.bind(["blur", "mouseleave"], this._onMouseleaveHandler), 9067 this.bind(".xgplayer-slider", "mousedown", this.onBarMousedown), 9068 this.bind(".xgplayer-slider", "mousemove", this.onBarMouseMove), 9069 this.bind(".xgplayer-slider", "mouseup", this.onBarMouseUp)), 9070 this.bind(".xgplayer-icon", ["touchend", "click"], this.changeMutedHandler), 9071 this.on(Y, this.onVolumeChange), 9072 this.once(X, this.onVolumeChange), 9073 "Number" !== x.typeOf(n) && (this.player.volume = this.config.default), 9074 this.onVolumeChange() 9075 } 9076 } 9077 }, { 9078 key: "updateVolumePos", 9079 value: function(e, t) { 9080 var i = this.player 9081 , n = this.find(".xgplayer-drag") 9082 , o = this.find(".xgplayer-bar"); 9083 if (o && n) { 9084 var r = parseInt(e / o.getBoundingClientRect().height * 1e3, 10); 9085 n.style.height = "".concat(e, "px"); 9086 var s = Math.max(Math.min(r / 1e3, 1), 0) 9087 , a = { 9088 volume: { 9089 from: i.volume, 9090 to: s 9091 } 9092 }; 9093 i.muted && (a.muted = { 9094 from: !0, 9095 to: !1 9096 }), 9097 this.emitUserAction(t, "change_volume", { 9098 muted: i.muted, 9099 volume: i.volume, 9100 props: a 9101 }), 9102 i.volume = Math.max(Math.min(r / 1e3, 1), 0), 9103 i.muted && (i.muted = !1), 9104 this.config.showValueLabel && this.updateVolumeValue() 9105 } 9106 } 9107 }, { 9108 key: "updateVolumeValue", 9109 value: function() { 9110 var e = this.player 9111 , t = e.volume 9112 , i = e.muted 9113 , n = this.find(".xgplayer-value-label") 9114 , o = Math.max(Math.min(t, 1), 0); 9115 n.innerText = i ? 0 : Math.ceil(100 * o) 9116 } 9117 }, { 9118 key: "focus", 9119 value: function() { 9120 this.player.focus({ 9121 autoHide: !1 9122 }), 9123 this._timerId && (x.clearTimeout(this, this._timerId), 9124 this._timerId = null), 9125 x.addClass(this.root, "slide-show") 9126 } 9127 }, { 9128 key: "unFocus", 9129 value: function() { 9130 var e = this 9131 , t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 100 9132 , i = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1] 9133 , n = arguments.length > 2 ? arguments[2] : void 0 9134 , o = this._d 9135 , r = this.player; 9136 o.isActive || (this._timerId && (x.clearTimeout(this, this._timerId), 9137 this._timerId = null), 9138 this._timerId = x.setTimeout(this, (function() { 9139 o.isActive || (i ? r.blur() : r.focus(), 9140 x.removeClass(e.root, "slide-show"), 9141 o.isStart && e.onBarMouseUp(n)), 9142 e._timerId = null 9143 } 9144 ), t)) 9145 } 9146 }, { 9147 key: "changeMuted", 9148 value: function(e) { 9149 e && e.stopPropagation(); 9150 var t = this.player; 9151 this._d.isStart && this.onBarMouseUp(e), 9152 this.emitUserAction(e, "change_muted", { 9153 muted: t.muted, 9154 volume: t.volume, 9155 props: { 9156 muted: { 9157 from: t.muted, 9158 to: !t.muted 9159 } 9160 } 9161 }), 9162 t.volume > 0 && (t.muted = !t.muted), 9163 t.volume < .01 && (t.volume = this.config.miniVolume) 9164 } 9165 }, { 9166 key: "animate", 9167 value: function(e, t) { 9168 e || 0 === t ? this.setAttr("data-state", "mute") : t < .5 && this.icons.volumeSmall ? this.setAttr("data-state", "small") : this.setAttr("data-state", "normal") 9169 } 9170 }, { 9171 key: "initIcons", 9172 value: function() { 9173 var e = this.icons; 9174 this.appendChild(".xgplayer-icon", e.volumeSmall), 9175 this.appendChild(".xgplayer-icon", e.volumeLarge), 9176 this.appendChild(".xgplayer-icon", e.volumeMuted) 9177 } 9178 }, { 9179 key: "destroy", 9180 value: function() { 9181 this._timerId && (x.clearTimeout(this, this._timerId), 9182 this._timerId = null), 9183 this.unbind("mouseenter", this.onMouseenter), 9184 this.unbind(["blur", "mouseleave"], this.onMouseleave), 9185 this.unbind(".xgplayer-slider", "mousedown", this.onBarMousedown), 9186 this.unbind(".xgplayer-slider", "mousemove", this.onBarMouseMove), 9187 this.unbind(".xgplayer-slider", "mouseup", this.onBarMouseUp), 9188 document.removeEventListener("mouseup", this.onBarMouseUp), 9189 this.unbind(".xgplayer-icon", "mobile" === O.device ? "touchend" : "click", this.changeMutedHandler) 9190 } 9191 }, { 9192 key: "render", 9193 value: function() { 9194 if (!this.config.disable) { 9195 var e = this.config.default || this.player.volume 9196 , t = this.config.showValueLabel; 9197 return '\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(t ? '<div class="xgplayer-value-label">'.concat(100 * e, "</div>") : "", '\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ').concat(100 * e, '%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>') 9198 } 9199 } 9200 }], [{ 9201 key: "pluginName", 9202 get: function() { 9203 return "volume" 9204 } 9205 }, { 9206 key: "defaultConfig", 9207 get: function() { 9208 return { 9209 position: et.CONTROLS_RIGHT, 9210 index: 1, 9211 disable: !1, 9212 showValueLabel: !1, 9213 default: .6, 9214 miniVolume: .2 9215 } 9216 } 9217 }]), 9218 i 9219 }(ot); 9220 function zi() { 9221 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">\n <g clip-path="url(#clip0)">\n <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>\n <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>\n </g>\n <defs>\n <clipPath id="clip0">\n <rect width="40" height="40" fill="white"/>\n </clipPath>\n </defs>\n</svg>\n', "image/svg+xml").firstChild 9222 } 9223 var Ki = function(e) { 9224 a(i, e); 9225 var t = d(i); 9226 function i(e) { 9227 var o; 9228 return n(this, i), 9229 (o = t.call(this, e)).rotateDeg = o.config.rotateDeg || 0, 9230 o 9231 } 9232 return r(i, [{ 9233 key: "afterCreate", 9234 value: function() { 9235 var e = this; 9236 this.config.disable || (p(l(i.prototype), "afterCreate", this).call(this), 9237 this.appendChild(".xgplayer-icon", this.icons.rotate), 9238 this.onBtnClick = this.onBtnClick.bind(this), 9239 this.bind(".xgplayer-icon", ["click", "touchend"], this.onBtnClick), 9240 this.on(ve, (function() { 9241 e.rotateDeg && x.setTimeout(e, (function() { 9242 e.updateRotateDeg(e.rotateDeg, e.config.innerRotate) 9243 } 9244 ), 100) 9245 } 9246 )), 9247 this.rotateDeg && this.updateRotateDeg(this.rotateDeg, this.config.innerRotate)) 9248 } 9249 }, { 9250 key: "destroy", 9251 value: function() { 9252 p(l(i.prototype), "destroy", this).call(this), 9253 this.unbind(".xgplayer-icon", ["click", "touchend"], this.onBtnClick) 9254 } 9255 }, { 9256 key: "onBtnClick", 9257 value: function(e) { 9258 e.preventDefault(), 9259 e.stopPropagation(), 9260 this.emitUserAction(e, "rotate"), 9261 this.rotate(this.config.clockwise, this.config.innerRotate, 1) 9262 } 9263 }, { 9264 key: "updateRotateDeg", 9265 value: function(e, t) { 9266 var i = this.player; 9267 e || (e = 0); 9268 var n = this.player 9269 , o = n.root 9270 , r = n.innerContainer 9271 , s = this.player.media 9272 , a = o.offsetWidth 9273 , l = r && t ? r.offsetHeight : o.offsetHeight 9274 , c = "100%" 9275 , u = "100%" 9276 , h = 0 9277 , d = 0; 9278 .75 !== e && .25 !== e || (c = "".concat(l, "px"), 9279 u = "".concat(a, "px"), 9280 h = -(l - a) / 2, 9281 d = -(a - l) / 2); 9282 var f = "translate(".concat(h, "px,").concat(d, "px) rotate(").concat(e, "turn)") 9283 , p = { 9284 transformOrigin: "center center", 9285 transform: f, 9286 webKitTransform: f, 9287 height: u, 9288 width: c 9289 } 9290 , g = t ? s : o 9291 , v = t ? i.getPlugin("poster") : null; 9292 Object.keys(p).map((function(e) { 9293 g.style[e] = p[e], 9294 v && v.root && (v.root.style[e] = p[e]) 9295 } 9296 )) 9297 } 9298 }, { 9299 key: "rotate", 9300 value: function() { 9301 var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0] 9302 , t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1] 9303 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1 9304 , n = this.player; 9305 this.rotateDeg || (this.rotateDeg = 0); 9306 var o = e ? 1 : -1; 9307 this.rotateDeg = (this.rotateDeg + 1 + .25 * o * i) % 1, 9308 this.updateRotateDeg(this.rotateDeg, t), 9309 n.emit(me, 360 * this.rotateDeg) 9310 } 9311 }, { 9312 key: "registerIcons", 9313 value: function() { 9314 return { 9315 rotate: zi 9316 } 9317 } 9318 }, { 9319 key: "render", 9320 value: function() { 9321 if (!this.config.disable) 9322 return '\n <xg-icon class="xgplayer-rotate">\n <div class="xgplayer-icon">\n </div>\n '.concat(qt(this, "ROTATE_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>") 9323 } 9324 }], [{ 9325 key: "pluginName", 9326 get: function() { 9327 return "rotate" 9328 } 9329 }, { 9330 key: "defaultConfig", 9331 get: function() { 9332 return { 9333 position: et.CONTROLS_RIGHT, 9334 index: 6, 9335 innerRotate: !0, 9336 clockwise: !1, 9337 rotateDeg: 0, 9338 disable: !1 9339 } 9340 } 9341 }]), 9342 i 9343 }(Di); 9344 function Yi() { 9345 return (new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n</svg>', "image/svg+xml").firstChild 9346 } 9347 function Xi() { 9348 return (new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"\n fill="white" />\n</svg>', "image/svg+xml").firstChild 9349 } 9350 var Zi = "picture-in-picture" 9351 , Ji = "inline" 9352 , $i = "fullscreen" 9353 , Qi = function(e) { 9354 a(i, e); 9355 var t = d(i); 9356 function i() { 9357 var e; 9358 n(this, i); 9359 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 9360 r[a] = arguments[a]; 9361 return s(u(e = t.call.apply(t, [this].concat(r))), "switchPIP", (function(t) { 9362 if (!e.isPIPAvailable()) 9363 return !1; 9364 t.stopPropagation && t.stopPropagation(), 9365 e.isPip ? (e.exitPIP(), 9366 e.emitUserAction(t, "change_pip", { 9367 props: "pip", 9368 from: !0, 9369 to: !1 9370 }), 9371 e.setAttr("data-state", "normal")) : 4 === e.player.media.readyState && (e.requestPIP(), 9372 e.emitUserAction(t, "change_pip", { 9373 props: "pip", 9374 from: !1, 9375 to: !0 9376 }), 9377 e.setAttr("data-state", "pip")) 9378 } 9379 )), 9380 e 9381 } 9382 return r(i, [{ 9383 key: "beforeCreate", 9384 value: function(e) { 9385 "boolean" == typeof e.player.config.pip && (e.config.showIcon = e.player.config.pip) 9386 } 9387 }, { 9388 key: "afterCreate", 9389 value: function() { 9390 var e = this; 9391 this.isPIPAvailable() && (p(l(i.prototype), "afterCreate", this).call(this), 9392 this.pMode = Ji, 9393 this.initPipEvents(), 9394 this.config.showIcon && this.initIcons(), 9395 this.once(se, (function() { 9396 e.config.showIcon && (x.removeClass(e.find(".xgplayer-icon"), "xg-icon-disable"), 9397 e.bind("click", e.switchPIP)) 9398 } 9399 ))) 9400 } 9401 }, { 9402 key: "registerIcons", 9403 value: function() { 9404 return { 9405 pipIcon: { 9406 icon: Yi, 9407 class: "xg-get-pip" 9408 }, 9409 pipIconExit: { 9410 icon: Xi, 9411 class: "xg-exit-pip" 9412 } 9413 } 9414 } 9415 }, { 9416 key: "initIcons", 9417 value: function() { 9418 var e = this.icons; 9419 this.appendChild(".xgplayer-icon", e.pipIcon), 9420 this.appendChild(".xgplayer-icon", e.pipIconExit) 9421 } 9422 }, { 9423 key: "initPipEvents", 9424 value: function() { 9425 var e = this 9426 , t = this.player; 9427 this.leavePIPCallback = function() { 9428 var i = t.paused; 9429 x.setTimeout(e, (function() { 9430 !i && t.mediaPlay() 9431 } 9432 ), 0), 9433 !i && t.mediaPlay(), 9434 e.setAttr("data-state", "normal"), 9435 t.emit(ye, !1) 9436 } 9437 , 9438 this.enterPIPCallback = function(i) { 9439 t.emit(ye, !0), 9440 e.pipWindow = i.pictureInPictureWindow, 9441 e.setAttr("data-state", "pip") 9442 } 9443 , 9444 this.onWebkitpresentationmodechanged = function(i) { 9445 var n = t.media.webkitPresentationMode; 9446 e.pMode === $i && n !== $i && t.onFullscreenChange(null, !1), 9447 e.pMode = n, 9448 n === Zi ? e.enterPIPCallback(i) : n === Ji && e.leavePIPCallback(i) 9449 } 9450 , 9451 t.media && (t.media.addEventListener("enterpictureinpicture", this.enterPIPCallback), 9452 t.media.addEventListener("leavepictureinpicture", this.leavePIPCallback), 9453 i.checkWebkitSetPresentationMode(t.media) && t.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged)) 9454 } 9455 }, { 9456 key: "requestPIP", 9457 value: function() { 9458 var e = this.player 9459 , t = this.playerConfig; 9460 if (this.isPIPAvailable() && !this.isPip) 9461 try { 9462 var n = t.poster; 9463 return n && (e.media.poster = "String" === x.typeOf(n) ? n : n.poster), 9464 i.checkWebkitSetPresentationMode(e.media) ? e.media.webkitSetPresentationMode("picture-in-picture") : e.media.requestPictureInPicture(), 9465 !0 9466 } catch (o) { 9467 return console.error("requestPiP", o), 9468 !1 9469 } 9470 } 9471 }, { 9472 key: "exitPIP", 9473 value: function() { 9474 var e = this.player; 9475 try { 9476 return this.isPIPAvailable() && this.isPip && (i.checkWebkitSetPresentationMode(e.media) ? e.media.webkitSetPresentationMode("inline") : document.exitPictureInPicture()), 9477 !0 9478 } catch (t) { 9479 return console.error("exitPIP", t), 9480 !1 9481 } 9482 } 9483 }, { 9484 key: "isPip", 9485 get: function() { 9486 var e = this.player; 9487 return document.pictureInPictureElement && document.pictureInPictureElement === e.media || e.media.webkitPresentationMode === Zi 9488 } 9489 }, { 9490 key: "isPIPAvailable", 9491 value: function() { 9492 var e = this.player.media; 9493 return ("Boolean" !== x.typeOf(document.pictureInPictureEnabled) || document.pictureInPictureEnabled) && ("Boolean" === x.typeOf(e.disablePictureInPicture) && !e.disablePictureInPicture || e.webkitSupportsPresentationMode && "Function" === x.typeOf(e.webkitSetPresentationMode)) 9494 } 9495 }, {
9496 key: "destroy", 9497 value: function() { 9498 p(l(i.prototype), "destroy", this).call(this); 9499 var e = this.player; 9500 e.media.removeEventListener("enterpictureinpicture", this.enterPIPCallback), 9501 e.media.removeEventListener("leavepictureinpicture", this.leavePIPCallback), 9502 i.checkWebkitSetPresentationMode(e.media) && e.media.removeEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged), 9503 this.exitPIP(), 9504 this.unbind("click", this.btnClick) 9505 } 9506 }, { 9507 key: "render", 9508 value: function() { 9509 if (this.config.showIcon && this.isPIPAvailable()) 9510 return '<xg-icon class="xgplayer-pip">\n <div class="xgplayer-icon xg-icon-disable">\n </div>\n '.concat(qt(this, "PIP", this.playerConfig.isHideTips), "\n </xg-icon>") 9511 } 9512 }], [{ 9513 key: "pluginName", 9514 get: function() { 9515 return "pip" 9516 } 9517 }, { 9518 key: "defaultConfig", 9519 get: function() { 9520 return { 9521 position: et.CONTROLS_RIGHT, 9522 index: 6, 9523 showIcon: !1 9524 } 9525 } 9526 }, { 9527 key: "checkWebkitSetPresentationMode", 9528 value: function(e) { 9529 return "function" == typeof e.webkitSetPresentationMode 9530 } 9531 }]), 9532 i 9533 }(Di); 9534 function en() { 9535 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">\n <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>\n</svg>\n', "image/svg+xml").firstChild 9536 } 9537 var tn = function(e) { 9538 a(i, e); 9539 var t = d(i); 9540 function i(e) { 9541 var o; 9542 return n(this, i), 9543 s(u(o = t.call(this, e)), "playNext", (function(e) { 9544 var t = u(o).player; 9545 e.preventDefault(), 9546 e.stopPropagation(), 9547 o.idx + 1 < o.config.urlList.length ? (o.idx++, 9548 o.nextHandler(o.config.urlList[o.idx], o.idx), 9549 t.emit(be, o.idx + 1)) : (o.nextHandler(), 9550 t.emit(be)) 9551 } 9552 )), 9553 o.idx = -1, 9554 o 9555 } 9556 return r(i, [{ 9557 key: "afterCreate", 9558 value: function() { 9559 this.config.urlList && 0 !== this.config.urlList.length && (this.appendChild(".xgplayer-icon", this.icons.playNext), 9560 this.initEvents()) 9561 } 9562 }, { 9563 key: "registerIcons", 9564 value: function() { 9565 return { 9566 playNext: en 9567 } 9568 } 9569 }, { 9570 key: "initEvents", 9571 value: function() { 9572 this.nextHandler = this.hook("nextClick", this.changeSrc); 9573 var e = "mobile" === O.device ? "touchend" : "click"; 9574 this.bind(e, this.playNext), 9575 this.show() 9576 } 9577 }, { 9578 key: "changeSrc", 9579 value: function(e) { 9580 var t = this.player; 9581 e && (t.pause(), 9582 t.currentTime = 0, 9583 t.switchURL ? t.switchURL(e) : t.src = e, 9584 t.config.url = e, 9585 t.play()) 9586 } 9587 }, { 9588 key: "destroy", 9589 value: function() { 9590 this.unbind(["touchend", "click"], this.playNext) 9591 } 9592 }, { 9593 key: "render", 9594 value: function() { 9595 if (this.config.urlList && 0 !== this.config.urlList.length) 9596 return '\n <xg-icon class="xgplayer-playnext">\n <div class="xgplayer-icon">\n </div>\n '.concat(qt(this, "PLAYNEXT_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>\n ") 9597 } 9598 }], [{ 9599 key: "pluginName", 9600 get: function() { 9601 return "playNext" 9602 } 9603 }, { 9604 key: "defaultConfig", 9605 get: function() { 9606 return { 9607 position: et.CONTROLS_LEFT, 9608 index: 1, 9609 url: null, 9610 urlList: [] 9611 } 9612 } 9613 }]), 9614 i 9615 }(ot) 9616 , nn = { 9617 exports: {} 9618 }; 9619 nn.exports = function e(t, i, n) { 9620 var o, r, s = window, a = "application/octet-stream", l = n || a, c = t, u = !i && !n && c, h = document.createElement("a"), d = function(e) { 9621 return String(e) 9622 }, f = s.Blob || s.MozBlob || s.WebKitBlob || d, p = i || "download"; 9623 if (f = f.call ? f.bind(s) : Blob, 9624 "true" === String(this) && (l = (c = [c, l])[0], 9625 c = c[1]), 9626 u && u.length < 2048 && (p = u.split("/").pop().split("?")[0], 9627 h.href = u, 9628 -1 !== h.href.indexOf(u))) { 9629 var g = new XMLHttpRequest; 9630 return g.open("GET", u, !0), 9631 g.responseType = "blob", 9632 g.onload = function(t) { 9633 e(t.target.response, p, a) 9634 } 9635 , 9636 setTimeout((function() { 9637 g.send() 9638 } 9639 ), 0), 9640 g 9641 } 9642 if (/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)) { 9643 if (!(c.length > 2096103.424 && f !== d)) 9644 return navigator.msSaveBlob ? navigator.msSaveBlob(k(c), p) : b(c); 9645 l = (c = k(c)).type || a 9646 } else if (/([\x80-\xff])/.test(c)) { 9647 for (var v = 0, y = new Uint8Array(c.length), m = y.length; v < m; ++v)
9648 y[v] = c.charCodeAt(v); 9649 c = new f([y],{ 9650 type: l 9651 }) 9652 } 9653 function k(e) { 9654 for (var t = e.split(/[:;,]/), i = t[1], n = ("base64" == t[2] ? atob : decodeURIComponent)(t.pop()), o = n.length, r = 0, s = new Uint8Array(o); r < o; ++r) 9655 s[r] = n.charCodeAt(r); 9656 return new f([s],{ 9657 type: i 9658 }) 9659 } 9660 function b(e, t) { 9661 if ("download"in h) 9662 return h.href = e, 9663 h.setAttribute("download", p), 9664 h.className = "download-js-link", 9665 h.innerHTML = "downloading...", 9666 h.style.display = "none", 9667 document.body.appendChild(h), 9668 setTimeout((function() { 9669 h.click(), 9670 document.body.removeChild(h), 9671 !0 === t && setTimeout((function() { 9672 s.URL.revokeObjectURL(h.href) 9673 } 9674 ), 250) 9675 } 9676 ), 66), 9677 !0; 9678 if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) 9679 return /^data:/.test(e) && (e = "data:" + e.replace(/^data:([\w\/\-\+]+)/, a)), 9680 window.open(e) || confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.") && (location.href = e), 9681 !0; 9682 var i = document.createElement("iframe"); 9683 document.body.appendChild(i), 9684 !t && /^data:/.test(e) && (e = "data:" + e.replace(/^data:([\w\/\-\+]+)/, a)), 9685 i.src = e, 9686 setTimeout((function() { 9687 document.body.removeChild(i) 9688 } 9689 ), 333) 9690 } 9691 if (o = c instanceof f ? c : new f([c],{ 9692 type: l 9693 }), 9694 navigator.msSaveBlob) 9695 return navigator.msSaveBlob(o, p); 9696 if (s.URL) 9697 b(s.URL.createObjectURL(o), !0); 9698 else { 9699 if ("string" == typeof o || o.constructor === d) 9700 try { 9701 return b("data:" + l + ";base64," + s.btoa(o)) 9702 } catch (C) { 9703 return b("data:" + l + "," + encodeURIComponent(o)) 9704 } 9705 (r = new FileReader).onload = function(e) { 9706 b(this.result) 9707 } 9708 , 9709 r.readAsDataURL(o) 9710 } 9711 return !0 9712 } 9713 ; 9714 var on = nn.exports; 9715 function rn() { 9716 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">\n <g id="Group-2">\n <g id="volme_big-copy" transform="translate(488.000000, 340.000000)">\n <rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>\n <rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>\n <rect id="Rectangle-2" transform="translate(4.000000, 17.500000) rotate(90.000000) translate(-4.000000, -17.500000) " x="1.5" y="16.5" width="5" height="2" rx="1"></rect><rect id="Rectangle-2-Copy-3" transform="translate(20.000000, 17.500000) rotate(90.000000) translate(-20.000000, -17.500000) " x="17.5" y="16.5" width="5" height="2" rx="1"></rect>\n <path d="M9.48791171,8.26502656 L9.48791171,14.2650266 C9.48791171,14.8173113 9.04019646,15.2650266 8.48791171,15.2650266 C7.93562696,15.2650266 7.48791171,14.8173113 7.48791171,14.2650266 L7.48791171,7.26502656 C7.48791171,6.71274181 7.93562696,6.26502656 8.48791171,6.26502656 L15.4879117,6.26502656 C16.0401965,6.26502656 16.4879117,6.71274181 16.4879117,7.26502656 C16.4879117,7.81731131 16.0401965,8.26502656 15.4879117,8.26502656 L9.48791171,8.26502656 Z" id="Combined-Shape" transform="translate(11.987912, 10.765027) scale(1, -1) rotate(45.000000) translate(-11.987912, -10.765027) "></path>\n </g>\n </g>\n </g>\n </g>\n</svg>\n', "image/svg+xml").firstChild 9717 } 9718 var sn = function(e) { 9719 a(i, e); 9720 var t = d(i); 9721 function i(e) { 9722 var o; 9723 return n(this, i), 9724 s(u(o = t.call(this, e)), "download", (function(e) { 9725 if (!o.isLock) { 9726 o.emitUserAction(e, "download"); 9727 var t = o.getAbsoluteURL(o.player.src); 9728 on(t), 9729 o.isLock = !0, 9730 o.timer = window.setTimeout((function() { 9731 o.isLock = !1, 9732 window.clearTimeout(o.timer), 9733 o.timer = null 9734 } 9735 ), 300) 9736 } 9737 } 9738 )), 9739 o.timer = null, 9740 o.isLock = !1, 9741 o 9742 } 9743 return r(i, [{ 9744 key: "afterCreate", 9745 value: function() { 9746 p(l(i.prototype), "afterCreate", this).call(this), 9747 this.config.disable || (this.appendChild(".xgplayer-icon", this.icons.download), 9748 this.bind(["click", "touchend"], this.download)) 9749 } 9750 }, { 9751 key: "registerIcons", 9752 value: function() { 9753 return { 9754 download: rn 9755 } 9756 } 9757 }, { 9758 key: "getAbsoluteURL", 9759 value: function(e) { 9760 if (!e.match(/^https?:\/\//)) { 9761 var t = document.createElement("div"); 9762 t.innerHTML = '<a href="'.concat(e, '">x</a>'), 9763 e = t.firstChild.href 9764 } 9765 return e 9766 } 9767 }, {
vendor: 68,908 bytes, lines 9768-11571
9768 key: "destroy", 9769 value: function() { 9770 p(l(i.prototype), "destroy", this).call(this), 9771 this.unbind(["click", "touchend"], this.download), 9772 window.clearTimeout(this.timer), 9773 this.timer = null 9774 } 9775 }, { 9776 key: "render", 9777 value: function() { 9778 if (!this.config.disable) 9779 return '<xg-icon class="xgplayer-download">\n <div class="xgplayer-icon">\n </div>\n '.concat(qt(this, "DOWNLOAD_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>") 9780 } 9781 }], [{ 9782 key: "pluginName", 9783 get: function() { 9784 return "download" 9785 } 9786 }, { 9787 key: "defaultConfig", 9788 get: function() { 9789 return { 9790 position: et.CONTROLS_RIGHT, 9791 index: 3, 9792 disable: !0 9793 } 9794 } 9795 }]), 9796 i 9797 }(Di) 9798 , an = function(e) { 9799 a(i, e); 9800 var t = d(i); 9801 function i() { 9802 return n(this, i), 9803 t.apply(this, arguments) 9804 } 9805 return r(i, [{ 9806 key: "beforeCreate", 9807 value: function(e) { 9808 "boolean" == typeof e.player.config.screenShot && (e.config.disable = !e.player.config.screenShot) 9809 } 9810 }, { 9811 key: "afterCreate", 9812 value: function() { 9813 p(l(i.prototype), "afterCreate", this).call(this), 9814 this.appendChild(".xgplayer-icon", this.icons.screenshotIcon); 9815 var e = this.config; 9816 this.initSize = function(t) { 9817 e.fitVideo && (e.width = t.vWidth, 9818 e.height = t.vHeight) 9819 } 9820 , 9821 this.once(ve, this.initSize) 9822 } 9823 }, { 9824 key: "onPluginsReady", 9825 value: function() { 9826 this.show(), 9827 this.onClickBtn = this.onClickBtn.bind(this), 9828 this.bind(["click", "touchend"], this.onClickBtn) 9829 } 9830 }, { 9831 key: "saveScreenShot", 9832 value: function(e, t) { 9833 var i = document.createElement("a"); 9834 i.href = e, 9835 i.download = t; 9836 var n = document.createEvent("MouseEvents"); 9837 n.initMouseEvent("click", !0, !1, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), 9838 i.dispatchEvent(n) 9839 } 9840 }, { 9841 key: "createCanvas", 9842 value: function(e, t) { 9843 var i = document.createElement("canvas") 9844 , n = i.getContext("2d"); 9845 this.canvasCtx = n, 9846 this.canvas = i, 9847 i.width = e || this.config.width, 9848 i.height = t || this.config.height, 9849 n.imageSmoothingEnabled = !0, 9850 n.imageSmoothingEnabled && (n.imageSmoothingQuality = "high") 9851 } 9852 }, { 9853 key: "onClickBtn", 9854 value: function(e) { 9855 var t = this; 9856 e.preventDefault(), 9857 e.stopPropagation(), 9858 this.emitUserAction(e, "shot"), 9859 this.shot().then((function(e) { 9860 t.emit(ke, e), 9861 t.saveScreenShot(e, t.config.name + t.config.format) 9862 } 9863 )) 9864 } 9865 }, { 9866 key: "shot", 9867 value: function(e, t) { 9868 var i = this 9869 , n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { 9870 quality: .92, 9871 type: "image/png" 9872 } 9873 , o = this.config 9874 , r = this.player 9875 , s = n.quality || o.quality 9876 , a = n.type || o.type; 9877 return new Promise((function(n, l) { 9878 var c, u = null; 9879 if (r.media.canvas) 9880 u = r.media.canvas; 9881 else { 9882 i.canvas ? (i.canvas.width = e || o.width, 9883 i.canvas.height = t || o.height) : i.createCanvas(e, t), 9884 u = i.canvas, 9885 c = i.canvasCtx; 9886 var h, d, f, p, g = r.media.videoWidth / r.media.videoHeight, v = u.width / u.height, y = r.media.videoWidth, m = r.media.videoHeight; 9887 g > v ? (f = u.width, 9888 p = u.width / g, 9889 h = 0, 9890 d = Math.round((u.height - p) / 2)) : g === v ? (f = u.width, 9891 p = u.height, 9892 h = 0, 9893 d = 0) : g < v && (f = u.height * g, 9894 p = u.height, 9895 h = Math.round((u.width - f) / 2), 9896 d = 0), 9897 c.drawImage(r.media, 0, 0, y, m, h, d, f, p) 9898 } 9899 var k = u.toDataURL(a, s).replace(a, "image/octet-stream"); 9900 n(k = k.replace(/^data:image\/[^;]+/, "data:application/octet-stream")) 9901 } 9902 )) 9903 } 9904 }, { 9905 key: "registerIcons", 9906 value: function() { 9907 return { 9908 screenshotIcon: null 9909 } 9910 } 9911 }, { 9912 key: "destroy", 9913 value: function() { 9914 p(l(i.prototype), "destroy", this).call(this), 9915 this.unbind(["click", "touchend"], this.onClickBtn), 9916 this.off(ve, this.initSize) 9917 } 9918 }, { 9919 key: "render", 9920 value: function() { 9921 if (!this.config.disable) { 9922 var e = this.icons.screenshotIcon ? "xgplayer-icon" : "xgplayer-icon btn-text" 9923 , t = "SCREENSHOT"; 9924 return '\n <xg-icon class="xgplayer-shot">\n <div class="'.concat(e, '">\n ').concat(this.icons.screenshotIcon ? "" : '<span lang-key="'.concat(this.i18nKeys[t], '">').concat(this.i18n[t], "</span>"), "\n </div>\n </xg-icon>") 9925 } 9926 } 9927 }], [{ 9928 key: "pluginName", 9929 get: function() { 9930 return "screenShot" 9931 } 9932 }, { 9933 key: "defaultConfig", 9934 get: function() { 9935 return { 9936 position: et.CONTROLS_RIGHT, 9937 index: 5, 9938 quality: .92, 9939 type: "image/png", 9940 format: ".png", 9941 width: 600, 9942 height: 337, 9943 fitVideo: !0, 9944 disable: !1, 9945 name: "screenshot" 9946 } 9947 } 9948 }]), 9949 i 9950 }(Di) 9951 , ln = function() { 9952 function e(t) { 9953 n(this, e), 9954 this.config = t.config, 9955 this.parent = t.root, 9956 this.root = x.createDom("ul", "", {}, "xg-options-list ".concat(this.config.className)), 9957 t.root.appendChild(this.root), 9958 this.onItemClick = this.onItemClick.bind(this), 9959 this.renderItemList(); 9960 var i = "mobile" === O.device ? "touchend" : "click"; 9961 this._delegates = ot.delegate.call(this, this.root, "li", i, this.onItemClick) 9962 } 9963 return r(e, [{ 9964 key: "renderItemList", 9965 value: function(e) { 9966 var t = this 9967 , i = this.config 9968 , n = this.root; 9969 e ? i.data = e : e = i.data, 9970 i.style && Object.keys(i.style).map((function(e) { 9971 n.style[e] = i[e] 9972 } 9973 )), 9974 e.length > 0 && (this.attrKeys = Object.keys(e[0])), 9975 this.root.innerHTML = "", 9976 e.map((function(e, i) { 9977 var n = e.selected ? "option-item selected" : "option-item"; 9978 e["data-index"] = i, 9979 t.root.appendChild(x.createDom("li", "<span>".concat(e.showText, "</span>"), e, n)) 9980 } 9981 )) 9982 } 9983 }, { 9984 key: "onItemClick", 9985 value: function(e) { 9986 e.delegateTarget || (e.delegateTarget = e.target); 9987 var t = e.delegateTarget; 9988 if (t && x.hasClass(t, "selected")) 9989 return !1; 9990 var i = "function" == typeof this.config.onItemClick ? this.config.onItemClick : null 9991 , n = this.root.querySelector(".selected"); 9992 x.addClass(t, "selected"), 9993 n && x.removeClass(n, "selected"), 9994 i(e, { 9995 from: n ? this.getAttrObj(n, this.attrKeys) : null, 9996 to: this.getAttrObj(t, this.attrKeys) 9997 }) 9998 } 9999 }, { 10000 key: "getAttrObj", 10001 value: function(e, t) { 10002 if (!e || !t) 10003 return {}; 10004 var i = {}; 10005 t.map((function(t) { 10006 i[t] = e.getAttribute(t) 10007 } 10008 )); 10009 var n = e.getAttribute("data-index"); 10010 return n && (i.index = Number(n)), 10011 i 10012 } 10013 }, { 10014 key: "show", 10015 value: function() { 10016 x.removeClass(this.root, "hide"), 10017 x.addClass(this.root, "active") 10018 } 10019 }, { 10020 key: "hide", 10021 value: function() { 10022 x.removeClass(this.root, "active"), 10023 x.addClass(this.root, "hide") 10024 } 10025 }, { 10026 key: "setStyle", 10027 value: function(e) { 10028 var t = this; 10029 Object.keys(e).forEach((function(i) { 10030 t.root.style[i] = e[i] 10031 } 10032 )) 10033 } 10034 }, { 10035 key: "destroy", 10036 value: function() { 10037 this._delegates && (this._delegates.map((function(e) { 10038 e.destroy && e.destroy() 10039 } 10040 )), 10041 this._delegates = null), 10042 this.root.innerHTML = null, 10043 this.parent.removeChild(this.root), 10044 this.root = null 10045 } 10046 }]), 10047 e 10048 }() 10049 , cn = "side" 10050 , un = "middle" 10051 , hn = "click" 10052 , dn = "hover"; 10053 var fn = "mobile" === O.device 10054 , pn = function(e) { 10055 a(o, e); 10056 var t = d(o); 10057 function o(e) { 10058 var i; 10059 return n(this, o), 10060 s(u(i = t.call(this, e)), "onEnter", (function(e) { 10061 e.preventDefault(), 10062 e.stopPropagation(), 10063 i.emit("icon_mouseenter", { 10064 pluginName: i.pluginName 10065 }), 10066 i.switchActiveState(e) 10067 } 10068 )), 10069 s(u(i), "switchActiveState", (function(e) { 10070 e.preventDefault(), 10071 e.stopPropagation(), 10072 i.config.toggleMode === hn ? i.toggle(!i.isActive) : i.toggle(!0) 10073 } 10074 )), 10075 s(u(i), "onLeave", (function(e) { 10076 e.preventDefault(), 10077 e.stopPropagation(), 10078 i.emit("icon_mouseleave", { 10079 pluginName: i.pluginName 10080 }), 10081 i.config.listType !== cn && i.isActive && i.toggle(!1) 10082 } 10083 )), 10084 s(u(i), "onListEnter", (function(e) { 10085 i.enterType = 2 10086 } 10087 )), 10088 s(u(i), "onListLeave", (function(e) { 10089 i.enterType = 0, 10090 i.isActive && i.toggle(!1) 10091 } 10092 )), 10093 i.isIcons = !1, 10094 i.isActive = !1, 10095 i.curValue = null, 10096 i.curIndex = 0, 10097 i 10098 } 10099 return r(o, [{ 10100 key: "updateLang", 10101 value: function(e) { 10102 this.renderItemList(this.config.list, this.curIndex) 10103 } 10104 }, { 10105 key: "afterCreate", 10106 value: function() { 10107 var e = this 10108 , t = this.config; 10109 this.initIcons(), 10110 fn && t.listType !== un && (t.listType = cn), 10111 t.hidePortrait && x.addClass(this.root, "portrait"), 10112 this.once(z, (function() { 10113 t.list && t.list.length > 0 && (e.renderItemList(t.list), 10114 e.show()) 10115 } 10116 )), 10117 fn && this.on(ee, (function() { 10118 e.isActive && (e.optionsList && e.optionsList.hide(), 10119 e.isActive = !1) 10120 } 10121 )), 10122 fn ? (t.toggleMode = hn, 10123 this.activeEvent = "touchend") : this.activeEvent = t.toggleMode === hn ? "click" : "mouseenter", 10124 t.toggleMode === hn ? this.bind(this.activeEvent, this.switchActiveState) : (this.bind(this.activeEvent, this.onEnter), 10125 this.bind("mouseleave", this.onLeave)), 10126 this.isIcons && this.bind("click", this.onIconClick) 10127 } 10128 }, { 10129 key: "initIcons", 10130 value: function() { 10131 var e = this 10132 , t = this.icons 10133 , i = Object.keys(t) 10134 , n = !1; 10135 i.length > 0 && (i.forEach((function(i) { 10136 e.appendChild(".xgplayer-icon", t[i]), 10137 !n && (n = t[i]) 10138 } 10139 )), 10140 this.isIcons = n), 10141 n || (this.appendChild(".xgplayer-icon", x.createDom("span", "", {}, "icon-text")), 10142 x.addClass(this.find(".xgplayer-icon"), "btn-text")) 10143 } 10144 }, { 10145 key: "show", 10146 value: function() { 10147 !this.config.list || this.config.list.length < 2 || x.addClass(this.root, "show") 10148 } 10149 }, { 10150 key: "hide", 10151 value: function() { 10152 x.removeClass(this.root, "show") 10153 } 10154 }, { 10155 key: "getTextByLang", 10156 value: function(e, t, n) { 10157 if (void 0 === e) 10158 return ""; 10159 var o = this.config.list; 10160 !n && (n = this.player.lang), 10161 t = !t || x.isUndefined(e[t]) ? "text" : t, 10162 "number" == typeof e && (e = o[e]); 10163 try { 10164 return "object" === i(e[t]) ? e[t][n] || e[t].en : e[t] 10165 } catch (r) { 10166 return console.warn(r), 10167 "" 10168 } 10169 } 10170 }, { 10171 key: "toggle", 10172 value: function(e) { 10173 if (e !== this.isActive) { 10174 var t = this.player.controls 10175 , i = this.config.listType; 10176 e ? (i === cn ? t.blur() : t.focus(), 10177 this.optionsList && this.optionsList.show()) : (i === cn ? t.focus() : t.focusAwhile(), 10178 this.optionsList && this.optionsList.hide()), 10179 this.isActive = e 10180 } 10181 } 10182 }, { 10183 key: "onItemClick", 10184 value: function(e, t) { 10185 e.preventDefault(), 10186 e.stopPropagation(); 10187 var i = this.config 10188 , n = i.listType 10189 , o = i.list; 10190 this.curIndex = t.to.index, 10191 this.curItem = o[this.curIndex], 10192 this.changeCurrentText(), 10193 (this.config.isItemClickHide || fn || n === cn) && this.toggle(!1) 10194 } 10195 }, { 10196 key: "onIconClick", 10197 value: function(e) {} 10198 }, { 10199 key: "changeCurrentText", 10200 value: function() { 10201 if (!this.isIcons) { 10202 var e = this.config.list 10203 , t = e[this.curIndex < e.length ? this.curIndex : 0]; 10204 t && (this.find(".icon-text").innerHTML = this.getTextByLang(t, "iconText")) 10205 } 10206 } 10207 }, { 10208 key: "renderItemList", 10209 value: function(e, t) { 10210 var i = this 10211 , n = this.config 10212 , o = this.optionsList 10213 , r = this.player; 10214 if ("number" == typeof t && (this.curIndex = t, 10215 this.curItem = n.list[t]), 10216 o) 10217 return o.renderItemList(e), 10218 void this.changeCurrentText(); 10219 var s, a, l = { 10220 config: { 10221 data: e || [], 10222 className: (s = n.listType, 10223 a = n.position, 10224 s === cn ? a === et.CONTROLS_LEFT ? "xg-side-list xg-left-side" : "xg-side-list xg-right-side" : ""), 10225 onItemClick: function(e, t) { 10226 i.onItemClick(e, t) 10227 } 10228 }, 10229 root: n.listType === cn ? r.innerContainer || r.root : this.root 10230 }; 10231 this.config.isShowIcon && (this.optionsList = new ln(l), 10232 this.changeCurrentText(), 10233 this.show()); 10234 var c = this.player.root.getBoundingClientRect().height 10235 , u = n.listType === un ? c - 50 : c; 10236 this.optionsList && this.optionsList.setStyle({ 10237 maxHeight: "".concat(u, "px") 10238 }) 10239 } 10240 }, { 10241 key: "destroy", 10242 value: function() { 10243 this.config.toggleMode === hn ? this.unbind(this.activeEvent, this.switchActiveState) : (this.unbind(this.activeEvent, this.onEnter), 10244 this.unbind("mouseleave", this.onLeave)), 10245 this.isIcons && this.unbind("click", this.onIconClick), 10246 this.optionsList && (this.optionsList.destroy(), 10247 this.optionsList = null) 10248 } 10249 }, { 10250 key: "render", 10251 value: function() { 10252 if (this.config.isShowIcon) 10253 return '<xg-icon class="xg-options-icon '.concat(this.config.className || "", '">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>') 10254 } 10255 }], [{ 10256 key: "pluginName", 10257 get: function() { 10258 return "optionsIcon" 10259 } 10260 }, { 10261 key: "defaultConfig", 10262 get: function() { 10263 return { 10264 position: et.CONTROLS_RIGHT, 10265 index: 100, 10266 list: [], 10267 listType: "middle", 10268 listStyle: {}, 10269 hidePortrait: !0, 10270 isShowIcon: !1, 10271 isItemClickHide: !0, 10272 toggleMode: dn 10273 } 10274 } 10275 }]), 10276 o 10277 }(ot) 10278 , gn = function(e) { 10279 a(o, e); 10280 var i = d(o); 10281 function o(e) { 10282 var t; 10283 return n(this, o), 10284 (t = i.call(this, e)).curTime = 0, 10285 t.isPaused = !0, 10286 t 10287 } 10288 return r(o, [{ 10289 key: "beforeCreate", 10290 value: function(e) { 10291 var t = e.config.list; 10292 Array.isArray(t) && t.length > 0 && (e.config.list = t.map((function(e) { 10293 return !e.text && e.name && (e.text = e.name), 10294 e.text || (e.text = e.definition), 10295 e 10296 } 10297 ))) 10298 } 10299 }, { 10300 key: "afterCreate", 10301 value: function() { 10302 var e = this; 10303 p(l(o.prototype), "afterCreate", this).call(this), 10304 this.on("resourceReady", (function(t) { 10305 e.changeDefinitionList(t) 10306 } 10307 )), 10308 this.on(pe, (function(t) { 10309 e.renderItemList(e.config.list, t.to) 10310 } 10311 )), 10312 this.player.definitionList.length < 2 && this.hide() 10313 } 10314 }, { 10315 key: "show", 10316 value: function() { 10317 !this.config.list || this.config.list.length < 2 || x.addClass(this.root, "show") 10318 } 10319 }, { 10320 key: "initDefinition", 10321 value: function() { 10322 var e = this.config 10323 , t = e.list 10324 , i = e.defaultDefinition; 10325 if (t.length > 0) { 10326 var n = null; 10327 t.map((function(e) { 10328 e.definition === i && (n = e) 10329 } 10330 )), 10331 n || (n = t[0]), 10332 this.changeDefinition(n) 10333 } 10334 } 10335 }, { 10336 key: "renderItemList", 10337 value: function() { 10338 var e = this 10339 , i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.config.list || [] 10340 , n = arguments.length > 1 ? arguments[1] : void 0 10341 , r = n && n.definition ? n.definition : this.config.defaultDefinition; 10342 n && i.forEach((function(e) { 10343 e.selected = !1 10344 } 10345 )); 10346 var s = 0 10347 , a = i.map((function(i, n) { 10348 var o = t(t({}, i), {}, { 10349 showText: e.getTextByLang(i) || i.definition, 10350 selected: !1 10351 }); 10352 return (i.selected || i.definition && i.definition == r) && (o.selected = !0, 10353 s = n), 10354 o 10355 } 10356 )); 10357 p(l(o.prototype), "renderItemList", this).call(this, a, s) 10358 } 10359 }, { 10360 key: "changeDefinitionList", 10361 value: function(e) { 10362 Array.isArray(e) && (this.config.list = e.map((function(e) { 10363 return !e.text && e.name && (e.text = e.name), 10364 e.text || (e.text = e.definition), 10365 e 10366 } 10367 )), 10368 this.renderItemList(), 10369 this.config.list.length < 2 ? this.hide() : this.show()) 10370 } 10371 }, { 10372 key: "changeDefinition", 10373 value: function(e, t) { 10374 this.player.changeDefinition(e, t) 10375 } 10376 }, { 10377 key: "onItemClick", 10378 value: function(e, t) { 10379 var i = this.player.definitionList; 10380 p(l(o.prototype), "onItemClick", this).apply(this, arguments), 10381 this.emitUserAction(e, "change_definition", { 10382 from: t.from, 10383 to: t.to 10384 }); 10385 for (var n = 0; n < i.length; n++) 10386 t.to && i[n].definition === t.to.definition && (t.to.url = i[n].url), 10387 t.from && i[n].definition === t.from.definition && (t.from.url = i[n].url); 10388 this.player.changeDefinition(t.to, t.from) 10389 } 10390 }], [{ 10391 key: "pluginName", 10392 get: function() { 10393 return "definition" 10394 } 10395 }, { 10396 key: "defaultConfig", 10397 get: function() { 10398 return t(t({}, pn.defaultConfig), {}, { 10399 position: et.CONTROLS_RIGHT, 10400 index: 3, 10401 list: [], 10402 defaultDefinition: "", 10403 disable: !1, 10404 hidePortrait: !1, 10405 className: "xgplayer-definition", 10406 isShowIcon: !0 10407 }) 10408 } 10409 }]), 10410 o 10411 }(pn) 10412 , vn = function(e) { 10413 a(o, e); 10414 var i = d(o); 10415 function o(e) { 10416 var t; 10417 return n(this, o), 10418 (t = i.call(this, e)).curRate = 1, 10419 t 10420 } 10421 return r(o, [{ 10422 key: "beforeCreate", 10423 value: function(e) { 10424 var t = e.player.config.playbackRate 10425 , i = t ? Array.isArray(t) ? t : e.config.list : []; 10426 Array.isArray(i) && (e.config.list = i.map((function(e) { 10427 return "number" == typeof e ? e = { 10428 rate: e, 10429 text: "".concat(e, "x") 10430 } : !e.text && e.rate && (e.text = "".concat(e.rate, "x")), 10431 e 10432 } 10433 ))) 10434 } 10435 }, { 10436 key: "afterCreate", 10437 value: function() { 10438 var e = this; 10439 p(l(o.prototype), "afterCreate", this).call(this), 10440 this.on(Z, (function() { 10441 e.curValue !== e.player.playbackRate && e.renderItemList() 10442 } 10443 )), 10444 this.renderItemList() 10445 } 10446 }, { 10447 key: "show", 10448 value: function() { 10449 this.config.list && 0 !== this.config.list.length && p(l(o.prototype), "show", this).call(this) 10450 } 10451 }, { 10452 key: "onItemClick", 10453 value: function(e, t) { 10454 p(l(o.prototype), "onItemClick", this).apply(this, arguments); 10455 var i = e.delegateTarget 10456 , n = Number(i.getAttribute("rate")); 10457 if (!n || n === this.curValue) 10458 return !1; 10459 var r = { 10460 playbackRate: { 10461 from: this.player.playbackRate, 10462 to: n 10463 } 10464 }; 10465 this.emitUserAction(e, "change_rate", { 10466 props: r 10467 }), 10468 this.curValue = n, 10469 this.player.playbackRate = n 10470 } 10471 }, { 10472 key: "renderItemList", 10473 value: function() { 10474 var e = this 10475 , t = this.player.playbackRate || 1; 10476 this.curValue = t; 10477 var i = -1 10478 , n = this.config.list.map((function(n, o) { 10479 var r = { 10480 rate: n.rate 10481 }; 10482 return r.rate === t && (r.selected = !0, 10483 i = o), 10484 r.showText = e.getTextByLang(n), 10485 r 10486 } 10487 )); 10488 p(l(o.prototype), "renderItemList", this).call(this, n, i) 10489 } 10490 }, { 10491 key: "changeCurrentText", 10492 value: function() { 10493 if (!this.isIcons) { 10494 var e = this.config.list 10495 , t = e[this.curIndex < e.length ? this.curIndex : 0] 10496 , i = ""; 10497 i = !t || this.curIndex < 0 ? "".concat(this.player.playbackRate, "x") : this.getTextByLang(t, "iconText"), 10498 this.find(".icon-text").innerHTML = i 10499 } 10500 } 10501 }, { 10502 key: "destroy", 10503 value: function() { 10504 p(l(o.prototype), "destroy", this).call(this) 10505 } 10506 }], [{ 10507 key: "pluginName", 10508 get: function() { 10509 return "playbackRate" 10510 } 10511 }, { 10512 key: "defaultConfig", 10513 get: function() { 10514 return t(t({}, pn.defaultConfig), {}, { 10515 position: et.CONTROLS_RIGHT, 10516 index: 4, 10517 list: [2, 1.5, 1, .75, .5], 10518 className: "xgplayer-playbackrate", 10519 isShowIcon: !0, 10520 hidePortrait: !1 10521 }) 10522 } 10523 }]), 10524 o 10525 }(pn); 10526 function yn() { 10527 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" class=\'path_full\' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n', "image/svg+xml").firstChild 10528 } 10529 function mn() { 10530 return (new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n', "image/svg+xml").firstChild 10531 } 10532 var kn = function(e) { 10533 a(i, e); 10534 var t = d(i); 10535 function i() { 10536 return n(this, i), 10537 t.apply(this, arguments) 10538 } 10539 return r(i, [{ 10540 key: "beforeCreate", 10541 value: function(e) { 10542 "boolean" == typeof e.player.config.cssFullscreen && (e.config.disable = !e.player.config.cssFullscreen) 10543 } 10544 }, { 10545 key: "afterCreate", 10546 value: function() { 10547 var e = this; 10548 p(l(i.prototype), "afterCreate", this).call(this), 10549 this.config.disable || (this.config.target && (this.playerConfig.fullscreenTarget = this.config.target), 10550 this.initIcons(), 10551 this.on(de, (function(t) { 10552 e.animate(t) 10553 } 10554 )), 10555 this.btnClick = this.btnClick.bind(this), 10556 this.handleCssFullscreen = this.hook("cssFullscreen_change", this.btnClick, { 10557 pre: function(e) { 10558 e.preventDefault(), 10559 e.stopPropagation() 10560 } 10561 }), 10562 this.bind(["click", "touchend"], this.handleCssFullscreen)) 10563 } 10564 }, { 10565 key: "initIcons", 10566 value: function() { 10567 var e = this.icons 10568 , t = this.find(".xgplayer-icon"); 10569 t.appendChild(e.cssFullscreen), 10570 t.appendChild(e.exitCssFullscreen) 10571 } 10572 }, { 10573 key: "btnClick", 10574 value: function(e) { 10575 e.preventDefault(), 10576 e.stopPropagation(); 10577 var t = this.player.isCssfullScreen; 10578 this.emitUserAction(e, "switch_cssfullscreen", { 10579 cssfullscreen: t 10580 }), 10581 t ? this.player.exitCssFullscreen() : this.player.getCssFullscreen() 10582 } 10583 }, { 10584 key: "animate", 10585 value: function(e) { 10586 this.root && (e ? this.setAttr("data-state", "full") : this.setAttr("data-state", "normal"), 10587 this.switchTips(e)) 10588 } 10589 }, { 10590 key: "switchTips", 10591 value: function(e) { 10592 var t = this.i18nKeys 10593 , i = this.find(".xg-tips"); 10594 i && this.changeLangTextKey(i, e ? t.EXITCSSFULLSCREEN_TIPS : t.CSSFULLSCREEN_TIPS) 10595 } 10596 }, { 10597 key: "registerIcons", 10598 value: function() { 10599 return { 10600 cssFullscreen: { 10601 icon: yn, 10602 class: "xg-get-cssfull" 10603 }, 10604 exitCssFullscreen: { 10605 icon: mn, 10606 class: "xg-exit-cssfull" 10607 } 10608 } 10609 } 10610 }, { 10611 key: "destroy", 10612 value: function() { 10613 p(l(i.prototype), "destroy", this).call(this), 10614 this.unbind(["click", "touchend"], this.btnClick) 10615 } 10616 }, { 10617 key: "render", 10618 value: function() { 10619 if (!this.config.disable) 10620 return "<xg-icon class='xgplayer-cssfullscreen'>\n <div class=\"xgplayer-icon\">\n </div>\n ".concat(qt(this, "CSSFULLSCREEN_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>") 10621 } 10622 }], [{ 10623 key: "pluginName", 10624 get: function() { 10625 return "cssFullscreen" 10626 } 10627 }, { 10628 key: "defaultConfig", 10629 get: function() { 10630 return { 10631 position: et.CONTROLS_RIGHT, 10632 index: 1, 10633 disable: !1, 10634 target: null 10635 } 10636 } 10637 }]), 10638 i 10639 }(Di) 10640 , bn = function(e) { 10641 a(i, e); 10642 var t = d(i); 10643 function i() { 10644 return n(this, i), 10645 t.apply(this, arguments) 10646 } 10647 return r(i, [{ 10648 key: "afterCreate", 10649 value: function() { 10650 var e = this; 10651 this.clickHandler = this.hook("errorRetry", this.errorRetry, { 10652 pre: function(e) { 10653 e.preventDefault(), 10654 e.stopPropagation() 10655 } 10656 }), 10657 this.onError = this.hook("showError", this.handleError), 10658 this.bind(".xgplayer-error-refresh", "click", this.clickHandler), 10659 this.on(U, (function(t) { 10660 e.onError(t) 10661 } 10662 )) 10663 } 10664 }, { 10665 key: "errorRetry", 10666 value: function(e) { 10667 this.emitUserAction(e, "error_retry", {}), 10668 this.player.retry() 10669 } 10670 }, { 10671 key: "handleError", 10672 value: function() { 10673 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {} 10674 , t = this.player 10675 , i = e.errorType 10676 , n = t.errorNote ? this.i18n[t.errorNote] : ""; 10677 if (!n) 10678 switch (i) { 10679 case "decoder": 10680 n = this.i18n.MEDIA_ERR_DECODE; 10681 break; 10682 case "network": 10683 n = this.i18n.MEDIA_ERR_NETWORK; 10684 break; 10685 default: 10686 n = this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED 10687 } 10688 this.find(".xgplayer-error-text").innerHTML = n, 10689 this.find(".xgplayer-error-tips").innerHTML = "".concat(this.i18n.REFRESH_TIPS, '<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH, "</span>") 10690 } 10691 }, { 10692 key: "destroy", 10693 value: function() { 10694 this.unbind(".xgplayer-error-refresh", "click", this.clickHandler) 10695 } 10696 }, { 10697 key: "render", 10698 value: function() { 10699 return '<xg-error class="xgplayer-error">\n <div class="xgplayer-errornote">\n <span class="xgplayer-error-text"></span>\n <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n </div>\n </xg-error>' 10700 } 10701 }], [{ 10702 key: "pluginName", 10703 get: function() { 10704 return "error" 10705 } 10706 }]), 10707 i 10708 }(ot) 10709 , Cn = function(e) { 10710 a(i, e); 10711 var t = d(i); 10712 function i() { 10713 return n(this, i), 10714 t.apply(this, arguments) 10715 } 10716 return r(i, [{ 10717 key: "afterCreate", 10718 value: function() { 10719 var e = this; 10720 this.intervalId = 0, 10721 this.customConfig = null, 10722 this.bind(".highlight", ["click", "touchend"], (function(t) { 10723 (e.config.onClick || e.customOnClick) && (t.preventDefault(), 10724 t.stopPropagation(), 10725 e.customOnClick ? e.customOnClick(t) : e.config.onClick(t)) 10726 } 10727 )), 10728 this.player.showPrompt = function() { 10729 e.show.apply(e, arguments) 10730 } 10731 , 10732 this.player.hidePrompt = function() { 10733 e.hide() 10734 } 10735 } 10736 }, { 10737 key: "setStyle", 10738 value: function(e) { 10739 var t = this; 10740 Object.keys(e).map((function(i) { 10741 t.root.style[i] = e[i] 10742 } 10743 )) 10744 } 10745 }, { 10746 key: "show", 10747 value: function(e) { 10748 var t = this 10749 , i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {} 10750 , n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : function() {} 10751 ; 10752 if (e) { 10753 this.customOnClick = n; 10754 var o = this.config.interval; 10755 this.intervalId && (clearTimeout(this.intervalId), 10756 this.intervalId = null), 10757 x.addClass(this.root, "show"), 10758 "arrow" === i.mode && x.addClass(this.root, "arrow"), 10759 this.find(".xgplayer-prompt-detail").innerHTML = "string" == typeof e ? e : "".concat(e.text || "") + "".concat(e.highlight ? '<i class="highlight">'.concat(e.highlight, "</i>") : ""), 10760 i.style && this.setStyle(i.style); 10761 var r = "boolean" == typeof i.autoHide ? i.autoHide : this.config.autoHide; 10762 if (r) { 10763 var s = i.interval || o; 10764 this.intervalId = setTimeout((function() { 10765 t.hide() 10766 } 10767 ), s) 10768 } 10769 } 10770 } 10771 }, { 10772 key: "hide", 10773 value: function() { 10774 x.removeClass(this.root, "show"), 10775 x.removeClass(this.root, "arrow"), 10776 this.root.removeAttribute("style"), 10777 this.customOnClick = null 10778 } 10779 }, { 10780 key: "render", 10781 value: function() { 10782 return '<xg-prompt class="xgplayer-prompt '.concat(lt.CONTROLS_FOLLOW, '">\n <span class="xgplayer-prompt-detail"></span>\n </xg-prompt>') 10783 } 10784 }], [{ 10785 key: "pluginName", 10786 get: function() { 10787 return "prompt" 10788 } 10789 }, { 10790 key: "defaultConfig", 10791 get: function() { 10792 return { 10793 interval: 3e3, 10794 style: {}, 10795 mode: "arrow", 10796 autoHide: !0, 10797 detail: { 10798 text: "", 10799 highlight: "" 10800 }, 10801 onClick: function() {} 10802 } 10803 } 10804 }]), 10805 i 10806 }(ot) 10807 , _n = { 10808 time: 0, 10809 text: "", 10810 id: 1, 10811 duration: 1, 10812 color: "#fff", 10813 style: {}, 10814 width: 6, 10815 height: 6 10816 }; 10817 function wn(e) { 10818 Object.keys(_n).map((function(t) { 10819 void 0 === e[t] && (e[t] = _n[t]) 10820 } 10821 )) 10822 } 10823 var Tn = { 10824 _updateDotDom: function(e, t) { 10825 if (t) { 10826 var i = this.calcuPosition(e.time, e.duration) 10827 , n = e.style || {}; 10828 n.left = "".concat(i.left, "%"), 10829 n.width = "".concat(i.width, "%"), 10830 t.setAttribute("data-text", e.text), 10831 t.setAttribute("data-time", e.time), 10832 i.isMini ? x.addClass(t, "mini") : x.removeClass(t, "mini"), 10833 Object.keys(n).map((function(e) { 10834 t.style[e] = n[e] 10835 } 10836 )) 10837 } 10838 }, 10839 initDots: function() { 10840 var e = this; 10841 this._ispots.map((function(t) { 10842 e.createDot(t, !1) 10843 } 10844 )), 10845 this.ispotsInit = !0 10846 }, 10847 createDot: function(e) { 10848 var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1] 10849 , i = this.player.plugins.progress; 10850 if (i && (t && (wn(e), 10851 this._ispots.push(e)), 10852 this.ispotsInit || !t)) { 10853 var n = this.calcuPosition(e.time, e.duration) 10854 , o = e.style || {}; 10855 o.left = "".concat(n.left, "%"), 10856 o.width = "".concat(n.width, "%"); 10857 var r = "xgspot_".concat(e.id, " xgplayer-spot"); 10858 n.isMini && (r += " mini"); 10859 var s = x.createDom("xg-spot", e.template || "", { 10860 "data-text": e.text, 10861 "data-time": e.time, 10862 "data-id": e.id 10863 }, r); 10864 Object.keys(o).map((function(e) { 10865 s.style[e] = o[e] 10866 } 10867 )), 10868 i.outer && i.outer.appendChild(s) 10869 } 10870 }, 10871 findDot: function(e) { 10872 if (this.player.plugins.progress) { 10873 var t = this._ispots.filter((function(t, i) { 10874 return t.id === e 10875 } 10876 )); 10877 return t.length > 0 ? t[0] : null 10878 } 10879 }, 10880 updateDot: function(e) { 10881 var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1] 10882 , i = this.player.plugins.progress; 10883 if (i) { 10884 var n = this.findDot(e.id); 10885 if (n && Object.keys(e).map((function(t) { 10886 n[t] = e[t] 10887 } 10888 )), 10889 this.ispotsInit) { 10890 var o = i.find('xg-spot[data-id="'.concat(e.id, '"]')); 10891 o && (this._updateDotDom(e, o), 10892 t && this.showDot(e.id)) 10893 } 10894 } 10895 }, 10896 deleteDot: function(e) { 10897 var t = this._ispots 10898 , i = this.player.plugins.progress; 10899 if (i) { 10900 for (var n = [], o = 0; o < t.length; o++) 10901 t[o].id === e && n.push(o); 10902 for (var r = n.length - 1; r >= 0; r--) 10903 if (t.splice(n[r], 1), 10904 this.ispotsInit) { 10905 var s = i.find('xg-spot[data-id="'.concat(e, '"]')); 10906 s && s.parentElement.removeChild(s) 10907 } 10908 } 10909 }, 10910 deleteAllDots: function() { 10911 var e = this.player.plugins.progress; 10912 if (e) 10913 if (this.ispotsInit) { 10914 for (var t = e.root.getElementsByTagName("xg-spot"), i = t.length - 1; i >= 0; i--) 10915 e.outer.removeChild(t[i]); 10916 this._ispots = [] 10917 } else 10918 this._ispots = [] 10919 }, 10920 updateAllDots: function() { 10921 var e = this 10922 , t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [] 10923 , i = this.player.plugins.progress; 10924 if (i) 10925 if (this.ispotsInit) { 10926 this._ispots = []; 10927 var n = i.root.getElementsByTagName("xg-spot") 10928 , o = n.length; 10929 if (o > t.length) 10930 for (var r = o - 1; r > t.length - 1; r--) 10931 i.outer.removeChild(n[r]); 10932 t.forEach((function(t, i) { 10933 i < o ? (n[i].setAttribute("data-id", "".concat(t.id)), 10934 e._ispots.push(t), 10935 e.updateDot(t)) : e.createDot(t) 10936 } 10937 )) 10938 } else 10939 this._ispots = t 10940 }, 10941 updateDuration: function() { 10942 var e = this 10943 , t = this.player.plugins.progress; 10944 t && this._ispots.forEach((function(i) { 10945 var n = t.find('xg-spot[data-id="'.concat(i.id, '"]')); 10946 e._updateDotDom(i, n) 10947 } 10948 )) 10949 }, 10950 getAllDotsDom: function() { 10951 var e = this.player.plugins.progress; 10952 return e ? e.root.getElementsByTagName("xg-spot") : [] 10953 }, 10954 getDotDom: function(e) { 10955 var t = this.player.plugins.progress; 10956 if (t) 10957 return t.find('xg-spot[data-id="'.concat(e, '"]')) 10958 } 10959 }; 10960 var xn = { 10961 dragmove: "onProgressMove", 10962 dragstart: "onProgressDragStart", 10963 dragend: "onProgressDragEnd", 10964 click: "onProgressClick", 10965 mouseover: "onProgressMouseOver", 10966 mouseenter: "onProgressMove" 10967 } 10968 , En = function(e) { 10969 a(i, e); 10970 var t = d(i); 10971 function i(e) { 10972 var o; 10973 return n(this, i), 10974 s(u(o = t.call(this, e)), "onMousemove", (function(e) { 10975 o.config.disable || (x.hasClass(e.target, "xg-spot-content") && o.config.isHideThumbnailHover ? o.player.plugins.progress.onMouseLeave(e) : (o._state.f || x.hasClass(e.target, "xg-spot-content")) && (x.event(e), 10976 e.stopPropagation())) 10977 } 10978 )), 10979 s(u(o), "onMousedown", (function(e) { 10980 o.config.disable || (o._state.f || x.hasClass(e.target, "xg-spot-content")) && (x.event(e), 10981 e.stopPropagation()) 10982 } 10983 )), 10984 s(u(o), "onMouseup", (function(e) { 10985 if (o.isDrag) { 10986 var t = o.player.plugins.progress; 10987 t && t.pos && (t.onMouseUp(e), 10988 !t.pos.isEnter && t.onMouseLeave(e)) 10989 } 10990 } 10991 )), 10992 s(u(o), "onDotMouseLeave", (function(e) { 10993 if (!o.config.disable) { 10994 o._curDot.removeEventListener("mouseleave", o.onDotMouseLeave), 10995 o.blurDot(e.target), 10996 o._curDot = null; 10997 var t = o.player.plugins.progress; 10998 t && t.enableBlur(), 10999 o.show() 11000 } 11001 } 11002 )), 11003 s(u(o), "onProgressMouseOver", (function(e, t) { 11004 if (!o.config.disable && x.hasClass(t.target, "xgplayer-spot") && !o._curDot) { 11005 o._curDot = t.target, 11006 o.focusDot(t.target), 11007 o._curDot.children.length > 0 && o.hide(); 11008 var i = o.player.plugins.progress; 11009 i && i.disableBlur(), 11010 o._curDot.addEventListener("mouseleave", o.onDotMouseLeave) 11011 } 11012 } 11013 )), 11014 o._ispots = [], 11015 o.videoPreview = null, 11016 o.videothumbnail = null, 11017 o.thumbnail = null, 11018 o.timeStr = "", 11019 o._state = { 11020 now: 0, 11021 f: !1 11022 }, 11023 o 11024 } 11025 return r(i, [{ 11026 key: "beforeCreate", 11027 value: function(e) { 11028 var t = e.player.plugins.progress; 11029 t && (e.root = t.root) 11030 } 11031 }, { 11032 key: "afterCreate", 11033 value: function() { 11034 var e = this; 11035 this._curDot = null, 11036 this.handlerSpotClick = this.hook("spotClick", (function(t, i) { 11037 i.currentTime && e.player.seek(i.currentTime) 11038 } 11039 )), 11040 this.transformTimeHook = this.hook("transformTime", (function(t) { 11041 e.setTimeContent(x.format(t)) 11042 } 11043 )), 11044 function(e) { 11045 var t = e.config 11046 , i = e.player; 11047 Object.keys(Tn).map((function(t) { 11048 e[t] = Tn[t].bind(e) 11049 } 11050 )); 11051 var n = i.config.progressDot || t.ispots || []; 11052 e._ispots = n.map((function(e) { 11053 return wn(e), 11054 e 11055 } 11056 )), 11057 e.ispotsInit = !1, 11058 e.on(K, (function() { 11059 e.ispotsInit ? e.updateDuration() : e.initDots() 11060 } 11061 )) 11062 }(this), 11063 this.on(K, (function() { 11064 e.show() 11065 } 11066 )), 11067 this.config.disable && this.disable(), 11068 this.extTextRoot = this.find(".xg-spot-ext-text") 11069 } 11070 }, { 11071 key: "setConfig", 11072 value: function(e) { 11073 var t = this; 11074 e && Object.keys(e).map((function(i) { 11075 t.config[i] = e[i] 11076 } 11077 )) 11078 } 11079 }, { 11080 key: "onPluginsReady", 11081 value: function() { 11082 this.player.plugins.progress && (this.previewLine = this.find(".xg-spot-line"), 11083 this.timePoint = this.find(".xgplayer-progress-point"), 11084 this.timeText = this.find(".xg-spot-time"), 11085 this.tipText = this.find(".spot-inner-text"), 11086 this._hasThumnail = !1, 11087 this.registerThumbnail(), 11088 this.bindEvents()) 11089 } 11090 }, { 11091 key: "bindEvents", 11092 value: function() { 11093 var e = this 11094 , t = this.player.plugins.progress; 11095 if (t && (Object.keys(xn).map((function(i) { 11096 e[xn[i]] = e[xn[i]].bind(e), 11097 t.addCallBack(i, e[xn[i]]) 11098 } 11099 )), 11100 "mobile" !== O.device)) { 11101 this.bind(".xg-spot-info", "mousemove", this.onMousemove), 11102 this.bind(".xg-spot-info", "mousedown", this.onMousedown), 11103 this.bind(".xg-spot-info", "mouseup", this.onMouseup); 11104 var i = this.hook("previewClick", (function() {} 11105 )); 11106 this.handlerPreviewClick = function(t) { 11107 t.stopPropagation(), 11108 i(parseInt(1e3 * e._state.now, 10) / 1e3, t) 11109 } 11110 , 11111 this.bind(".xg-spot-content", "mouseup", this.handlerPreviewClick) 11112 } 11113 } 11114 }, { 11115 key: "onProgressMove", 11116 value: function(e, t) { 11117 !this.config.disable && this.player.duration && this.updatePosition(e.offset, e.width, e.currentTime, e.e) 11118 } 11119 }, { 11120 key: "onProgressDragStart", 11121 value: function(e) { 11122 !this.config.disable && this.player.duration && (this.isDrag = !0, 11123 this.videoPreview && x.addClass(this.videoPreview, "show")) 11124 } 11125 }, { 11126 key: "onProgressDragEnd", 11127 value: function(e) { 11128 !this.config.disable && this.player.duration && (this.isDrag = !1, 11129 this.videoPreview && x.removeClass(this.videoPreview, "show")) 11130 } 11131 }, { 11132 key: "onProgressClick", 11133 value: function(e, t) { 11134 this.config.disable || x.hasClass(t.target, "xgplayer-spot") && (t.stopPropagation(), 11135 t.preventDefault(), 11136 ["time", "id", "text"].map((function(i) { 11137 e[i] = t.target.getAttribute("data-".concat(i)) 11138 } 11139 )), 11140 e.time && (e.time = Number(e.time)), 11141 this.handlerSpotClick(t, e)) 11142 } 11143 }, { 11144 key: "updateLinePos", 11145 value: function(e, t) { 11146 var i = this.root 11147 , n = this.previewLine 11148 , o = this.timePoint 11149 , r = this.player 11150 , s = this.config 11151 , a = "flex" === r.controls.mode 11152 , l = i.getBoundingClientRect().width; 11153 if (l) { 11154 var c, u, h = o.getBoundingClientRect().width, d = e - (l = this._hasThumnail && l < s.width ? s.width : l) / 2; 11155 d < 0 && !a ? (d = 0, 11156 c = e - l / 2, 11157 !this.thumbnail && (u = e - l / 2 - h / 2)) : d > t - l && !a ? (c = d - (t - l), 11158 !this.thumbnail && (u = d - (t - l) - h / 2), 11159 d = t - l) : (c = 0, 11160 !this.thumbnail && (u = -h / 2)), 11161 void 0 !== c && (n.style.transform = "translateX(".concat(c.toFixed(2), "px)")), 11162 void 0 !== u && (o.style.transform = "translateX(".concat(u.toFixed(2), "px)")), 11163 i.style.transform = "translateX(".concat(d.toFixed(2), "px) translateZ(0)") 11164 } 11165 } 11166 }, { 11167 key: "updateTimeText", 11168 value: function(e) { 11169 var t = this.timeText 11170 , i = this.timePoint; 11171 t.textContent = e, 11172 !this.thumbnail && (i.textContent = e) 11173 } 11174 }, { 11175 key: "updatePosition", 11176 value: function(e, t, i, n) { 11177 var o = this.root 11178 , r = this.config 11179 , s = this._state; 11180 if (o) { 11181 this.updateLinePos(e, t), 11182 s.now = i, 11183 this.transformTimeHook(i); 11184 var a = this.timeStr; 11185 n && n.target && x.hasClass(n.target, "xgplayer-spot") ? (this.showTips(n.target.getAttribute("data-text"), !1, a), 11186 this.focusDot(n.target), 11187 s.f = !0, 11188 r.isFocusDots && s.f && (s.now = parseInt(n.target.getAttribute("data-time"), 10))) : r.defaultText ? (s.f = !1, 11189 this.showTips(r.defaultText, !0, a)) : (s.f = !1, 11190 this.hideTips("")), 11191 this.updateTimeText(a), 11192 this.updateThumbnails(s.now) 11193 } 11194 } 11195 }, { 11196 key: "setTimeContent", 11197 value: function(e) { 11198 this.timeStr = e 11199 } 11200 }, { 11201 key: "updateThumbnails", 11202 value: function(e) { 11203 var t = this.player 11204 , i = this.videoPreview 11205 , n = this.config 11206 , o = t.plugins.thumbnail; 11207 if (o && o.usable) { 11208 this.thumbnail && o.update(this.thumbnail, e, n.width, n.height); 11209 var r = i && i.getBoundingClientRect(); 11210 this.videothumbnail && o.update(this.videothumbnail, e, r.width, r.height) 11211 } 11212 } 11213 }, { 11214 key: "registerThumbnail", 11215 value: function() { 11216 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; 11217 if ("mobile" !== O.device) { 11218 var t = this.player 11219 , i = this.config 11220 , n = t.getPlugin("thumbnail"); 11221 if (n && n.setConfig(e), 11222 n && n.usable && i.isShowThumbnail) { 11223 x.removeClass(this.root, "short-line no-thumbnail"), 11224 "short" === i.mode && x.addClass(this.root, "short-line"), 11225 this._hasThumnail = !0; 11226 var o = this.find(".xg-spot-thumbnail"); 11227 this.thumbnail = n.createThumbnail(o, "progress-thumbnail"), 11228 i.isShowCoverPreview && (this.videoPreview = x.createDom("xg-video-preview", "", {}, "xgvideo-preview"), 11229 t.root.appendChild(this.videoPreview), 11230 this.videothumbnail = n.createThumbnail(this.videoPreview, "xgvideo-thumbnail")), 11231 this.updateThumbnails(0) 11232 } else 11233 x.addClass(this.root, "short-line no-thumbnail") 11234 } 11235 } 11236 }, { 11237 key: "calcuPosition", 11238 value: function(e, t) { 11239 var i = this.player.plugins.progress 11240 , n = this.player 11241 , o = i.root.getBoundingClientRect().width 11242 , r = n.duration / o * 6; 11243 return e + t > n.duration && (t = n.duration - e), 11244 n.duration, 11245 n.duration, 11246 { 11247 left: e / n.duration * 100, 11248 width: t / n.duration * 100, 11249 isMini: t < r 11250 } 11251 } 11252 }, { 11253 key: "showDot", 11254 value: function(e) { 11255 var t = this.findDot(e); 11256 if (t) { 11257 var i = this.root.getBoundingClientRect().width 11258 , n = t.time / this.player.duration * i; 11259 this.updatePosition(n, i, t.time) 11260 } 11261 } 11262 }, { 11263 key: "focusDot", 11264 value: function(e, t) { 11265 e && (t || (t = e.getAttribute("data-id")), 11266 x.addClass(e, "active"), 11267 this._activeDotId = t) 11268 } 11269 }, { 11270 key: "blurDot", 11271 value: function(e) { 11272 if (!e) { 11273 var t = this._activeDotId; 11274 e = this.getDotDom(t) 11275 } 11276 e && (x.removeClass(e, "active"), 11277 this._activeDotId = null) 11278 } 11279 }, { 11280 key: "showTips", 11281 value: function(e, t) { 11282 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ""; 11283 x.addClass(this.root, "no-timepoint"), 11284 e && (x.addClass(this.find(".xg-spot-content"), "show-text"), 11285 t && "production" === this.config.mode ? (x.addClass(this.root, "product"), 11286 this.tipText.textContent = e) : (x.removeClass(this.root, "product"), 11287 this.tipText.textContent = this._hasThumnail ? e : "".concat(i, " ").concat(e))) 11288 } 11289 }, { 11290 key: "hideTips", 11291 value: function() { 11292 x.removeClass(this.root, "no-timepoint"), 11293 this.tipText.textContent = "", 11294 x.removeClass(this.find(".xg-spot-content"), "show-text"), 11295 x.removeClass(this.root, "product") 11296 } 11297 }, { 11298 key: "hide", 11299 value: function() { 11300 x.addClass(this.root, "hide") 11301 } 11302 }, { 11303 key: "show", 11304 value: function() { 11305 x.removeClass(this.root, "hide") 11306 } 11307 }, { 11308 key: "enable", 11309 value: function() { 11310 var e = this.config 11311 , t = this.playerConfig; 11312 this.config.disable = !1, 11313 this.show(), 11314 !this.thumbnail && e.isShowThumbnail && this.registerThumbnail(t.thumbnail || {}) 11315 } 11316 }, { 11317 key: "disable", 11318 value: function() { 11319 this.config.disable = !0, 11320 this.hide() 11321 } 11322 }, { 11323 key: "destroy", 11324 value: function() { 11325 var e = this 11326 , t = this.player.plugins.progress; 11327 t && Object.keys(xn).map((function(i) { 11328 t.removeCallBack(i, e[xn[i]]) 11329 } 11330 )), 11331 this.videothumbnail = null, 11332 this.thumbnail = null, 11333 this.videoPreview && this.player.root.removeChild(this.videoPreview), 11334 this.unbind(".xg-spot-info", "mousemove", this.onMousemove), 11335 this.unbind(".xg-spot-info", "mousedown", this.onMousedown), 11336 this.unbind(".xg-spot-info", "mouseup", this.onMouseup), 11337 this.unbind(".xg-spot-content", "mouseup", this.handlerPreviewClick) 11338 } 11339 }, { 11340 key: "render", 11341 value: function() { 11342 return "mobile" === O.device || "mobile" === this.playerConfig.isMobileSimulateMode ? "" : '<div class="xg-spot-info hide '.concat("short" === this.config.mode ? "short-line" : "", '">\n <div class="xg-spot-content">\n <div class="xg-spot-thumbnail">\n <span class="xg-spot-time"></span>\n </div>\n <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n </div>\n <div class="xgplayer-progress-point">00:00</div>\n <div class="xg-spot-ext-text"></div>\n <div class="xg-spot-line"></div>\n </div>') 11343 } 11344 }], [{ 11345 key: "pluginName", 11346 get: function() { 11347 return "progresspreview" 11348 } 11349 }, { 11350 key: "defaultConfig", 11351 get: function() { 11352 return { 11353 index: 1, 11354 miniWidth: 6, 11355 ispots: [], 11356 defaultText: "", 11357 isFocusDots: !0, 11358 isHideThumbnailHover: !0, 11359 isShowThumbnail: !0, 11360 isShowCoverPreview: !1, 11361 mode: "", 11362 disable: !1, 11363 width: 160, 11364 height: 90 11365 } 11366 } 11367 }]), 11368 i 11369 }(ot) 11370 , Sn = function(e) { 11371 a(i, e); 11372 var t = d(i); 11373 function i(e) { 11374 var o; 11375 return n(this, i), 11376 (o = t.call(this, e)).ratio = 1, 11377 o.interval = null, 11378 o._preloadMark = {}, 11379 o 11380 } 11381 return r(i, [{ 11382 key: "afterCreate", 11383 value: function() { 11384 var e = this; 11385 this.usable && this.initThumbnail(), 11386 this.on([K], (function() { 11387 var t = e.config 11388 , i = t.pic_num 11389 , n = t.interval; 11390 e.usable && (e.interval = n > 0 ? n : Math.round(1e3 * e.player.duration / i) / 1e3) 11391 } 11392 )) 11393 } 11394 }, { 11395 key: "setConfig", 11396 value: function(e) { 11397 var t = this; 11398 if (e) { 11399 var i = Object.keys(e); 11400 i.length < 1 || (i.forEach((function(i) { 11401 t.config[i] = e[i] 11402 } 11403 )), 11404 this.usable && this.initThumbnail()) 11405 } 11406 } 11407 }, { 11408 key: "usable", 11409 get: function() { 11410 var e = this.config 11411 , t = e.urls 11412 , i = e.pic_num; 11413 return t && t.length > 0 && i > 0 11414 } 11415 }, { 11416 key: "initThumbnail", 11417 value: function() { 11418 var e = this.config 11419 , t = e.width 11420 , i = e.height 11421 , n = e.pic_num 11422 , o = e.interval; 11423 this.ratio = t / i * 100, 11424 this.interval = o || Math.round(this.player.duration / n), 11425 this._preloadMark = {} 11426 } 11427 }, { 11428 key: "getUrlByIndex", 11429 value: function(e) { 11430 return e >= 0 && e < this.config.urls.length ? this.config.urls[e] : "" 11431 } 11432 }, { 11433 key: "preload", 11434 value: function(e) { 11435 var t = this; 11436 if (!this._preloadMark[e]) { 11437 var i = this.config.urls 11438 , n = i.length 11439 , o = []; 11440 e > 0 && o.push(e - 1), 11441 o.push(e), 11442 e > 0 && e < n - 1 && o.push(e + 1), 11443 o.map((function(e) { 11444 !t._preloadMark[e] && e >= 0 && e < n && (t._preloadMark[e] = 1, 11445 x.preloadImg(i[e], (function() { 11446 t._preloadMark[e] = 2 11447 } 11448 ))) 11449 } 11450 )) 11451 } 11452 } 11453 }, { 11454 key: "getPosition", 11455 value: function(e) { 11456 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0 11457 , i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0 11458 , n = this.config 11459 , o = n.pic_num 11460 , r = n.row 11461 , s = n.col 11462 , a = n.width 11463 , l = n.height; 11464 this.interval = Math.round(this.player.duration / o); 11465 var c = Math.ceil(e / this.interval) 11466 , u = (c = c > o ? o : c) < r * s ? 0 : Math.ceil(c / (r * s)) - 1 11467 , h = c - u * (s * r) 11468 , d = h > 0 ? Math.ceil(h / s) - 1 : 0 11469 , f = h > 0 ? h - d * s - 1 : 0 11470 , p = 0 11471 , g = 0; 11472 if (t && i) { 11473 var v = t / i; 11474 v < a / l ? p = (g = i) * (a / l) : g = (p = t) / (a / l) 11475 } else 11476 i ? t || (p = (g = i || l) * (a / l)) : g = (p = t || a) / (a / l); 11477 var y = this.getUrlByIndex(u); 11478 return { 11479 urlIndex: u, 11480 rowIndex: d, 11481 colIndex: f, 11482 url: y, 11483 height: g, 11484 width: p, 11485 style: { 11486 backgroundImage: "url(".concat(y, ")"), 11487 backgroundSize: "".concat(p * s, "px auto"), 11488 backgroundPosition: "-".concat(f * p, "px -").concat(d * g, "px"), 11489 width: "".concat(p, "px"), 11490 height: "".concat(g, "px") 11491 } 11492 } 11493 } 11494 }, { 11495 key: "update", 11496 value: function(e, t) { 11497 var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0 11498 , n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0 11499 , o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "" 11500 , r = this.config 11501 , s = r.pic_num 11502 , a = r.urls; 11503 if (!(s <= 0) && a && 0 !== a.length) { 11504 var l = this.getPosition(t, i, n); 11505 this.preload(l.urlIndex), 11506 Object.keys(l.style).map((function(t) { 11507 e.style[t] = l.style[t] 11508 } 11509 )), 11510 Object.keys(o).map((function(t) { 11511 e.style[t] = o[t] 11512 } 11513 )) 11514 } 11515 } 11516 }, { 11517 key: "changeConfig", 11518 value: function() { 11519 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; 11520 this.setConfig(e) 11521 } 11522 }, { 11523 key: "createThumbnail", 11524 value: function(e, t) { 11525 var i = x.createDom("xg-thumbnail", "", {}, "thumbnail ".concat(t)); 11526 return e && e.appendChild(i), 11527 i 11528 } 11529 }], [{ 11530 key: "pluginName", 11531 get: function() { 11532 return "thumbnail" 11533 } 11534 }, { 11535 key: "defaultConfig", 11536 get: function() { 11537 return { 11538 isShow: !1, 11539 urls: [], 11540 pic_num: 0, 11541 col: 0, 11542 row: 0, 11543 height: 90, 11544 width: 160, 11545 scale: 1, 11546 className: "", 11547 hidePortrait: !1 11548 } 11549 } 11550 }]), 11551 i 11552 }(ot) 11553 , Pn = function(e) { 11554 a(i, e); 11555 var t = d(i); 11556 function i() { 11557 return n(this, i), 11558 t.apply(this, arguments) 11559 } 11560 return r(i, [{ 11561 key: "afterCreate", 11562 value: function() {} 11563 }, { 11564 key: "update", 11565 value: function() { 11566 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { 11567 cached: 0, 11568 played: 0 11569 } 11570 , t = arguments.length > 1 ? arguments[1] : void 0; 11571 t && this.root && (e.cached && (this.find("xg-mini-progress-cache").style.width = "".concat(e.cac
11571hed / t * 100, "%")), 11572 e.played && (this.find("xg-mini-progress-played").style.width = "".concat(e.played / t * 100, "%"))) 11573 } 11574 }, { 11575 key: "render", 11576 value: function() { 11577 if (this.playerConfig.progress && this.playerConfig.miniprogress) 11578 return '<xg-mini-progress class="xg-mini-progress">\n <xg-mini-progress-cache class="xg-mini-progress-cache"></xg-mini-progress-cache>\n <xg-mini-progress-played class="xg-mini-progress-played"></xg-mini-progress-played>\n </xg-mini-progress>' 11579 } 11580 }], [{ 11581 key: "pluginName", 11582 get: function() { 11583 return "MiniProgress" 11584 } 11585 }, { 11586 key: "defaultConfig", 11587 get: function() { 11588 return {} 11589 } 11590 }]), 11591 i 11592 }(ot) 11593 , Ln = "realtime" 11594 , In = "firstframe" 11595 , An = "poster"; 11596 function On() { 11597 try { 11598 return parseInt(window.performance.now(), 10) 11599 } catch (e) { 11600 return (new Date).getTime() 11601 } 11602 } 11603 var Rn = null 11604 , Dn = function(e) { 11605 a(i, e); 11606 var t = d(i); 11607 function i() { 11608 var e; 11609 n(this, i); 11610 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 11611 r[a] = arguments[a]; 11612 return s(u(e = t.call.apply(t, [this].concat(r))), "onLoadedData", (function(t) { 11613 e.player && (e._frameCount = e.config.startFrameCount, 11614 e.renderOnTimeupdate(t), 11615 e.off(W, e.renderOnTimeupdate), 11616 e.on(W, e.renderOnTimeupdate)) 11617 } 11618 )), 11619 s(u(e), "renderOnTimeupdate", (function(t) { 11620 e._frameCount > 0 ? (e.renderOnce(), 11621 e._frameCount--) : (e._isLoaded = !0, 11622 e.off(W, e.renderOnTimeupdate), 11623 !e.player.paused && e._checkIfCanStart() && e.start()) 11624 } 11625 )), 11626 s(u(e), "start", (function() { 11627 var t = e.player.media 11628 , i = On() 11629 , n = e.checkVideoIsSupport(t); 11630 n && e.canvasCtx && (e.stop(), 11631 t.videoWidth && t.videoHeight && (e.videoPI = t.videoHeight > 0 ? parseInt(t.videoWidth / t.videoHeight * 100, 10) : 0, 11632 (e.config.mode === Ln || i - e.preTime >= e.interval) && (t && t.videoWidth && e.update(n, e.videoPI), 11633 e.preTime = i)), 11634 e.frameId = x.requestAnimationFrame(e.start)) 11635 } 11636 )), 11637 s(u(e), "stop", (function() { 11638 e.frameId && (x.cancelAnimationFrame(e.frameId), 11639 e.frameId = null) 11640 } 11641 )), 11642 e 11643 } 11644 return r(i, [{ 11645 key: "afterCreate", 11646 value: function() { 11647 var e = this; 11648 !0 === this.playerConfig.dynamicBg && (this.config.disable = !1), 11649 i.isSupport || (this.config.disable = !0); 11650 var t = this.config 11651 , n = t.disable 11652 , o = t.mode 11653 , r = t.frameRate; 11654 n || (this._pos = { 11655 width: 0, 11656 height: 0, 11657 rwidth: 0, 11658 rheight: 0, 11659 x: 0, 11660 y: 0, 11661 pi: 0 11662 }, 11663 this.isStart = !1, 11664 this._isLoaded = !1, 11665 this.videoPI = 0, 11666 this.preTime = 0, 11667 this.interval = parseInt(1e3 / r, 10), 11668 this.canvas = null, 11669 this.canvasCtx = null, 11670 this._frameCount = 0, 11671 this.once(se, (function() { 11672 e.player && (e.init(), 11673 e.player.paused || e.start()) 11674 } 11675 )), 11676 o !== An && (o !== In && (this.on(Q, (function() { 11677 e.stop() 11678 } 11679 )), 11680 this.on(N, (function() { 11681 e._checkIfCanStart() && e.start() 11682 } 11683 )), 11684 this.on(B, (function() { 11685 e.stop() 11686 } 11687 ))), 11688 this.on(X, this.onLoadedData), 11689 this.on($, (function() { 11690 e._isLoaded = !1, 11691 e.stop() 11692 } 11693 )))) 11694 } 11695 }, { 11696 key: "init", 11697 value: function() { 11698 var e = this.player 11699 , t = this.config; 11700 this.canvasFilter = i.supportCanvasFilter(); 11701 try { 11702 var n = this.config.isInnerRender && e.innerContainer || e.root; 11703 n.insertAdjacentHTML("afterbegin", '<div class="xgplayer-dynamic-bg"><canvas>\n </canvas><xgmask>
11703</xgmask></div>'), 11704 this.root = n.children[0], 11705 this.canvas = this.find("canvas"), 11706 this.canvasFilter || (this.canvas.style.filter = t.filter, 11707 this.canvas.style.webkitFilter = t.filter), 11708 this.mask = this.find("xgmask"), 11709 t.addMask && (this.mask.style.background = t.maskBg), 11710 this.canvasCtx = this.canvas.getContext("2d"), 11711 this.renderByPoster() 11712 } catch (o) { 11713 w.logError("plugin:DynamicBg", o) 11714 } 11715 } 11716 }, { 11717 key: "checkVideoIsSupport", 11718 value: function(e) { 11719 if (!e) 11720 return null; 11721 var t = e && e instanceof window.HTMLVideoElement ? e : e.canvas ? e.canvas : e.flyVideo ? e.flyVideo : null; 11722 if (t && ("safari" !== O.browser || !/^blob/.test(t.currentSrc) && !/^blob/.test(t.src))) 11723 return t; 11724 var i = t ? t.tagName.toLowerCase() : ""; 11725 return "canvas" === i || "img" === i ? t : null 11726 } 11727 }, { 11728 key: "renderByPoster", 11729 value: function() { 11730 var e = this.playerConfig.poster; 11731 if (e) { 11732 var t = "String" === x.typeOf(e) ? e : "String" === x.typeOf(e.poster) ? e.poster : null; 11733 this.updateImg(t) 11734 } 11735 } 11736 }, { 11737 key: "_checkIfCanStart", 11738 value: function() { 11739 var e = this.config.mode; 11740 return this._isLoaded && e !== In && e !== An 11741 } 11742 }, { 11743 key: "renderOnce", 11744 value: function() { 11745 var e = this.player.media; 11746 if (e.videoWidth && e.videoHeight) { 11747 this.videoPI = parseInt(e.videoWidth / e.videoHeight * 100, 10); 11748 var t = this.checkVideoIsSupport(e); 11749 t && e.videoWidth && this.update(t, this.videoPI) 11750 } 11751 } 11752 }, { 11753 key: "updateImg", 11754 value: function(e) { 11755 var t = this; 11756 if (e) { 11757 var i = this.canvas.getBoundingClientRect() 11758 , n = i.width 11759 , o = i.height 11760 , r = new window.Image; 11761 r.onload = function() { 11762 if (t.canvas && !t.frameId && !t.isStart) { 11763 t.canvas.height = o, 11764 t.canvas.width = n; 11765 var e = parseInt(n / o * 100, 10); 11766 t.update(r, e), 11767 r = null 11768 } 11769 } 11770 , 11771 r.src = e 11772 } 11773 } 11774 }, { 11775 key: "update", 11776 value: function(e, t) { 11777 if (this.canvas && this.canvasCtx && t) 11778 try { 11779 var i = this._pos 11780 , n = this.config 11781 , o = this.canvas.getBoundingClientRect() 11782 , r = o.width 11783 , s = o.height; 11784 if (r !== i.width || s !== i.height || i.pi !== t) { 11785 var a = parseInt(r / s * 100, 10); 11786 i.pi = t, 11787 i.width = this.canvas.width = r, 11788 i.height = this.canvas.height = s; 11789 var l = s 11790 , c = r; 11791 a < t ? c = parseInt(s * t / 100, 10) : a > t && (l = parseInt(100 * r / t, 10)), 11792 i.rwidth = c * n.multiple, 11793 i.rheight = l * n.multiple, 11794 i.x = (r - i.rwidth) / 2, 11795 i.y = (s - i.rheight) / 2 11796 } 11797 this.canvasFilter && (this.canvasCtx.filter = n.filter), 11798 this.canvasCtx.drawImage(e, i.x, i.y, i.rwidth, i.rheight) 11799 } catch (u) { 11800 w.logError("plugin:DynamicBg", u) 11801 } 11802 } 11803 }, {
vendor: 16,384 bytes, lines 11804-12263
11804 key: "destroy", 11805 value: function() { 11806 this.stop(), 11807 this.canvasCtx = null, 11808 this.canvas = null 11809 } 11810 }, { 11811 key: "render", 11812 value: function() { 11813 return "" 11814 } 11815 }], [{ 11816 key: "pluginName", 11817 get: function() { 11818 return "dynamicBg" 11819 } 11820 }, { 11821 key: "defaultConfig", 11822 get: function() { 11823 return { 11824 isInnerRender: !1, 11825 disable: !0, 11826 mode: "framerate", 11827 frameRate: 10, 11828 filter: "blur(50px)", 11829 startFrameCount: 2, 11830 addMask: !0, 11831 multiple: 1.2, 11832 maskBg: "rgba(0,0,0,0.7)" 11833 } 11834 } 11835 }, { 11836 key: "isSupport", 11837 get: function() { 11838 return "boolean" == typeof Rn ? Rn : Rn = function() { 11839 try { 11840 return !!document.createElement("canvas").getContext 11841 } catch (e) { 11842 return !1 11843 } 11844 }() 11845 } 11846 }, { 11847 key: "supportCanvasFilter", 11848 value: function() { 11849 return !("safari" === O.browser || "firefox" === O.browser) 11850 } 11851 }]), 11852 i 11853 }(ot) 11854 , Mn = "info" 11855 , jn = Ee 11856 , Nn = function(e) { 11857 a(o, e); 11858 var i = d(o); 11859 function o() { 11860 var e; 11861 n(this, o); 11862 for (var r = arguments.length, a = new Array(r), l = 0; l < r; l++) 11863 a[l] = arguments[l]; 11864 return s(u(e = i.call.apply(i, [this].concat(a))), "_recordUserActions", (function(i) { 11865 var n = e._getTime() 11866 , o = Object.assign({}, i, { 11867 msg: i.msg || i.action 11868 }); 11869 e._stats.info.push(t(t({ 11870 type: "userAction" 11871 }, n), {}, { 11872 payload: o 11873 })) 11874 } 11875 )), 11876 s(u(e), "_onReset", (function() { 11877 e.reset() 11878 } 11879 )), 11880 s(u(e), "_recordInfo", (function(t) { 11881 e.info(t) 11882 } 11883 )), 11884 s(u(e), "_downloadStats", (function() { 11885 var t = e.getStats() 11886 , i = new Blob([JSON.stringify(t)],{ 11887 type: "application/json" 11888 }) 11889 , n = window.URL.createObjectURL(i) 11890 , o = document.createElement("a"); 11891 o.style.display = "none", 11892 o.href = n, 11893 o.download = "player.txt", 11894 o.disabled = !1, 11895 o.click() 11896 } 11897 )), 11898 e 11899 } 11900 return r(o, [{ 11901 key: "_getTime", 11902 value: function() { 11903 return { 11904 timestamp: Date.now(), 11905 timeFormat: (new Date).toISOString() 11906 } 11907 } 11908 }, { 11909 key: "afterCreate", 11910 value: function() { 11911 this.reset(), 11912 this.on(we, this._recordUserActions), 11913 this.on(jn.STATS_INFO, this._recordInfo), 11914 this.on(jn.STATS_DOWNLOAD, this._downloadStats), 11915 this.on(jn.STATS_RESET, this._onReset) 11916 } 11917 }, { 11918 key: "destroy", 11919 value: function() { 11920 this.offAll() 11921 } 11922 }, { 11923 key: "downloadStats", 11924 value: function() { 11925 this._downloadStats() 11926 } 11927 }, { 11928 key: "info", 11929 value: function(e) { 11930 e.profile ? this._infoProfile(e) : this._info(e) 11931 } 11932 }, { 11933 key: "_info", 11934 value: function(e) { 11935 var i = this._getTime(); 11936 this._stats.info.push(t(t({}, i), {}, { 11937 payload: e 11938 })) 11939 } 11940 }, { 11941 key: "_infoProfile", 11942 value: function(e) { 11943 if (e && e.startMs) { 11944 var i = t({ 11945 cat: "function", 11946 dur: Date.now() - e.startMs, 11947 name: e.name || e.msg, 11948 ph: "X", 11949 pid: 0, 11950 tid: 0, 11951 ts: e.startMs, 11952 profile: !0 11953 }, e); 11954 this._info(i) 11955 } else 11956 console.warn("infoProfile need object data, include startMs") 11957 } 11958 }, { 11959 key: "reset", 11960 value: function() { 11961 var e; 11962 this._stats = (s(e = {}, Mn, []), 11963 s(e, "media", {}), 11964 e) 11965 } 11966 }, { 11967 key: "getStats", 11968 value: function() { 11969 for (var e = this.player.media, t = [], i = 0; i < e.buffered.length; i++) 11970 t.push({ 11971 start: e.buffered.start(i), 11972 end: e.buffered.end(i) 11973 }); 11974 var n = { 11975 currentTime: e.currentTime, 11976 readyState: e.readyState, 11977 buffered: t, 11978 paused: e.paused, 11979 ended: e.ended 11980 }; 11981 return this._stats.media = n, 11982 { 11983 raw: this._stats, 11984 timestat: this._getTimeStats(), 11985 profile: this._getProfile() 11986 } 11987 } 11988 }, { 11989 key: "_getTimeStats", 11990 value: function() { 11991 return this._stats.info.map((function(e) { 11992 var t = e.payload.data 11993 , i = ""; 11994 try { 11995 t instanceof Error ? i = t.msg : void 0 !== t && (i = JSON.stringify(t)) 11996 } catch (n) { 11997 console.log("err", n) 11998 } 11999 return "[".concat(e.timeFormat, "] : ").concat(e.payload.msg, " ").concat(i, " ") 12000 } 12001 )) 12002 } 12003 }, { 12004 key: "_getProfile", 12005 value: function() { 12006 var e = { 12007 traceEvents: [] 12008 }; 12009 return this._stats.info.forEach((function(t) { 12010 t.payload.profile && e.traceEvents.push(t.payload) 12011 } 12012 )), 12013 e 12014 } 12015 }], [{ 12016 key: "pluginName", 12017 get: function() { 12018 return "stats" 12019 } 12020 }, { 12021 key: "defaultConfig", 12022 get: function() { 12023 return {} 12024 } 12025 }]), 12026 o 12027 }(Ke) 12028 , Fn = function(e) { 12029 a(i, e); 12030 var t = d(i); 12031 function i() { 12032 var e; 12033 n(this, i); 12034 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 12035 r[a] = arguments[a]; 12036 return s(u(e = t.call.apply(t, [this].concat(r))), "onGapJump", (function() { 12037 var t = u(e) 12038 , n = t.player 12039 , o = t.config; 12040 if (n.media.readyState !== HTMLMediaElement.HAVE_NOTHING) { 12041 if (n.media.seeking) { 12042 if (!e.seekingEventReceived) 12043 return 12044 } else 12045 e.seekingEventReceived = !1; 12046 if (!n.media.paused || 0 === n.media.currentTime || !e.hasPlayed) { 12047 var r = n.media.buffered 12048 , s = o.smallGapLimit || .5 12049 , a = o.gapDetectionThreshold || .3 12050 , l = n.media.currentTime 12051 , c = e._getIndex(r, l, a); 12052 if (null !== c && 0 !== c) { 12053 console.log("GapJump bufferRange ", r.start(c), r.end(c)); 12054 var h = r.start(c) + .1; 12055 if (!(h > n.media.duration)) { 12056 var d = h - l 12057 , f = d <= s; 12058 d < i.BROWSER_GAP_TOLERANCE || f && (!1 !== o.useGapJump && (n.media.currentTime = e.isSafari ? h + .1 : h), 12059 e.player && e.player.emit("detectGap"), 12060 console.log("gapJump gapIndex", c, " isGapSamll:", f, " currentTime:", n.media.currentTime, " jumpSize:", l - n.media.currentTime), 12061 .08 !== h && n && n.emit("log", { 12062 type: "oneevent", 12063 end_type: "gap", 12064 vid: n.config.vid, 12065 ext: { 12066 video_postion: Math.floor(1e3 * h) 12067 } 12068 })) 12069 } 12070 } 12071 } 12072 } 12073 } 12074 )), 12075 e 12076 } 12077 return r(i, [{ 12078 key: "afterCreate", 12079 value: function() { 12080 var e = this; 12081 !1 !== this.config.useGapJump && (this.hasPlayed = !1, 12082 this.seekingEventReceived = !1, 12083 this.isSafari = /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform), 12084 this.on(q, this.onGapJump), 12085 this.on(N, (function() { 12086 e.hasPlayed = !0 12087 } 12088 )), 12089 this.on(V, (function() { 12090 e.seekingEventReceived = !0 12091 } 12092 ))) 12093 } 12094 }, { 12095 key: "_getIndex", 12096 value: function(e, t, i) { 12097 if (!e || !e.length) 12098 return null; 12099 if (1 === e.length && e.end(0) - e.start(0) < 1e-6) 12100 return null; 12101 for (var n = this._getBuffered(e), o = null, r = 0; r < n.length; r++) { 12102 if (n[r].start > t && (0 === r || n[r - 1].end - t <= i)) { 12103 o = r; 12104 break 12105 } 12106 } 12107 return o 12108 } 12109 }, { 12110 key: "_getBuffered", 12111 value: function(e) { 12112 if (!e) 12113 return []; 12114 for (var t = [], i = 0; i < e.length; i++) 12115 t.push({ 12116 start: e.start(i), 12117 end: e.end(i) 12118 }); 12119 return t 12120 } 12121 }], [{ 12122 key: "pluginName", 12123 get: function() { 12124 return "gapJump" 12125 } 12126 }, { 12127 key: "defaultConfig", 12128 get: function() { 12129 return { 12130 useGapJump: !1, 12131 smallGapLimit: .5, 12132 gapDetectionThreshold: .3 12133 } 12134 } 12135 }]), 12136 i 12137 }(ot); 12138 Fn.BROWSER_GAP_TOLERANCE = .001; 12139 var Hn = function(e) { 12140 a(i, e); 12141 var t = d(i); 12142 function i() { 12143 var e; 12144 n(this, i); 12145 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 12146 r[a] = arguments[a]; 12147 return s(u(e = t.call.apply(t, [this].concat(r))), "onWaiting", (function() { 12148 var t = u(e).config; 12149 e.jumpCnt > t.jumpCntMax || e.timer || !1 === t.useWaitingTimeoutJump || (e.timer = setTimeout(e.onJump, 1e3 * t.waitingTime)) 12150 } 12151 )), 12152 s(u(e), "onJump", (function() { 12153 var t = u(e) 12154 , i = t.player 12155 , n = t.config; 12156 if (clearTimeout(e.timer), 12157 e.timer = null, 12158 !(e.jumpCnt > n.jumpCntMax || !1 === n.useWaitingTimeoutJump || i.media.paused && 0 !== i.media.currentTime && e.hasPlayed)) { 12159 e.jumpSize = n.jumpSize * (e.jumpCnt + 1), 12160 e.jumpCnt === n.jumpSize && e.jumpSize < 6 && (e.jumpSize = 6); 12161 var o = i.currentTime + e.jumpSize; 12162 o > i.media.duration || (console.log("waitintTimeout, currentTime:", i.currentTime, ", jumpTo:", o), 12163 e.jumpCnt++, 12164 i.currentTime = o) 12165 } 12166 } 12167 )), 12168 e 12169 } 12170 return r(i, [{ 12171 key: "afterCreate", 12172 value: function() { 12173 var e = this 12174 , t = this.config 12175 , i = t.useWaitingTimeoutJump 12176 , n = t.jumpSize; 12177 !1 !== i && (this.hasPlayed = !1, 12178 this.jumpCnt = 0, 12179 this.timer = null, 12180 this.jumpSize = n, 12181 this.on(q, this.onWaiting), 12182 this.on([F, z], (function() { 12183 clearTimeout(e.timer), 12184 e.timer = null, 12185 e.jumpSize = e.config.jumpSize 12186 } 12187 )), 12188 this.on(N, (function() { 12189 e.hasPlayed = !0 12190 } 12191 ))) 12192 } 12193 }], [{ 12194 key: "pluginName", 12195 get: function() { 12196 return "waitingTimeoutJump" 12197 } 12198 }, { 12199 key: "defaultConfig", 12200 get: function() { 12201 return { 12202 useWaitingTimeoutJump: !1, 12203 waitingTime: 15, 12204 jumpSize: 2, 12205 jumpCntMax: 4 12206 } 12207 } 12208 }]), 12209 i 12210 }(ot) 12211 , Bn = function(e) { 12212 a(i, e); 12213 var t = d(i); 12214 function i() { 12215 var e; 12216 n(this, i); 12217 for (var o = arguments.length, r = new Array(o), a = 0; a < o; a++) 12218 r[a] = arguments[a]; 12219 return s(u(e = t.call.apply(t, [this].concat(r))), "getSpeed", (function(t) { 12220 if (e.speedListCache.length <= 0) 12221 return 0; 12222 var i = 0; 12223 return e.speedListCache.map((function(e) { 12224 i += e 12225 } 12226 )), 12227 Math.floor(i / e.speedListCache.length) 12228 } 12229 )), 12230 s(u(e), "_onRealSpeedChange", (function(t) { 12231 t.speed && e.appendList(t.speed) 12232 } 12233 )), 12234 s(u(e), "testSpeed", (function() { 12235 if (clearTimeout(e.timer), 12236 e.timer = null, 12237 e.player && e.config.openSpeed) { 12238 var t = e.config 12239 , i = t.url 12240 , n = t.loadSize 12241 , o = t.testCnt 12242 , r = t.testTimeStep 12243 , s = i + (i.indexOf("?") < 0 ? "?testst=" : "&testst=") + Date.now(); 12244 if (!(e.cnt >= o)) { 12245 e.cnt++; 12246 try { 12247 var a = (new Date).getTime() 12248 , l = null 12249 , c = new XMLHttpRequest; 12250 e.xhr = c, 12251 c.open("GET", s); 12252 var u = {} 12253 , h = Math.floor(10 * Math.random()); 12254 u.Range = "bytes=" + h + "-" + (n + h), 12255 u && Object.keys(u).forEach((function(e) { 12256 c.setRequestHeader(e, u[e]) 12257 } 12258 )), 12259 c.onreadystatechange = function() { 12260 if (4 === c.readyState) { 12261 e.xhr = null, 12262 l = (new Date).getTime(); 12263 var t = c.getResponseHeader("Content-Length") / 1024
12263* 8 12264 , i = Math.round(1e3 * t / (l - a)); 12265 e.appendList(i), 12266 e.timer = setTimeout(e.testSpeed, r) 12267 } 12268 } 12269 , 12270 c.send() 12271 } catch (d) { 12272 console.error(d) 12273 } 12274 } 12275 } 12276 } 12277 )), 12278 s(u(e), "appendList", (function(t) { 12279 var i = e.config.saveSpeedMax; 12280 e.speedListCache.length >= i && e.speedListCache.shift(), 12281 e.speedListCache.push(t), 12282 e.player && (e.player.realTimeSpeed = t), 12283 e.updateSpeed() 12284 } 12285 )), 12286 s(u(e), "updateSpeed", (function() { 12287 var t = e.getSpeed() 12288 , i = u(e).player; 12289 !i || i.avgSpeed && t === i.avgSpeed || (i.avgSpeed = t, 12290 i.emit(ue, { 12291 speed: t, 12292 realTimeSpeed: i.realTimeSpeed 12293 })) 12294 } 12295 )), 12296 e 12297 } 12298 return r(i, [{ 12299 key: "afterCreate", 12300 value: function() { 12301 var e = this; 12302 this.speedListCache = []; 12303 var t = this.config 12304 , i = t.openSpeed 12305 , n = t.testTimeStep; 12306 this.timer = null, 12307 this.cnt = 0, 12308 this.xhr = null, 12309 i && (this.on("real_time_speed", this._onRealSpeedChange), 12310 this.on([X, ae], (function() { 12311 x.isMSE(e.player.video) || (e.speedListCache = [], 12312 e.cnt = 0, 12313 e.timer = setTimeout(e.testSpeed, n)) 12314 } 12315 ))) 12316 } 12317 }, { 12318 key: "openSpeed", 12319 get: function() { 12320 return this.config.openSpeed 12321 }, 12322 set: function(e) { 12323 if (this.config.openSpeed = e, 12324 !e && this.timer) 12325 return clearTimeout(this.timer), 12326 void (this.timer = null); 12327 if (this.config.openSpeed) { 12328 if (this.timer) 12329 return; 12330 this.timer = setTimeout(this.testSpeed, this.config.testTimeStep) 12331 } 12332 } 12333 }, { 12334 key: "destroy", 12335 value: function() { 12336 clearTimeout(this.timer), 12337 this.timer = null, 12338 this.xhr && 4 !== this.xhr.readyState && (this.xhr.cancel(), 12339 this.xhr = null) 12340 } 12341 }], [{ 12342 key: "pluginName", 12343 get: function() { 12344 return "testspeed" 12345 } 12346 }, { 12347 key: "defaultConfig", 12348 get: function() { 12349 return { 12350 openSpeed: !1, 12351 testCnt: 3, 12352 loadSize: 204800, 12353 testTimeStep: 3e3, 12354 url: "", 12355 saveSpeedMax: 5 12356 } 12357 } 12358 }]), 12359 i 12360 }(ot) 12361 , Un = function(e) { 12362 a(i, e); 12363 var t = d(i); 12364 function i() { 12365 return n(this, i), 12366 t.apply(this, arguments) 12367 } 12368 return r(i, [{ 12369 key: "afterCreate", 12370 value: function() { 12371 var e = this 12372 , t = this.player 12373 , i = this.config; 12374 (this.timer = null, 12375 this._lastDecodedFrames = 0, 12376 this._currentStuckCount = 0, 12377 this._lastCheckPoint = null, 12378 i.disabled) || t.media.getVideoPlaybackQuality && (this.on(N, (function() { 12379 e._startTick() 12380 } 12381 )), 12382 this.on(B, (function() { 12383 e._stopTick() 12384 } 12385 )), 12386 this.on(H, (function() { 12387 e._stopTick() 12388 } 12389 )), 12390 this.on(Q, (function() { 12391 e._stopTick() 12392 } 12393 ))) 12394 } 12395 }, { 12396 key: "_startTick", 12397 value: function() { 12398 var e = this; 12399 this._stopTick(), 12400 this._timer = setTimeout((function() { 12401 e._checkDecodeFPS(), 12402 e._startTick() 12403 } 12404 ), this.config.tick) 12405 } 12406 }, { 12407 key: "_stopTick", 12408 value: function() { 12409 clearTimeout(this._timer), 12410 this._timer = null 12411 } 12412 }, { 12413 key: "_checkStuck", 12414 value: function(e) { 12415 var t = this.player.media 12416 , i = document.hidden 12417 , n = t.paused; 12418 if ("boolean" == typeof i && !i && !n) { 12419 for (var o = t.currentTime, r = t.buffered, s = !1, a = 0; a < r.length; a++) { 12420 var l = r.start(a) 12421 , c = r.end(a); 12422 if (l <= o && o <= c - 1) { 12423 s = !0; 12424 break 12425 } 12426 } 12427 4 === t.readyState && s && (this._currentStuckCount >
12427 this.config.stuckCount ? (this.emit(Se), 12428 this._currentStuckCount = 0) : e <= this.config.reportFrame ? this._currentStuckCount++ : this._currentStuckCount = 0) 12429 } 12430 } 12431 }, { 12432 key: "_checkDecodeFPS", 12433 value: function() { 12434 if (this.player.media) { 12435 var e = this.player.media.getVideoPlaybackQuality().totalVideoFrames 12436 , t = performance.now(); 12437 if (e && this._lastCheckPoint) { 12438 var i = e - this._lastDecodedFrames; 12439 this._checkStuck(i) 12440 } 12441 this._lastDecodedFrames = e, 12442 this._lastCheckPoint = t 12443 } 12444 } 12445 }, { 12446 key: "destroy", 12447 value: function() { 12448 this._stopTick() 12449 } 12450 }], [{ 12451 key: "pluginName", 12452 get: function() { 12453 return "FpsDetect" 12454 } 12455 }, { 12456 key: "defaultConfig", 12457 get: function() { 12458 return { 12459 disabled: !1, 12460 tick: 1e3, 12461 stuckCount: 3, 12462 reportFrame: 0 12463 } 12464 } 12465 }]), 12466 i 12467 }(ot); 12468 wt.use({ 12469 LANG: "zh-cn", 12470 TEXT: { 12471 ERROR_TYPES: { 12472 network: { 12473 code: 1, 12474 msg: "è§é¢ä¸è½½é误" 12475 }, 12476 mse: { 12477 code: 2, 12478 msg: "æµè¿½å é误" 12479 }, 12480 parse: { 12481 code: 3, 12482 msg: "è§£æé误" 12483 }, 12484 format: { 12485 code: 4, 12486 msg: "æ ¼å¼é误" 12487 }, 12488 decoder: { 12489 code: 5, 12490 msg: "è§£ç é误" 12491 }, 12492 runtime: { 12493 code: 6, 12494 msg: "è¯æ³é误" 12495 }, 12496 timeout: { 12497 code: 7, 12498 msg: "ææ¾è¶ æ¶" 12499 }, 12500 other: { 12501 code: 8, 12502 msg: "å ¶ä»é误" 12503 } 12504 }, 12505 HAVE_NOTHING: "没æå ³äºé³é¢/è§é¢æ¯å¦å°±ç»ªçä¿¡æ¯", 12506 HAVE_METADATA: "é³é¢/è§é¢çå æ°æ®å·²å°±ç»ª", 12507 HAVE_CURRENT_DATA: "å ³äºå½åææ¾ä½ç½®çæ°æ®æ¯å¯ç¨çï¼ä½æ²¡æè¶³å¤çæ°æ®æ¥ææ¾ä¸ä¸å¸§/毫ç§", 12508 HAVE_FUTURE_DATA: "å½ååè³å°ä¸ä¸å¸§çæ°æ®æ¯å¯ç¨ç", 12509 HAVE_ENOUGH_DATA: "å¯ç¨æ°æ®è¶³ä»¥å¼å§ææ¾", 12510 NETWORK_EMPTY: "é³é¢/è§é¢å°æªåå§å", 12511 NETWORK_IDLE: "é³é¢/è§é¢æ¯æ´»å¨çä¸å·²éåèµæºï¼ä½å¹¶æªä½¿ç¨ç½ç»", 12512 NETWORK_LOADING: "æµè§å¨æ£å¨ä¸è½½æ°æ®", 12513 NETWORK_NO_SOURCE: "æªæ¾å°é³é¢/è§é¢æ¥æº", 12514 MEDIA_ERR_ABORTED: "ååè¿ç¨è¢«ç¨æ·ä¸æ¢", 12515 MEDIA_ERR_NETWORK: "ç½ç»é误", 12516 MEDIA_ERR_DECODE: "è§£ç é误", 12517 MEDIA_ERR_SRC_NOT_SUPPORTED: "䏿¯æçé³é¢/è§é¢æ ¼å¼", 12518 REPLAY: "éæ", 12519 ERROR: "ç½ç»è¿æ¥ä¼¼ä¹åºç°äºé®é¢", 12520 PLAY_TIPS: "ææ¾", 12521 PAUSE_TIPS: "æå", 12522 PLAYNEXT_TIPS: "ä¸ä¸é", 12523 DOWNLOAD_TIPS: "ä¸è½½", 12524 ROTATE_TIPS: "æè½¬", 12525 RELOAD_TIPS: "éæ°è½½å ¥", 12526 FULLSCREEN_TIPS: "è¿å ¥å ¨å±", 12527 EXITFULLSCREEN_TIPS: "éåºå ¨å±", 12528 CSSFULLSCREEN_TIPS: "è¿å ¥æ ·å¼å ¨å±", 12529 EXITCSSFULLSCREEN_TIPS: "éåºæ ·å¼å ¨å±", 12530 TEXTTRACK: "åå¹", 12531 PIP: "ç»ä¸ç»", 12532 SCREENSHOT: "æªå¾", 12533 LIVE: "æ£å¨ç´æ", 12534 OFF: "å ³é", 12535 OPEN: "å¼å¯", 12536 MINI_DRAG: "ç¹å»æä½å¯æå¨è§é¢", 12537 MINISCREEN: "å°å±å¹", 12538 REFRESH_TIPS: "请è¯è¯", 12539 REFRESH: "å·æ°", 12540 FORWARD: "å¿«è¿ä¸", 12541 LIVE_TIP: "ç´æ" 12542 } 12543 }); 12544 var Vn = r((function e(t, i) { 12545 var o, r, s; 12546 n(this, e); 12547 var a = i && "mobile" === i.isMobileSimulateMode 12548 , l = i.isLive 12549 , c = [].concat(l ? [] : [Ri, Pn, En, Ui], [Mi, Bi, Ki, tn, gn, vn, sn, an, qi, Qi]) 12550 , u = [Ft, Ht, Gt, Li, Wt, bn, Cn, Sn, ni]; 12551 this.plugins = [Nn, jt].concat(g(c), u, [Fn, Hn]); 12552 var h = a ? "mobile" : O.device; 12553 switch (h) { 12554 case "pc": 12555 (o = this.plugins).push.apply(o, [Si, si, kn, Bn, Un]); 12556 break; 12557 case "mobile": 12558 (r = this.plugins).push.apply(r, [Ti]); 12559 break; 12560 default: 12561 (s = this.plugins).push.apply(s, [Si, si, kn]) 12562 } 12563 (O.os.isIpad || "pc" === h) && this.plugins.push(Dn), 12564 O.os.isIpad && this.plugins.push(si), 12565 this.ignores = [], 12566 this.i18n = [] 12567 } 12568 )) 12569 , Gn = function(e) { 12570 a(i, e); 12571 var t = d(i); 12572 function i() { 12573 return n(this, i), 12574 t.apply(this, arguments) 12575 } 12576 return r(i) 12577 }(St); 12578 return s(Gn, "defaultPreset", Vn), 12579 s(Gn, "Util", x), 12580 s(Gn, "Sniffer", O), 12581 s(Gn, "Errors", j), 12582 s(Gn, "Events", Pe), 12583 s(Gn, "Plugin", ot), 12584 s(Gn, "BasePlugin", Ke), 12585 s(Gn, "I18N", wt), 12586 s(Gn, "STATE_CLASS", lt), 12587 Gn 12588} 12589)); 12590//# sourceMappingURL=index.min.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.