!
function(e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("DPlayer", [], t) : "object" == typeof exports ? exports.DPlayer = t() : e.DPlayer = t()
} (window,
function() {
return function(e) {
var t = {};
function n(i) {
if (t[i]) return t[i].exports;
var a = t[i] = {
i: i,
l: !1,
exports: {}
};
return e[i].call(a.exports, a, a.exports, n),
a.l = !0,
a.exports
}
return n.m = e,
n.c = t,
n.d = function(e, t, i) {
n.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: i
})
},
n.r = function(e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}),
Object.defineProperty(e, "__esModule", {
value: !0
})
},
n.t = function(e, t) {
if (1 & t && (e = n(e)), 8 & t) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var i = Object.create(null);
if (n.r(i), Object.defineProperty(i, "default", {
enumerable: !0,
value: e
}), 2 & t && "string" != typeof e) for (var a in e) n.d(i, a,
function(t) {
return e[t]
}.bind(null, a));
return i
},
n.n = function(e) {
var t = e && e.__esModule ?
function() {
return e.
default
}:
function() {
return e
};
return n.d(t, "a", t),
t
},
n.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
},
n.p = "/",
n(n.s = 53)
} ([function(e, t, n) {
"use strict";
function i(e) {
return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
function(e) {
return typeof e
}: function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
})(e)
}
var a = n(5),
o = n(37),
r = Object.prototype.toString;
function s(e) {
return "[object Array]" === r.call(e)
}
function l(e) {
return null !== e && "object" === i(e)
}
function c(e) {
return "[object Function]" === r.call(e)
}
function u(e, t) {
if (null != e) if ("object" !== i(e) && (e = [e]), s(e)) for (var n = 0,
a = e.length; n < a; n++) t.call(null, e[n], n, e);
else for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.call(null, e[o], o, e)
}
e.exports = {
isArray: s,
isArrayBuffer: function(e) {
return "[object ArrayBuffer]" === r.call(e)
},
isBuffer: o,
isFormData: function(e) {
return "undefined" != typeof FormData && e instanceof FormData
},
isArrayBufferView: function(e) {
return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer
},
isString: function(e) {
return "string" == typeof e
},
isNumber: function(e) {
return "number" == typeof e
},
isObject: l,
isUndefined: function(e) {
return void 0 === e
},
isDate: function(e) {
return "[object Date]" === r.call(e)
},
isFile: function(e) {
return "[object File]" === r.call(e)
},
isBlob: function(e) {
return "[object Blob]" === r.call(e)
},
isFunction: c,
isStream: function(e) {
return l(e) && c(e.pipe)
},
isURLSearchParams: function(e) {
return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams
},
isStandardBrowserEnv: function() {
return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && "undefined" != typeof window && "undefined" != typeof document
},
forEach: u,
merge: function e() {
var t = {};
function n(n, a) {
"object" === i(t[a]) && "object" === i(n) ? t[a] = e(t[a], n) : t[a] = n
}
for (var a = 0,
o = arguments.length; a < o; a++) u(arguments[a], n);
return t
},
deepMerge: function e() {
var t = {};
function n(n, a) {
"object" === i(t[a]) && "object" === i(n) ? t[a] = e(t[a], n) : "object" === i(n) ? t[a] = e({},
n) : t[a] = n
}
for (var a = 0,
o = arguments.length; a < o; a++) u(arguments[a], n);
return t
},
extend: function(e, t, n) {
return u(t,
function(t, i) {
e[i] = n && "function" == typeof t ? a(t, n) : t
}),
e
},
trim: function(e) {
return e.replace(/^\s*/, "").replace(/\s*$/, "")
}
}
},
function(e, t, n) {
var i = n(13);
e.exports = function(e) {
"use strict";
var t = "",
n = (e = e || {}).enableSubtitle,
a = e.subtitle,
o = e.current,
r = e.pic,
s = i.$escape,
l = e.screenshot,
c = e.preload,
u = e.url;
n = a && "webvtt" === a.type;
return t += '\n"
}
},
function(e, t, n) {
e.exports = n(36)
},
function(e, t) {
function n(e) {
return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
function(e) {
return typeof e
}: function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
})(e)
}
var i;
i = function() {
return this
} ();
try {
i = i || new Function("return this")()
} catch(e) {
"object" === ("undefined" == typeof window ? "undefined": n(window)) && (i = window)
}
e.exports = i
},
function(e, t) {
var n, i, a = e.exports = {};
function o() {
throw new Error("setTimeout has not been defined")
}
function r() {
throw new Error("clearTimeout has not been defined")
}
function s(e) {
if (n === setTimeout) return setTimeout(e, 0);
if ((n === o || !n) && setTimeout) return n = setTimeout,
setTimeout(e, 0);
try {
return n(e, 0)
} catch(t) {
try {
return n.call(null, e, 0)
} catch(t) {
return n.call(this, e, 0)
}
}
} !
function() {
try {
n = "function" == typeof setTimeout ? setTimeout: o
} catch(e) {
n = o
}
try {
i = "function" == typeof clearTimeout ? clearTimeout: r
} catch(e) {
i = r
}
} ();
var l, c = [],
u = !1,
d = -1;
function p() {
u && l && (u = !1, l.length ? c = l.concat(c) : d = -1, c.length && h())
}
function h() {
if (!u) {
var e = s(p);
u = !0;
for (var t = c.length; t;) {
for (l = c, c = []; ++d < t;) l && l[d].run();
d = -1,
t = c.length
}
l = null,
u = !1,
function(e) {
if (i === clearTimeout) return clearTimeout(e);
if ((i === r || !i) && clearTimeout) return i = clearTimeout,
clearTimeout(e);
try {
i(e)
} catch(t) {
try {
return i.call(null, e)
} catch(t) {
return i.call(this, e)
}
}
} (e)
}
}
function m(e, t) {
this.fun = e,
this.array = t
}
function y() {}
a.nextTick = function(e) {
var t = new Array(arguments.length - 1);
if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
c.push(new m(e, t)),
1 !== c.length || u || s(h)
},
m.prototype.run = function() {
this.fun.apply(null, this.array)
},
a.title = "browser",
a.browser = !0,
a.env = {},
a.argv = [],
a.version = "",
a.versions = {},
a.on = y,
a.addListener = y,
a.once = y,
a.off = y,
a.removeListener = y,
a.removeAllListeners = y,
a.emit = y,
a.prependListener = y,
a.prependOnceListener = y,
a.listeners = function(e) {
return []
},
a.binding = function(e) {
throw new Error("process.binding is not supported")
},
a.cwd = function() {
return "/"
},
a.chdir = function(e) {
throw new Error("process.chdir is not supported")
},
a.umask = function() {
return 0
}
},
function(e, t, n) {
"use strict";
e.exports = function(e, t) {
return function() {
for (var n = new Array(arguments.length), i = 0; i < n.length; i++) n[i] = arguments[i];
return e.apply(t, n)
}
}
},
function(e, t, n) {
"use strict";
var i = n(0);
function a(e) {
return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]")
}
e.exports = function(e, t, n) {
if (!t) return e;
var o;
if (n) o = n(t);
else if (i.isURLSearchParams(t)) o = t.toString();
else {
var r = [];
i.forEach(t,
function(e, t) {
null != e && (i.isArray(e) ? t += "[]": e = [e], i.forEach(e,
function(e) {
i.isDate(e) ? e = e.toISOString() : i.isObject(e) && (e = JSON.stringify(e)),
r.push(a(t) + "=" + a(e))
}))
}),
o = r.join("&")
}
if (o) {
var s = e.indexOf("#"); - 1 !== s && (e = e.slice(0, s)),
e += ( - 1 === e.indexOf("?") ? "?": "&") + o
}
return e
}
},
function(e, t, n) {
"use strict";
e.exports = function(e) {
return ! (!e || !e.__CANCEL__)
}
},
function(e, t, n) {
"use strict"; (function(t) {
var i = n(0),
a = n(42),
o = {
"Content-Type": "application/x-www-form-urlencoded"
};
function r(e, t) { ! i.isUndefined(e) && i.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t)
}
var s, l = {
adapter: (void 0 !== t && "[object process]" === Object.prototype.toString.call(t) ? s = n(9) : "undefined" != typeof XMLHttpRequest && (s = n(9)), s),
transformRequest: [function(e, t) {
return a(t, "Accept"),
a(t, "Content-Type"),
i.isFormData(e) || i.isArrayBuffer(e) || i.isBuffer(e) || i.isStream(e) || i.isFile(e) || i.isBlob(e) ? e: i.isArrayBufferView(e) ? e.buffer: i.isURLSearchParams(e) ? (r(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : i.isObject(e) ? (r(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e
}],
transformResponse: [function(e) {
if ("string" == typeof e) try {
e = JSON.parse(e)
} catch(e) {}
return e
}],
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
validateStatus: function(e) {
return e >= 200 && e < 300
}
};
l.headers = {
common: {
Accept: "application/json, text/plain, */*"
}
},
i.forEach(["delete", "get", "head"],
function(e) {
l.headers[e] = {}
}),
i.forEach(["post", "put", "patch"],
function(e) {
l.headers[e] = i.merge(o)
}),
e.exports = l
}).call(this, n(4))
},
function(e, t, n) {
"use strict";
var i = n(0),
a = n(43),
o = n(6),
r = n(45),
s = n(46),
l = n(10);
e.exports = function(e) {
return new Promise(function(t, c) {
var u = e.data,
d = e.headers;
i.isFormData(u) && delete d["Content-Type"];
var p = new XMLHttpRequest;
if (e.auth) {
var h = e.auth.username || "",
m = e.auth.password || "";
d.Authorization = "Basic " + btoa(h + ":" + m)
}
if (p.open(e.method.toUpperCase(), o(e.url, e.params, e.paramsSerializer), !0), p.timeout = e.timeout, p.onreadystatechange = function() {
if (p && 4 === p.readyState && (0 !== p.status || p.responseURL && 0 === p.responseURL.indexOf("file:"))) {
var n = "getAllResponseHeaders" in p ? r(p.getAllResponseHeaders()) : null,
i = {
data: e.responseType && "text" !== e.responseType ? p.response: p.responseText,
status: p.status,
statusText: p.statusText,
headers: n,
config: e,
request: p
};
a(t, c, i),
p = null
}
},
p.onabort = function() {
p && (c(l("Request aborted", e, "ECONNABORTED", p)), p = null)
},
p.onerror = function() {
c(l("Network Error", e, null, p)),
p = null
},
p.ontimeout = function() {
c(l("timeout of " + e.timeout + "ms exceeded", e, "ECONNABORTED", p)),
p = null
},
i.isStandardBrowserEnv()) {
var y = n(47),
f = (e.withCredentials || s(e.url)) && e.xsrfCookieName ? y.read(e.xsrfCookieName) : void 0;
f && (d[e.xsrfHeaderName] = f)
}
if ("setRequestHeader" in p && i.forEach(d,
function(e, t) {
void 0 === u && "content-type" === t.toLowerCase() ? delete d[t] : p.setRequestHeader(t, e)
}), e.withCredentials && (p.withCredentials = !0), e.responseType) try {
p.responseType = e.responseType
} catch(t) {
if ("json" !== e.responseType) throw t
}
"function" == typeof e.onDownloadProgress && p.addEventListener("progress", e.onDownloadProgress),
"function" == typeof e.onUploadProgress && p.upload && p.upload.addEventListener("progress", e.onUploadProgress),
e.cancelToken && e.cancelToken.promise.then(function(e) {
p && (p.abort(), c(e), p = null)
}),
void 0 === u && (u = null),
p.send(u)
})
}
},
function(e, t, n) {
"use strict";
var i = n(44);
e.exports = function(e, t, n, a, o) {
var r = new Error(e);
return i(r, t, n, a, o)
}
},
function(e, t, n) {
"use strict";
var i = n(0);
e.exports = function(e, t) {
t = t || {};
var n = {};
return i.forEach(["url", "method", "params", "data"],
function(e) {
void 0 !== t[e] && (n[e] = t[e])
}),
i.forEach(["headers", "auth", "proxy"],
function(a) {
i.isObject(t[a]) ? n[a] = i.deepMerge(e[a], t[a]) : void 0 !== t[a] ? n[a] = t[a] : i.isObject(e[a]) ? n[a] = i.deepMerge(e[a]) : void 0 !== e[a] && (n[a] = e[a])
}),
i.forEach(["baseURL", "transformRequest", "transformResponse", "paramsSerializer", "timeout", "withCredentials", "adapter", "responseType", "xsrfCookieName", "xsrfHeaderName", "onUploadProgress", "onDownloadProgress", "maxContentLength", "validateStatus", "maxRedirects", "httpAgent", "httpsAgent", "cancelToken", "socketPath"],
function(i) {
void 0 !== t[i] ? n[i] = t[i] : void 0 !== e[i] && (n[i] = e[i])
}),
n
}
},
function(e, t, n) {
"use strict";
function i(e) {
this.message = e
}
i.prototype.toString = function() {
return "Cancel" + (this.message ? ": " + this.message: "")
},
i.prototype.__CANCEL__ = !0,
e.exports = i
},
function(e, t, n) {
"use strict";
e.exports = n(52)
},
function(e, t, n) {
"use strict"; (function(e) {
var i = n(15);
function a(e) {
return (a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
function(e) {
return typeof e
}: function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
})(e)
}
var o = setTimeout;
function r() {}
function s(e) {
if (! (this instanceof s)) throw new TypeError("Promises must be constructed via new");
if ("function" != typeof e) throw new TypeError("not a function");
this._state = 0,
this._handled = !1,
this._value = void 0,
this._deferreds = [],
h(e, this)
}
function l(e, t) {
for (; 3 === e._state;) e = e._value;
0 !== e._state ? (e._handled = !0, s._immediateFn(function() {
var n = 1 === e._state ? t.onFulfilled: t.onRejected;
if (null !== n) {
var i;
try {
i = n(e._value)
} catch(e) {
return void u(t.promise, e)
}
c(t.promise, i)
} else(1 === e._state ? c: u)(t.promise, e._value)
})) : e._deferreds.push(t)
}
function c(e, t) {
try {
if (t === e) throw new TypeError("A promise cannot be resolved with itself.");
if (t && ("object" === a(t) || "function" == typeof t)) {
var n = t.then;
if (t instanceof s) return e._state = 3,
e._value = t,
void d(e);
if ("function" == typeof n) return void h((i = n, o = t,
function() {
i.apply(o, arguments)
}), e)
}
e._state = 1,
e._value = t,
d(e)
} catch(t) {
u(e, t)
}
var i, o
}
function u(e, t) {
e._state = 2,
e._value = t,
d(e)
}
function d(e) {
2 === e._state && 0 === e._deferreds.length && s._immediateFn(function() {
e._handled || s._unhandledRejectionFn(e._value)
});
for (var t = 0,
n = e._deferreds.length; t < n; t++) l(e, e._deferreds[t]);
e._deferreds = null
}
function p(e, t, n) {
this.onFulfilled = "function" == typeof e ? e: null,
this.onRejected = "function" == typeof t ? t: null,
this.promise = n
}
function h(e, t) {
var n = !1;
try {
e(function(e) {
n || (n = !0, c(t, e))
},
function(e) {
n || (n = !0, u(t, e))
})
} catch(e) {
if (n) return;
n = !0,
u(t, e)
}
}
s.prototype.
catch = function(e) {
return this.then(null, e)
},
s.prototype.then = function(e, t) {
var n = new this.constructor(r);
return l(this, new p(e, t, n)),
n
},
s.prototype.
finally = i.a,
s.all = function(e) {
return new s(function(t, n) {
if (!e || void 0 === e.length) throw new TypeError("Promise.all accepts an array");
var i = Array.prototype.slice.call(e);
if (0 === i.length) return t([]);
var o = i.length;
function r(e, s) {
try {
if (s && ("object" === a(s) || "function" == typeof s)) {
var l = s.then;
if ("function" == typeof l) return void l.call(s,
function(t) {
r(e, t)
},
n)
}
i[e] = s,
0 == --o && t(i)
} catch(e) {
n(e)
}
}
for (var s = 0; s < i.length; s++) r(s, i[s])
})
},
s.resolve = function(e) {
return e && "object" === a(e) && e.constructor === s ? e: new s(function(t) {
t(e)
})
},
s.reject = function(e) {
return new s(function(t, n) {
n(e)
})
},
s.race = function(e) {
return new s(function(t, n) {
for (var i = 0,
a = e.length; i < a; i++) e[i].then(t, n)
})
},
s._immediateFn = "function" == typeof e &&
function(t) {
e(t)
} ||
function(e) {
o(e, 0)
},
s._unhandledRejectionFn = function(e) {
"undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", e)
},
t.a = s
}).call(this, n(34).setImmediate)
},
function(e, t, n) {
"use strict";
t.a = function(e) {
var t = this.constructor;
return this.then(function(n) {
return t.resolve(e()).then(function() {
return n
})
},
function(n) {
return t.resolve(e()).then(function() {
return t.reject(n)
})
})
}
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t) {
e.exports = ''
},
function(e, t, n) {
var i = n(13);
e.exports = function(e) {
"use strict";
e = e || {};
var t, a = "",
o = (arguments[1], e.video),
r = e.options,
s = i.$escape,
l = e.tran,
c = e.icons,
u = e.index,
d = i.$each;
e.$value,
e.$index;
return a += '
\n\n ',
t = n(1)(o),
a += t,
a += "\n ",
r.logo && (a += '\n
\n
\n
\n '),
a += '\n
\n
\n
\n \n ',
r.danmaku && (a += '\n ', a += s(l("Danmaku is loading")), a += "\n "),
a += '\n ',
a += c.loading,
a += '\n
\n
\n\n\n \n
\n
\n
\n
\n
\n
\n
\n 0:00 /\n 0:00\n \n ',
r.live && (a += '\n
', a += s(l("Live")), a += "\n "),
a += '\n
\n
\n ',
r.video.quality && (a += '\n
\n
\n
\n
\n ', d(r.video.quality,
function(e, t) {
a += '\n
',
a += s(e.name),
a += "
\n "
}), a += "\n
\n
\n
\n "),
a += "\n ",
r.screenshot && (a += '\n
\n ', a += c.camera, a += "\n
\n "),
a += '\n \n ",
r.subtitle && (a += '\n
\n \n
\n "),
a += '\n
\n
\n
\n
\n
\n
',
a += s(l("Speed")),
a += '\n
',
a += c.right,
a += '
\n
\n
\n
',
a += s(l("Loop")),
a += '\n
\n \n \n
\n
\n
\n
',
a += s(l("Show danmaku")),
a += '\n
\n \n \n
\n
\n
\n
',
a += s(l("Unlimited danmaku")),
a += '\n
\n \n \n
\n
\n
\n
',
a += s(l("Opacity for danmaku")),
a += '\n
\n
\n
\n
\n
\n 0.5\n
\n
\n 0.75\n
\n
\n ',
a += s(l("Normal")),
a += '\n
\n
\n 1.25\n
\n
\n 1.5\n
\n
\n 2\n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n\n
[x]
\n
\n Player version\n \n
\n
\n Player FPS\n \n
\n
\n Video type\n \n
\n
\n Video url\n \n
\n
\n Video resolution\n \n
\n
\n Video duration\n \n
\n ',
r.danmaku && (a += '\n
\n Danamku id\n \n
\n
\n Danamku api\n \n
\n
\n Danamku amount\n \n
\n '),
a += '\n
\n\n'
}
},
function(e, t, n) {},
function(e, t, n) {
var i = Function.prototype.apply;
function a(e, t) {
this._id = e,
this._clearFn = t
}
t.setTimeout = function() {
return new a(i.call(setTimeout, window, arguments), clearTimeout)
},
t.setInterval = function() {
return new a(i.call(setInterval, window, arguments), clearInterval)
},
t.clearTimeout = t.clearInterval = function(e) {
e && e.close()
},
a.prototype.unref = a.prototype.ref = function() {},
a.prototype.close = function() {
this._clearFn.call(window, this._id)
},
t.enroll = function(e, t) {
clearTimeout(e._idleTimeoutId),
e._idleTimeout = t
},
t.unenroll = function(e) {
clearTimeout(e._idleTimeoutId),
e._idleTimeout = -1
},
t._unrefActive = t.active = function(e) {
clearTimeout(e._idleTimeoutId);
var t = e._idleTimeout;
t >= 0 && (e._idleTimeoutId = setTimeout(function() {
e._onTimeout && e._onTimeout()
},
t))
},
n(35),
t.setImmediate = setImmediate,
t.clearImmediate = clearImmediate
},
function(e, t, n) { (function(e, t) { !
function(e, n) {
"use strict";
if (!e.setImmediate) {
var i, a, o, r, s, l = 1,
c = {},
u = !1,
d = e.document,
p = Object.getPrototypeOf && Object.getPrototypeOf(e);
p = p && p.setTimeout ? p: e,
"[object process]" === {}.toString.call(e.process) ? i = function(e) {
t.nextTick(function() {
m(e)
})
}: !
function() {
if (e.postMessage && !e.importScripts) {
var t = !0,
n = e.onmessage;
return e.onmessage = function() {
t = !1
},
e.postMessage("", "*"),
e.onmessage = n,
t
}
} () ? e.MessageChannel ? ((o = new MessageChannel).port1.onmessage = function(e) {
m(e.data)
},
i = function(e) {
o.port2.postMessage(e)
}) : d && "onreadystatechange" in d.createElement("script") ? (a = d.documentElement, i = function(e) {
var t = d.createElement("script");
t.onreadystatechange = function() {
m(e),
t.onreadystatechange = null,
a.removeChild(t),
t = null
},
a.appendChild(t)
}) : i = function(e) {
setTimeout(m, 0, e)
}: (r = "setImmediate$" + Math.random() + "$", s = function(t) {
t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(r) && m( + t.data.slice(r.length))
},
e.addEventListener ? e.addEventListener("message", s, !1) : e.attachEvent("onmessage", s), i = function(t) {
e.postMessage(r + t, "*")
}),
p.setImmediate = function(e) {
"function" != typeof e && (e = new Function("" + e));
for (var t = new Array(arguments.length - 1), n = 0; n < t.length; n++) t[n] = arguments[n + 1];
var a = {
callback: e,
args: t
};
return c[l] = a,
i(l),
l++
},
p.clearImmediate = h
}
function h(e) {
delete c[e]
}
function m(e) {
if (u) setTimeout(m, 0, e);
else {
var t = c[e];
if (t) {
u = !0;
try { !
function(e) {
var t = e.callback,
i = e.args;
switch (i.length) {
case 0:
t();
break;
case 1:
t(i[0]);
break;
case 2:
t(i[0], i[1]);
break;
case 3:
t(i[0], i[1], i[2]);
break;
default:
t.apply(n, i)
}
} (t)
} finally {
h(e),
u = !1
}
}
}
}
} ("undefined" == typeof self ? void 0 === e ? this: e: self)
}).call(this, n(3), n(4))
},
function(e, t, n) {
"use strict";
var i = n(0),
a = n(5),
o = n(38),
r = n(11);
function s(e) {
var t = new o(e),
n = a(o.prototype.request, t);
return i.extend(n, o.prototype, t),
i.extend(n, t),
n
}
var l = s(n(8));
l.Axios = o,
l.create = function(e) {
return s(r(l.defaults, e))
},
l.Cancel = n(12),
l.CancelToken = n(50),
l.isCancel = n(7),
l.all = function(e) {
return Promise.all(e)
},
l.spread = n(51),
e.exports = l,
e.exports.
default = l
},
function(e, t) {
e.exports = function(e) {
return null != e && null != e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
}
},
function(e, t, n) {
"use strict";
var i = n(0),
a = n(6),
o = n(39),
r = n(40),
s = n(11);
function l(e) {
this.defaults = e,
this.interceptors = {
request: new o,
response: new o
}
}
l.prototype.request = function(e) {
"string" == typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {},
(e = s(this.defaults, e)).method = e.method ? e.method.toLowerCase() : "get";
var t = [r, void 0],
n = Promise.resolve(e);
for (this.interceptors.request.forEach(function(e) {
t.unshift(e.fulfilled, e.rejected)
}), this.interceptors.response.forEach(function(e) {
t.push(e.fulfilled, e.rejected)
}); t.length;) n = n.then(t.shift(), t.shift());
return n
},
l.prototype.getUri = function(e) {
return e = s(this.defaults, e),
a(e.url, e.params, e.paramsSerializer).replace(/^\?/, "")
},
i.forEach(["delete", "get", "head", "options"],
function(e) {
l.prototype[e] = function(t, n) {
return this.request(i.merge(n || {},
{
method: e,
url: t
}))
}
}),
i.forEach(["post", "put", "patch"],
function(e) {
l.prototype[e] = function(t, n, a) {
return this.request(i.merge(a || {},
{
method: e,
url: t,
data: n
}))
}
}),
e.exports = l
},
function(e, t, n) {
"use strict";
var i = n(0);
function a() {
this.handlers = []
}
a.prototype.use = function(e, t) {
return this.handlers.push({
fulfilled: e,
rejected: t
}),
this.handlers.length - 1
},
a.prototype.eject = function(e) {
this.handlers[e] && (this.handlers[e] = null)
},
a.prototype.forEach = function(e) {
i.forEach(this.handlers,
function(t) {
null !== t && e(t)
})
},
e.exports = a
},
function(e, t, n) {
"use strict";
var i = n(0),
a = n(41),
o = n(7),
r = n(8),
s = n(48),
l = n(49);
function c(e) {
e.cancelToken && e.cancelToken.throwIfRequested()
}
e.exports = function(e) {
return c(e),
e.baseURL && !s(e.url) && (e.url = l(e.baseURL, e.url)),
e.headers = e.headers || {},
e.data = a(e.data, e.headers, e.transformRequest),
e.headers = i.merge(e.headers.common || {},
e.headers[e.method] || {},
e.headers || {}),
i.forEach(["delete", "get", "head", "post", "put", "patch", "common"],
function(t) {
delete e.headers[t]
}),
(e.adapter || r.adapter)(e).then(function(t) {
return c(e),
t.data = a(t.data, t.headers, e.transformResponse),
t
},
function(t) {
return o(t) || (c(e), t && t.response && (t.response.data = a(t.response.data, t.response.headers, e.transformResponse))),
Promise.reject(t)
})
}
},
function(e, t, n) {
"use strict";
var i = n(0);
e.exports = function(e, t, n) {
return i.forEach(n,
function(n) {
e = n(e, t)
}),
e
}
},
function(e, t, n) {
"use strict";
var i = n(0);
e.exports = function(e, t) {
i.forEach(e,
function(n, i) {
i !== t && i.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[i])
})
}
},
function(e, t, n) {
"use strict";
var i = n(10);
e.exports = function(e, t, n) {
var a = n.config.validateStatus; ! a || a(n.status) ? e(n) : t(i("Request failed with status code " + n.status, n.config, null, n.request, n))
}
},
function(e, t, n) {
"use strict";
e.exports = function(e, t, n, i, a) {
return e.config = t,
n && (e.code = n),
e.request = i,
e.response = a,
e.isAxiosError = !0,
e.toJSON = function() {
return {
message: this.message,
name: this.name,
description: this.description,
number: this.number,
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
config: this.config,
code: this.code
}
},
e
}
},
function(e, t, n) {
"use strict";
var i = n(0),
a = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"];
e.exports = function(e) {
var t, n, o, r = {};
return e ? (i.forEach(e.split("\n"),
function(e) {
if (o = e.indexOf(":"), t = i.trim(e.substr(0, o)).toLowerCase(), n = i.trim(e.substr(o + 1)), t) {
if (r[t] && a.indexOf(t) >= 0) return;
r[t] = "set-cookie" === t ? (r[t] ? r[t] : []).concat([n]) : r[t] ? r[t] + ", " + n: n
}
}), r) : r
}
},
function(e, t, n) {
"use strict";
var i = n(0);
e.exports = i.isStandardBrowserEnv() ?
function() {
var e, t = /(msie|trident)/i.test(navigator.userAgent),
n = document.createElement("a");
function a(e) {
var i = e;
return t && (n.setAttribute("href", i), i = n.href),
n.setAttribute("href", i),
{
href: n.href,
protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
host: n.host,
search: n.search ? n.search.replace(/^\?/, "") : "",
hash: n.hash ? n.hash.replace(/^#/, "") : "",
hostname: n.hostname,
port: n.port,
pathname: "/" === n.pathname.charAt(0) ? n.pathname: "/" + n.pathname
}
}
return e = a(window.location.href),
function(t) {
var n = i.isString(t) ? a(t) : t;
return n.protocol === e.protocol && n.host === e.host
}
} () : function() {
return ! 0
}
},
function(e, t, n) {
"use strict";
var i = n(0);
e.exports = i.isStandardBrowserEnv() ? {
write: function(e, t, n, a, o, r) {
var s = [];
s.push(e + "=" + encodeURIComponent(t)),
i.isNumber(n) && s.push("expires=" + new Date(n).toGMTString()),
i.isString(a) && s.push("path=" + a),
i.isString(o) && s.push("domain=" + o),
!0 === r && s.push("secure"),
document.cookie = s.join("; ")
},
read: function(e) {
var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
return t ? decodeURIComponent(t[3]) : null
},
remove: function(e) {
this.write(e, "", Date.now() - 864e5)
}
}: {
write: function() {},
read: function() {
return null
},
remove: function() {}
}
},
function(e, t, n) {
"use strict";
e.exports = function(e) {
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)
}
},
function(e, t, n) {
"use strict";
e.exports = function(e, t) {
return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e
}
},
function(e, t, n) {
"use strict";
var i = n(12);
function a(e) {
if ("function" != typeof e) throw new TypeError("executor must be a function.");
var t;
this.promise = new Promise(function(e) {
t = e
});
var n = this;
e(function(e) {
n.reason || (n.reason = new i(e), t(n.reason))
})
}
a.prototype.throwIfRequested = function() {
if (this.reason) throw this.reason
},
a.source = function() {
var e;
return {
token: new a(function(t) {
e = t
}),
cancel: e
}
},
e.exports = a
},
function(e, t, n) {
"use strict";
e.exports = function(e) {
return function(t) {
return e.apply(null, t)
}
}
},
function(e, t, n) {
"use strict"; (function(t) {
var n = "undefined" != typeof self ? self: "undefined" != typeof window ? window: void 0 !== t ? t: {},
i = Object.create(n),
a = /["&'<>]/;
i.$escape = function(e) {
return function(e) {
var t = "" + e,
n = a.exec(t);
if (!n) return e;
var i = "",
o = void 0,
r = void 0,
s = void 0;
for (o = n.index, r = 0; o < t.length; o++) {
switch (t.charCodeAt(o)) {
case 34:
s = """;
break;
case 38:
s = "&";
break;
case 39:
s = "'";
break;
case 60:
s = "<";
break;
case 62:
s = ">";
break;
default:
continue
}
r !== o && (i += t.substring(r, o)),
r = o + 1,
i += s
}
return r !== o ? i + t.substring(r, o) : i
} (function e(t) {
"string" != typeof t && (t = null == t ? "": "function" == typeof t ? e(t.call(t)) : JSON.stringify(t));
return t
} (e))
},
i.$each = function(e, t) {
if (Array.isArray(e)) for (var n = 0,
i = e.length; n < i; n++) t(e[n], n);
else for (var a in e) t(e[a], a)
},
e.exports = i
}).call(this, n(3))
},
function(e, t, n) {
"use strict";
n.r(t);
n(33);
var i = n(14),
a = /mobile/i.test(window.navigator.userAgent),
o = {
secondToTime: function(e) {
var t = Math.floor(e / 3600),
n = Math.floor((e - 3600 * t) / 60),
i = Math.floor(e - 3600 * t - 60 * n);
return (t > 0 ? [t, n, i] : [n, i]).map(function(e) {
return e < 10 ? "0" + e: "" + e
}).join(":")
},
getElementViewLeft: function(e) {
var t = e.offsetLeft,
n = e.offsetParent,
i = document.body.scrollLeft + document.documentElement.scrollLeft;
if (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement) for (; null !== n && n !== e;) t += n.offsetLeft,
n = n.offsetParent;
else for (; null !== n;) t += n.offsetLeft,
n = n.offsetParent;
return t - i
},
getBoundingClientRectViewLeft: function(e) {
var t = window.scrollY || window.pageYOffset || document.body.scrollTop + (document.documentElement && document.documentElement.scrollTop || 0);
if (e.getBoundingClientRect) {
if ("number" != typeof this.getBoundingClientRectViewLeft.offset) {
var n = document.createElement("div");
n.style.cssText = "position:absolute;top:0;left:0;",
document.body.appendChild(n),
this.getBoundingClientRectViewLeft.offset = -n.getBoundingClientRect().top - t,
document.body.removeChild(n),
n = null
}
var i = e.getBoundingClientRect(),
a = this.getBoundingClientRectViewLeft.offset;
return i.left + a
}
return this.getElementViewLeft(e)
},
getScrollPosition: function() {
return {
left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
}
},
setScrollPosition: function(e) {
var t = e.left,
n = void 0 === t ? 0 : t,
i = e.top,
a = void 0 === i ? 0 : i;
this.isFirefox ? (document.documentElement.scrollLeft = n, document.documentElement.scrollTop = a) : window.scrollTo(n, a)
},
isMobile: a,
isFirefox: /firefox/i.test(window.navigator.userAgent),
isChrome: /chrome/i.test(window.navigator.userAgent),
storage: {
set: function(e, t) {
localStorage.setItem(e, t)
},
get: function(e) {
return localStorage.getItem(e)
}
},
cumulativeOffset: function(e) {
var t = 0,
n = 0;
do {
t += e.offsetTop || 0, n += e.offsetLeft || 0, e = e.offsetParent
} while ( e );
return {
top: t,
left: n
}
},
nameMap: {
dragStart: a ? "touchstart": "mousedown",
dragMove: a ? "touchmove": "mousemove",
dragEnd: a ? "touchend": "mouseup"
},
color2Number: function(e) {
return "#" === e[0] && (e = e.substr(1)),
3 === e.length && (e = "".concat(e[0]).concat(e[0]).concat(e[1]).concat(e[1]).concat(e[2]).concat(e[2])),
parseInt(e, 16) + 0 & 16777215
},
number2Color: function(e) {
return "#" + ("00000" + e.toString(16)).slice( - 6)
},
number2Type: function(e) {
switch (e) {
case 0:
return "right";
case 1:
return "top";
case 2:
return "bottom";
default:
return "right"
}
}
},
r = n(2),
s = n.n(r),
l = {
send: function(e) {
s.a.post(e.url, e.data).then(function(t) {
var n = t.data;
n && 0 === n.code ? e.success && e.success(n) : e.error && e.error(n && n.msg)
}).
catch(function(t) {
console.error(t),
e.error && e.error()
})
},
read: function(e) {
s.a.get(e.url).then(function(t) {
var n = t.data;
n && 0 === n.code ? e.success && e.success(n.data.map(function(e) {
return {
time: e[0],
type: e[1],
color: e[2],
author: e[3],
text: e[4]
}
})) : e.error && e.error(n && n.msg)
}).
catch(function(t) {
console.error(t),
e.error && e.error()
})
}
};
function c(e) {
return (c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
function(e) {
return typeof e
}: function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
})(e)
}
var u = function(e) {
var t = {
container: e.element || document.getElementsByClassName("dplayer")[0],
live: !1,
autoplay: !1,
theme: "#b7daff",
loop: !1,
lang: (navigator.language || navigator.browserLanguage).toLowerCase(),
screenshot: !1,
hotkey: !0,
preload: "metadata",
volume: .7,
apiBackend: l,
video: {},
contextmenu: [],
mutex: !0
};
for (var n in t) t.hasOwnProperty(n) && !e.hasOwnProperty(n) && (e[n] = t[n]);
return e.video && !e.video.type && (e.video.type = "auto"),
"object" === c(e.danmaku) && e.danmaku && !e.danmaku.user && (e.danmaku.user = "DIYgod"),
e.subtitle && (!e.subtitle.type && (e.subtitle.type = "webvtt"), !e.subtitle.fontSize && (e.subtitle.fontSize = "20px"), !e.subtitle.bottom && (e.subtitle.bottom = "40px"), !e.subtitle.color && (e.subtitle.color = "#fff")),
e.video.quality && (e.video.url = e.video.quality[e.video.defaultQuality].url),
e.lang && (e.lang = e.lang.toLowerCase()),
e.contextmenu = e.contextmenu.concat([{
text: "Video info",
click: function(e) {
e.infoPanel.triggle()
}
},
{
text: "About author",
link: "https://diygod.me"
},
{
text: "DPlayer v".concat("1.25.0"),
link: "https://github.com/MoePlayer/DPlayer"
}]),
e
};
var d = {
"zh-cn": {
"Danmaku is loading": "弹幕加载中",
Top: "顶部",
Bottom: "底部",
Rolling: "滚动",
"Input danmaku, hit Enter": "输入弹幕,回车发送",
"About author": "关于作者",
"DPlayer feedback": "播放器意见反馈",
"About DPlayer": "关于 DPlayer 播放器",
Loop: "洗脑循环",
Speed: "速度",
"Opacity for danmaku": "弹幕透明度",
Normal: "正常",
"Please input danmaku content!": "要输入弹幕内容啊喂!",
"Set danmaku color": "设置弹幕颜色",
"Set danmaku type": "设置弹幕类型",
"Show danmaku": "显示弹幕",
"Video load failed": "视频加载失败",
"Danmaku load failed": "弹幕加载失败",
"Danmaku send failed": "弹幕发送失败",
"Switching to": "正在切换至",
"Switched to": "已经切换至",
quality: "画质",
FF: "快进",
REW: "快退",
"Unlimited danmaku": "海量弹幕",
"Send danmaku": "发送弹幕",
Setting: "设置",
"Full screen": "全屏",
"Web full screen": "页面全屏",
Send: "发送",
Screenshot: "截图",
s: "秒",
"Show subtitle": "显示字幕",
"Hide subtitle": "隐藏字幕",
Volume: "音量",
Live: "直播",
"Video info": "视频统计信息"
},
"zh-tw": {
"Danmaku is loading": "彈幕載入中",
Top: "頂部",
Bottom: "底部",
Rolling: "滾動",
"Input danmaku, hit Enter": "輸入彈幕,Enter 發送",
"About author": "關於作者",
"DPlayer feedback": "播放器意見回饋",
"About DPlayer": "關於 DPlayer 播放器",
Loop: "循環播放",
Speed: "速度",
"Opacity for danmaku": "彈幕透明度",
Normal: "正常",
"Please input danmaku content!": "請輸入彈幕內容啊!",
"Set danmaku color": "設定彈幕顏色",
"Set danmaku type": "設定彈幕類型",
"Show danmaku": "顯示彈幕",
"Video load failed": "影片載入失敗",
"Danmaku load failed": "彈幕載入失敗",
"Danmaku send failed": "彈幕發送失敗",
"Switching to": "正在切換至",
"Switched to": "已經切換至",
quality: "畫質",
FF: "快進",
REW: "快退",
"Unlimited danmaku": "巨量彈幕",
"Send danmaku": "發送彈幕",
Setting: "設定",
"Full screen": "全螢幕",
"Web full screen": "頁面全螢幕",
Send: "發送",
Screenshot: "截圖",
s: "秒",
"Show subtitle": "顯示字幕",
"Hide subtitle": "隱藏字幕",
Volume: "音量",
Live: "直播",
"Video info": "影片統計訊息"
}
},
p = function(e) {
var t = this;
this.lang = e,
this.tran = function(e) {
return d[t.lang] && d[t.lang][e] ? d[t.lang][e] : e
}
},
h = n(16),
m = n.n(h),
y = n(17),
f = n.n(y),
v = n(18),
g = n.n(v),
b = n(19),
w = n.n(b),
k = n(20),
x = n.n(k),
S = n(21),
T = n.n(S),
L = n(22),
E = n.n(L),
q = n(23),
B = n.n(q),
M = n(24),
C = n.n(M),
_ = n(25),
F = n.n(_),
P = n(26),
D = n.n(P),
z = n(27),
j = n.n(z),
O = n(28),
I = n.n(O),
R = n(29),
A = n.n(R),
W = n(30),
H = n.n(W),
N = n(31),
V = n.n(N),
U = {
play: m.a,
pause: f.a,
volumeUp: g.a,
volumeDown: w.a,
volumeOff: x.a,
full: T.a,
fullWeb: E.a,
setting: B.a,
right: C.a,
comment: F.a,
commentOff: D.a,
send: j.a,
pallette: I.a,
camera: A.a,
subtitle: H.a,
loading: V.a
},
X = n(32),
$ = n.n(X);
function Q(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var J = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.container = t.container,
this.options = t.options,
this.index = t.index,
this.tran = t.tran,
this.init()
}
var t, n, i;
return t = e,
(n = [{
key: "init",
value: function() {
this.container.innerHTML = $()({
options: this.options,
index: this.index,
tran: this.tran,
icons: U,
video: {
current: !0,
pic: this.options.video.pic,
screenshot: this.options.screenshot,
preload: this.options.preload,
url: this.options.video.url,
subtitle: this.options.subtitle
}
}),
this.volumeBar = this.container.querySelector(".dplayer-volume-bar-inner"),
this.volumeBarWrap = this.container.querySelector(".dplayer-volume-bar"),
this.volumeBarWrapWrap = this.container.querySelector(".dplayer-volume-bar-wrap"),
this.volumeButton = this.container.querySelector(".dplayer-volume"),
this.volumeButtonIcon = this.container.querySelector(".dplayer-volume-icon"),
this.volumeIcon = this.container.querySelector(".dplayer-volume-icon .dplayer-icon-content"),
this.playedBar = this.container.querySelector(".dplayer-played"),
this.loadedBar = this.container.querySelector(".dplayer-loaded"),
this.playedBarWrap = this.container.querySelector(".dplayer-bar-wrap"),
this.playedBarTime = this.container.querySelector(".dplayer-bar-time"),
this.danmaku = this.container.querySelector(".dplayer-danmaku"),
this.danmakuLoading = this.container.querySelector(".dplayer-danloading"),
this.video = this.container.querySelector(".dplayer-video-current"),
this.bezel = this.container.querySelector(".dplayer-bezel-icon"),
this.playButton = this.container.querySelector(".dplayer-play-icon"),
this.videoWrap = this.container.querySelector(".dplayer-video-wrap"),
this.controllerMask = this.container.querySelector(".dplayer-controller-mask"),
this.ptime = this.container.querySelector(".dplayer-ptime"),
this.settingButton = this.container.querySelector(".dplayer-setting-icon"),
this.settingBox = this.container.querySelector(".dplayer-setting-box"),
this.mask = this.container.querySelector(".dplayer-mask"),
this.loop = this.container.querySelector(".dplayer-setting-loop"),
this.loopToggle = this.container.querySelector(".dplayer-setting-loop .dplayer-toggle-setting-input"),
this.showDanmaku = this.container.querySelector(".dplayer-setting-showdan"),
this.showDanmakuToggle = this.container.querySelector(".dplayer-showdan-setting-input"),
this.unlimitDanmaku = this.container.querySelector(".dplayer-setting-danunlimit"),
this.unlimitDanmakuToggle = this.container.querySelector(".dplayer-danunlimit-setting-input"),
this.speed = this.container.querySelector(".dplayer-setting-speed"),
this.speedItem = this.container.querySelectorAll(".dplayer-setting-speed-item"),
this.danmakuOpacityBar = this.container.querySelector(".dplayer-danmaku-bar-inner"),
this.danmakuOpacityBarWrap = this.container.querySelector(".dplayer-danmaku-bar"),
this.danmakuOpacityBarWrapWrap = this.container.querySelector(".dplayer-danmaku-bar-wrap"),
this.danmakuOpacityBox = this.container.querySelector(".dplayer-setting-danmaku"),
this.dtime = this.container.querySelector(".dplayer-dtime"),
this.controller = this.container.querySelector(".dplayer-controller"),
this.commentInput = this.container.querySelector(".dplayer-comment-input"),
this.commentButton = this.container.querySelector(".dplayer-comment-icon"),
this.commentSettingBox = this.container.querySelector(".dplayer-comment-setting-box"),
this.commentSettingButton = this.container.querySelector(".dplayer-comment-setting-icon"),
this.commentSettingFill = this.container.querySelector(".dplayer-comment-setting-icon path"),
this.commentSendButton = this.container.querySelector(".dplayer-send-icon"),
this.commentSendFill = this.container.querySelector(".dplayer-send-icon path"),
this.commentColorSettingBox = this.container.querySelector(".dplayer-comment-setting-color"),
this.browserFullButton = this.container.querySelector(".dplayer-full-icon"),
this.webFullButton = this.container.querySelector(".dplayer-full-in-icon"),
this.menu = this.container.querySelector(".dplayer-menu"),
this.menuItem = this.container.querySelectorAll(".dplayer-menu-item"),
this.qualityList = this.container.querySelector(".dplayer-quality-list"),
this.camareButton = this.container.querySelector(".dplayer-camera-icon"),
this.subtitleButton = this.container.querySelector(".dplayer-subtitle-icon"),
this.subtitleButtonInner = this.container.querySelector(".dplayer-subtitle-icon .dplayer-icon-content"),
this.subtitle = this.container.querySelector(".dplayer-subtitle"),
this.qualityButton = this.container.querySelector(".dplayer-quality-icon"),
this.barPreview = this.container.querySelector(".dplayer-bar-preview"),
this.barWrap = this.container.querySelector(".dplayer-bar-wrap"),
this.notice = this.container.querySelector(".dplayer-notice"),
this.infoPanel = this.container.querySelector(".dplayer-info-panel"),
this.infoPanelClose = this.container.querySelector(".dplayer-info-panel-close"),
this.infoVersion = this.container.querySelector(".dplayer-info-panel-item-version .dplayer-info-panel-item-data"),
this.infoFPS = this.container.querySelector(".dplayer-info-panel-item-fps .dplayer-info-panel-item-data"),
this.infoType = this.container.querySelector(".dplayer-info-panel-item-type .dplayer-info-panel-item-data"),
this.infoUrl = this.container.querySelector(".dplayer-info-panel-item-url .dplayer-info-panel-item-data"),
this.infoResolution = this.container.querySelector(".dplayer-info-panel-item-resolution .dplayer-info-panel-item-data"),
this.infoDuration = this.container.querySelector(".dplayer-info-panel-item-duration .dplayer-info-panel-item-data"),
this.infoDanmakuId = this.container.querySelector(".dplayer-info-panel-item-danmaku-id .dplayer-info-panel-item-data"),
this.infoDanmakuApi = this.container.querySelector(".dplayer-info-panel-item-danmaku-api .dplayer-info-panel-item-data"),
this.infoDanmakuAmount = this.container.querySelector(".dplayer-info-panel-item-danmaku-amount .dplayer-info-panel-item-data")
}
}]) && Q(t.prototype, n),
i && Q(t, i),
e
} ();
function Y(e) {
return (Y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
function(e) {
return typeof e
}: function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
})(e)
}
function K(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var G = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.options = t,
this.container = this.options.container,
this.danTunnel = {
right: {},
top: {},
bottom: {}
},
this.danIndex = 0,
this.dan = [],
this.showing = !0,
this._opacity = this.options.opacity,
this.events = this.options.events,
this.unlimited = this.options.unlimited,
this._measure(""),
this.load()
}
var t, n, i;
return t = e,
(n = [{
key: "load",
value: function() {
var e, t = this;
e = this.options.api.maximum ? "".concat(this.options.api.address, "v3/?id=").concat(this.options.api.id, "&max=").concat(this.options.api.maximum) : "".concat(this.options.api.address, "v3/?id=").concat(this.options.api.id);
var n = (this.options.api.addition || []).slice(0);
n.push(e),
this.events && this.events.trigger("danmaku_load_start", n),
this._readAllEndpoints(n,
function(e) {
t.dan = [].concat.apply([], e).sort(function(e, t) {
return e.time - t.time
}),
window.requestAnimationFrame(function() {
t.frame()
}),
t.options.callback(),
t.events && t.events.trigger("danmaku_load_end")
})
}
},
{
key: "reload",
value: function(e) {
this.options.api = e,
this.dan = [],
this.clear(),
this.load()
}
},
{
key: "_readAllEndpoints",
value: function(e, t) {
for (var n = this,
i = [], a = 0, o = function(o) {
n.options.apiBackend.read({
url: e[o],
success: function(n) {
i[o] = n,
++a === e.length && t(i)
},
error: function(r) {
n.options.error(r || n.options.tran("Danmaku load failed")),
i[o] = [],
++a === e.length && t(i)
}
})
},
r = 0; r < e.length; ++r) o(r)
}
},
{
key: "send",
value: function(e, t) {
var n = this,
i = {
token: this.options.api.token,
id: this.options.api.id,
author: this.options.api.user,
time: this.options.time(),
text: e.text,
color: e.color,
type: e.type
};
this.options.apiBackend.send({
url: this.options.api.address + "v3/",
data: i,
success: t,
error: function(e) {
n.options.error(e || n.options.tran("Danmaku send failed"))
}
}),
this.dan.splice(this.danIndex, 0, i),
this.danIndex++;
var a = {
text: this.htmlEncode(i.text),
color: i.color,
type: i.type,
border: "2px solid ".concat(this.options.borderColor)
};
this.draw(a),
this.events && this.events.trigger("danmaku_send", i)
}
},
{
key: "frame",
value: function() {
var e = this;
if (this.dan.length && !this.paused && this.showing) {
for (var t = this.dan[this.danIndex], n = []; t && this.options.time() > parseFloat(t.time);) n.push(t),
t = this.dan[++this.danIndex];
this.draw(n)
}
window.requestAnimationFrame(function() {
e.frame()
})
}
},
{
key: "opacity",
value: function(e) {
if (void 0 !== e) {
for (var t = this.container.getElementsByClassName("dplayer-danmaku-item"), n = 0; n < t.length; n++) t[n].style.opacity = e;
this._opacity = e,
this.events && this.events.trigger("danmaku_opacity", this._opacity)
}
return this._opacity
}
},
{
key: "draw",
value: function(e) {
var t = this;
if (this.showing) {
var n = this.options.height,
i = this.container.offsetWidth,
a = this.container.offsetHeight,
r = parseInt(a / n),
s = function(e) {
var n = e.offsetWidth || parseInt(e.style.width),
i = e.getBoundingClientRect().right || t.container.getBoundingClientRect().right + n;
return t.container.getBoundingClientRect().right - i
},
l = function(e) {
return (i + e) / 5
},
c = function(e, n, a) {
for (var o = i / l(a), c = function(a) {
var c = t.danTunnel[n][a + ""];
if (!c || !c.length) return t.danTunnel[n][a + ""] = [e],
e.addEventListener("animationend",
function() {
t.danTunnel[n][a + ""].splice(0, 1)
}),
{
v: a % r
};
if ("right" !== n) return "continue";
for (var u = 0; u < c.length; u++) {
var d = s(c[u]) - 10;
if (d <= i - o * l(parseInt(c[u].style.width)) || d <= 0) break;
if (u === c.length - 1) return t.danTunnel[n][a + ""].push(e),
e.addEventListener("animationend",
function() {
t.danTunnel[n][a + ""].splice(0, 1)
}),
{
v: a % r
}
}
},
u = 0; t.unlimited || u < r; u++) {
var d = c(u);
switch (d) {
case "continue":
continue;
default:
if ("object" === Y(d)) return d.v
}
}
return - 1
};
"[object Array]" !== Object.prototype.toString.call(e) && (e = [e]);
for (var u = document.createDocumentFragment(), d = function(a) {
e[a].type = o.number2Type(e[a].type),
e[a].color || (e[a].color = 16777215);
var r = document.createElement("div");
r.classList.add("dplayer-danmaku-item"),
r.classList.add("dplayer-danmaku-".concat(e[a].type)),
e[a].border ? r.innerHTML = '').concat(e[a].text, "") : r.innerHTML = e[a].text,
r.style.opacity = t._opacity,
r.style.color = o.number2Color(e[a].color),
r.addEventListener("animationend",
function() {
t.container.removeChild(r)
});
var s = t._measure(e[a].text),
l = void 0;
switch (e[a].type) {
case "right":
(l = c(r, e[a].type, s)) >= 0 && (r.style.width = s + 1 + "px", r.style.top = n * l + "px", r.style.transform = "translateX(-".concat(i, "px)"));
break;
case "top":
(l = c(r, e[a].type)) >= 0 && (r.style.top = n * l + "px");
break;
case "bottom":
(l = c(r, e[a].type)) >= 0 && (r.style.bottom = n * l + "px");
break;
default:
console.error("Can't handled danmaku type: ".concat(e[a].type))
}
l >= 0 && (r.classList.add("dplayer-danmaku-move"), u.appendChild(r))
},
p = 0; p < e.length; p++) d(p);
return this.container.appendChild(u),
u
}
}
},
{
key: "play",
value: function() {
this.paused = !1
}
},
{
key: "pause",
value: function() {
this.paused = !0
}
},
{
key: "_measure",
value: function(e) {
if (!this.context) {
var t = getComputedStyle(this.container.getElementsByClassName("dplayer-danmaku-item")[0], null);
this.context = document.createElement("canvas").getContext("2d"),
this.context.font = t.getPropertyValue("font")
}
return this.context.measureText(e).width
}
},
{
key: "seek",
value: function() {
this.clear();
for (var e = 0; e < this.dan.length; e++) {
if (this.dan[e].time >= this.options.time()) {
this.danIndex = e;
break
}
this.danIndex = this.dan.length
}
}
},
{
key: "clear",
value: function() {
this.danTunnel = {
right: {},
top: {},
bottom: {}
},
this.danIndex = 0,
this.options.container.innerHTML = "",
this.events && this.events.trigger("danmaku_clear")
}
},
{
key: "htmlEncode",
value: function(e) {
return e.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/")
}
},
{
key: "resize",
value: function() {
for (var e = this.container.offsetWidth,
t = this.container.getElementsByClassName("dplayer-danmaku-item"), n = 0; n < t.length; n++) t[n].style.transform = "translateX(-".concat(e, "px)")
}
},
{
key: "hide",
value: function() {
this.showing = !1,
this.pause(),
this.clear(),
this.events && this.events.trigger("danmaku_hide")
}
},
{
key: "show",
value: function() {
this.seek(),
this.showing = !0,
this.play(),
this.events && this.events.trigger("danmaku_show")
}
},
{
key: "unlimit",
value: function(e) {
this.unlimited = e
}
}]) && K(t.prototype, n),
i && K(t, i),
e
} ();
function Z(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var ee = function() {
function e() { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.events = {},
this.videoEvents = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "mozaudioavailable", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"],
this.playerEvents = ["screenshot", "thumbnails_show", "thumbnails_hide", "danmaku_show", "danmaku_hide", "danmaku_clear", "danmaku_loaded", "danmaku_send", "danmaku_opacity", "contextmenu_show", "contextmenu_hide", "notice_show", "notice_hide", "quality_start", "quality_end", "destroy", "resize", "fullscreen", "fullscreen_cancel", "webfullscreen", "webfullscreen_cancel", "subtitle_show", "subtitle_hide", "subtitle_change"]
}
var t, n, i;
return t = e,
(n = [{
key: "on",
value: function(e, t) {
this.type(e) && "function" == typeof t && (this.events[e] || (this.events[e] = []), this.events[e].push(t))
}
},
{
key: "trigger",
value: function(e, t) {
if (this.events[e] && this.events[e].length) for (var n = 0; n < this.events[e].length; n++) this.events[e][n](t)
}
},
{
key: "type",
value: function(e) {
return - 1 !== this.playerEvents.indexOf(e) ? "player": -1 !== this.videoEvents.indexOf(e) ? "video": (console.error("Unknown event name: ".concat(e)), null)
}
}]) && Z(t.prototype, n),
i && Z(t, i),
e
} ();
function te(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var ne = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.player = t,
this.player.events.on("webfullscreen",
function() {
n.player.resize()
}),
this.player.events.on("webfullscreen_cancel",
function() {
n.player.resize(),
o.setScrollPosition(n.lastScrollPosition)
});
var i = function() {
n.player.resize(),
n.isFullScreen("browser") ? n.player.events.trigger("fullscreen") : (o.setScrollPosition(n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel"))
},
a = function() {
var e = document.fullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;
e && e !== n.player.container || (n.player.resize(), e ? n.player.events.trigger("fullscreen") : (o.setScrollPosition(n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel")))
};
/Firefox/.test(navigator.userAgent) ? (document.addEventListener("mozfullscreenchange", a), document.addEventListener("fullscreenchange", a)) : (this.player.container.addEventListener("fullscreenchange", i), this.player.container.addEventListener("webkitfullscreenchange", i), document.addEventListener("msfullscreenchange", a), document.addEventListener("MSFullscreenChange", a))
}
var t, n, i;
return t = e,
(n = [{
key: "isFullScreen",
value: function() {
switch (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser") {
case "browser":
return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
case "web":
return this.player.container.classList.contains("dplayer-fulled")
}
}
},
{
key: "request",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser",
t = "browser" === e ? "web": "browser",
n = this.isFullScreen(t);
switch (n || (this.lastScrollPosition = o.getScrollPosition()), e) {
case "browser":
this.player.container.requestFullscreen ? this.player.container.requestFullscreen() : this.player.container.mozRequestFullScreen ? this.player.container.mozRequestFullScreen() : this.player.container.webkitRequestFullscreen ? this.player.container.webkitRequestFullscreen() : this.player.video.webkitEnterFullscreen ? this.player.video.webkitEnterFullscreen() : this.player.video.webkitEnterFullScreen ? this.player.video.webkitEnterFullScreen() : this.player.container.msRequestFullscreen && this.player.container.msRequestFullscreen();
break;
case "web":
this.player.container.classList.add("dplayer-fulled"),
document.body.classList.add("dplayer-web-fullscreen-fix"),
this.player.events.trigger("webfullscreen")
}
n && this.cancel(t)
}
},
{
key: "cancel",
value: function() {
switch (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser") {
case "browser":
document.cancelFullScreen ? document.cancelFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.webkitCancelFullscreen ? document.webkitCancelFullscreen() : document.msCancelFullScreen ? document.msCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen();
break;
case "web":
this.player.container.classList.remove("dplayer-fulled"),
document.body.classList.remove("dplayer-web-fullscreen-fix"),
this.player.events.trigger("webfullscreen_cancel")
}
}
},
{
key: "toggle",
value: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser";
this.isFullScreen(e) ? this.cancel(e) : this.request(e)
}
}]) && te(t.prototype, n),
i && te(t, i),
e
} ();
function ie(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var ae = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.storageName = {
opacity: "dplayer-danmaku-opacity",
volume: "dplayer-volume",
unlimited: "dplayer-danmaku-unlimited",
danmaku: "dplayer-danmaku-show",
subtitle: "dplayer-subtitle-show"
},
this.
default = {
opacity: .7,
volume: t.options.hasOwnProperty("volume") ? t.options.volume: .7,
unlimited: (t.options.danmaku && t.options.danmaku.unlimited ? 1 : 0) || 0,
danmaku: 1,
subtitle: 1
},
this.data = {},
this.init()
}
var t, n, i;
return t = e,
(n = [{
key: "init",
value: function() {
for (var e in this.storageName) {
var t = this.storageName[e];
this.data[e] = parseFloat(o.storage.get(t) || this.
default[e])
}
}
},
{
key: "get",
value: function(e) {
return this.data[e]
}
},
{
key: "set",
value: function(e, t) {
this.data[e] = t,
o.storage.set(this.storageName[e], t)
}
}]) && ie(t.prototype, n),
i && ie(t, i),
e
} ();
function oe(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var re = function() {
function e(t, n, i, a) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.container = t,
this.video = n,
this.options = i,
this.events = a,
this.init()
}
var t, n, i;
return t = e,
(n = [{
key: "init",
value: function() {
var e = this;
if (this.container.style.fontSize = this.options.fontSize, this.container.style.bottom = this.options.bottom, this.container.style.color = this.options.color, this.video.textTracks && this.video.textTracks[0]) {
var t = this.video.textTracks[0];
t.oncuechange = function() {
var n = t.activeCues[0];
if (n) {
e.container.innerHTML = "";
var i = document.createElement("p");
i.appendChild(n.getCueAsHTML()),
e.container.appendChild(i)
} else e.container.innerHTML = "";
e.events.trigger("subtitle_change")
}
}
}
},
{
key: "show",
value: function() {
this.container.classList.remove("dplayer-subtitle-hide"),
this.events.trigger("subtitle_show")
}
},
{
key: "hide",
value: function() {
this.container.classList.add("dplayer-subtitle-hide"),
this.events.trigger("subtitle_hide")
}
},
{
key: "toggle",
value: function() {
this.container.classList.contains("dplayer-subtitle-hide") ? this.show() : this.hide()
}
}]) && oe(t.prototype, n),
i && oe(t, i),
e
} ();
function se(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var le = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.elements = {},
this.elements.volume = t.volumeBar,
this.elements.played = t.playedBar,
this.elements.loaded = t.loadedBar,
this.elements.danmaku = t.danmakuOpacityBar
}
var t, n, i;
return t = e,
(n = [{
key: "set",
value: function(e, t, n) {
t = Math.max(t, 0),
t = Math.min(t, 1),
this.elements[e].style[n] = 100 * t + "%"
}
},
{
key: "get",
value: function(e) {
return parseFloat(this.elements[e].style.width) / 100
}
}]) && se(t.prototype, n),
i && se(t, i),
e
} ();
function ce(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var ue = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.player = t,
window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
function(e) {
window.setTimeout(e, 1e3 / 60)
},
this.types = ["loading", "info", "fps"],
this.init()
}
var t, n, i;
return t = e,
(n = [{
key: "init",
value: function() {
var e = this;
this.types.map(function(t) {
return "fps" !== t && e["init".concat(t, "Checker")](),
t
})
}
},
{
key: "initloadingChecker",
value: function() {
var e = this,
t = 0,
n = 0,
i = !1;
this.loadingChecker = setInterval(function() {
e.enableloadingChecker && (n = e.player.video.currentTime, i || n !== t || e.player.video.paused || (e.player.container.classList.add("dplayer-loading"), i = !0), i && n > t && !e.player.video.paused && (e.player.container.classList.remove("dplayer-loading"), i = !1), t = n)
},
100)
}
},
{
key: "initfpsChecker",
value: function() {
var e = this;
window.requestAnimationFrame(function() {
if (e.enablefpsChecker) if (e.initfpsChecker(), e.fpsStart) {
e.fpsIndex++;
var t = new Date;
t - e.fpsStart > 1e3 && (e.player.infoPanel.fps(e.fpsIndex / (t - e.fpsStart) * 1e3), e.fpsStart = new Date, e.fpsIndex = 0)
} else e.fpsStart = new Date,
e.fpsIndex = 0;
else e.fpsStart = 0,
e.fpsIndex = 0
})
}
},
{
key: "initinfoChecker",
value: function() {
var e = this;
this.infoChecker = setInterval(function() {
e.enableinfoChecker && e.player.infoPanel.update()
},
1e3)
}
},
{
key: "enable",
value: function(e) {
this["enable".concat(e, "Checker")] = !0,
"fps" === e && this.initfpsChecker()
}
},
{
key: "disable",
value: function(e) {
this["enable".concat(e, "Checker")] = !1
}
},
{
key: "destroy",
value: function() {
var e = this;
this.types.map(function(t) {
return e["enable".concat(t, "Checker")] = !1,
e["".concat(t, "Checker")] && clearInterval(e["".concat(t, "Checker")]),
t
})
}
}]) && ce(t.prototype, n),
i && ce(t, i),
e
} ();
function de(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var pe = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.container = t,
this.container.addEventListener("animationend",
function() {
n.container.classList.remove("dplayer-bezel-transition")
})
}
var t, n, i;
return t = e,
(n = [{
key: "switch",
value: function(e) {
this.container.innerHTML = e,
this.container.classList.add("dplayer-bezel-transition")
}
}]) && de(t.prototype, n),
i && de(t, i),
e
} ();
function he(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var me = function() {
function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.container = t.container,
this.barWidth = t.barWidth,
this.container.style.backgroundImage = "url('".concat(t.url, "')"),
this.events = t.events
}
var t, n, i;
return t = e,
(n = [{
key: "resize",
value: function(e, t, n) {
this.container.style.width = "".concat(e, "px"),
this.container.style.height = "".concat(t, "px"),
this.container.style.top = "".concat(2 - t, "px"),
this.barWidth = n
}
},
{
key: "show",
value: function() {
this.container.style.display = "block",
this.events && this.events.trigger("thumbnails_show")
}
},
{
key: "move",
value: function(e) {
this.container.style.backgroundPosition = "-".concat(160 * (Math.ceil(e / this.barWidth * 100) - 1), "px 0"),
this.container.style.left = "".concat(Math.min(Math.max(e - this.container.offsetWidth / 2, -10), this.barWidth - 150), "px")
}
},
{
key: "hide",
value: function() {
this.container.style.display = "none",
this.events && this.events.trigger("thumbnails_hide")
}
}]) && he(t.prototype, n),
i && he(t, i),
e
} ();
function ye(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var fe = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.player = t,
this.autoHideTimer = 0,
o.isMobile || (this.player.container.addEventListener("mousemove",
function() {
n.setAutoHide()
}), this.player.container.addEventListener("click",
function() {
n.setAutoHide()
}), this.player.on("play",
function() {
n.setAutoHide()
}), this.player.on("pause",
function() {
n.setAutoHide()
})),
this.initPlayButton(),
this.initThumbnails(),
this.initPlayedBar(),
this.initFullButton(),
this.initQualityButton(),
this.initScreenshotButton(),
this.initSubtitleButton(),
this.initHighlights(),
o.isMobile || this.initVolumeButton()
}
var t, n, i;
return t = e,
(n = [{
key: "initPlayButton",
value: function() {
var e = this;
this.player.template.playButton.addEventListener("click",
function() {
e.player.toggle()
}),
o.isMobile ? (this.player.template.videoWrap.addEventListener("click",
function() {
e.toggle()
}), this.player.template.controllerMask.addEventListener("click",
function() {
e.toggle()
})) : (this.player.template.videoWrap.addEventListener("click",
function() {
e.player.toggle()
}), this.player.template.controllerMask.addEventListener("click",
function() {
e.player.toggle()
}))
}
},
{
key: "initHighlights",
value: function() {
var e = this;
this.player.on("durationchange",
function() {
if (1 !== e.player.video.duration && e.player.video.duration !== 1 / 0 && e.player.options.highlight) {
var t = document.querySelectorAll(".dplayer-highlight"); [].slice.call(t, 0).forEach(function(t) {
e.player.template.playedBarWrap.removeChild(t)
});
for (var n = 0; n < e.player.options.highlight.length; n++) if (e.player.options.highlight[n].text && e.player.options.highlight[n].time) {
var i = document.createElement("div");
i.classList.add("dplayer-highlight"),
i.style.left = e.player.options.highlight[n].time / e.player.video.duration * 100 + "%",
i.innerHTML = '' + e.player.options.highlight[n].text + "",
e.player.template.playedBarWrap.insertBefore(i, e.player.template.playedBarTime)
}
}
})
}
},
{
key: "initThumbnails",
value: function() {
var e = this;
this.player.options.video.thumbnails && (this.thumbnails = new me({
container: this.player.template.barPreview,
barWidth: this.player.template.barWrap.offsetWidth,
url: this.player.options.video.thumbnails,
events: this.player.events
}), this.player.on("loadedmetadata",
function() {
e.thumbnails.resize(160, e.player.video.videoHeight / e.player.video.videoWidth * 160, e.player.template.barWrap.offsetWidth)
}))
}
},
{
key: "initPlayedBar",
value: function() {
var e = this,
t = function(t) {
var n = ((t.clientX || t.changedTouches[0].clientX) - o.getBoundingClientRectViewLeft(e.player.template.playedBarWrap)) / e.player.template.playedBarWrap.clientWidth;
n = Math.max(n, 0),
n = Math.min(n, 1),
e.player.bar.set("played", n, "width"),
e.player.template.ptime.innerHTML = o.secondToTime(n * e.player.video.duration)
},
n = function n(i) {
document.removeEventListener(o.nameMap.dragEnd, n),
document.removeEventListener(o.nameMap.dragMove, t);
var a = ((i.clientX || i.changedTouches[0].clientX) - o.getBoundingClientRectViewLeft(e.player.template.playedBarWrap)) / e.player.template.playedBarWrap.clientWidth;
a = Math.max(a, 0),
a = Math.min(a, 1),
e.player.bar.set("played", a, "width"),
e.player.seek(e.player.bar.get("played") * e.player.video.duration),
e.player.timer.enable("progress")
};
this.player.template.playedBarWrap.addEventListener(o.nameMap.dragStart,
function() {
e.player.timer.disable("progress"),
document.addEventListener(o.nameMap.dragMove, t),
document.addEventListener(o.nameMap.dragEnd, n)
}),
this.player.template.playedBarWrap.addEventListener(o.nameMap.dragMove,
function(t) {
if (e.player.video.duration) {
var n = o.cumulativeOffset(e.player.template.playedBarWrap).left,
i = (t.clientX || t.changedTouches[0].clientX) - n;
if (i < 0 || i > e.player.template.playedBarWrap.offsetWidth) return;
var a = e.player.video.duration * (i / e.player.template.playedBarWrap.offsetWidth);
o.isMobile && e.thumbnails && e.thumbnails.show(),
e.thumbnails && e.thumbnails.move(i),
e.player.template.playedBarTime.style.left = "".concat(i - (a >= 3600 ? 25 : 20), "px"),
e.player.template.playedBarTime.innerText = o.secondToTime(a),
e.player.template.playedBarTime.classList.remove("hidden")
}
}),
this.player.template.playedBarWrap.addEventListener(o.nameMap.dragEnd,
function() {
o.isMobile && e.thumbnails && e.thumbnails.hide()
}),
o.isMobile || (this.player.template.playedBarWrap.addEventListener("mouseenter",
function() {
e.player.video.duration && (e.thumbnails && e.thumbnails.show(), e.player.template.playedBarTime.classList.remove("hidden"))
}), this.player.template.playedBarWrap.addEventListener("mouseleave",
function() {
e.player.video.duration && (e.thumbnails && e.thumbnails.hide(), e.player.template.playedBarTime.classList.add("hidden"))
}))
}
},
{
key: "initFullButton",
value: function() {
var e = this;
this.player.template.browserFullButton.addEventListener("click",
function() {
e.player.fullScreen.toggle("browser")
}),
this.player.template.webFullButton.addEventListener("click",
function() {
e.player.fullScreen.toggle("web")
})
}
},
{
key: "initVolumeButton",
value: function() {
var e = this,
t = function(t) {
var n = t || window.event,
i = ((n.clientX || n.changedTouches[0].clientX) - o.getBoundingClientRectViewLeft(e.player.template.volumeBarWrap) - 5.5) / 35;
e.player.volume(i)
},
n = function n() {
document.removeEventListener(o.nameMap.dragEnd, n),
document.removeEventListener(o.nameMap.dragMove, t),
e.player.template.volumeButton.classList.remove("dplayer-volume-active")
};
this.player.template.volumeBarWrapWrap.addEventListener("click",
function(t) {
var n = t || window.event,
i = ((n.clientX || n.changedTouches[0].clientX) - o.getBoundingClientRectViewLeft(e.player.template.volumeBarWrap) - 5.5) / 35;
e.player.volume(i)
}),
this.player.template.volumeBarWrapWrap.addEventListener(o.nameMap.dragStart,
function() {
document.addEventListener(o.nameMap.dragMove, t),
document.addEventListener(o.nameMap.dragEnd, n),
e.player.template.volumeButton.classList.add("dplayer-volume-active")
}),
this.player.template.volumeButtonIcon.addEventListener("click",
function() {
e.player.video.muted ? (e.player.video.muted = !1, e.player.switchVolumeIcon(), e.player.bar.set("volume", e.player.volume(), "width")) : (e.player.video.muted = !0, e.player.template.volumeIcon.innerHTML = U.volumeOff, e.player.bar.set("volume", 0, "width"))
})
}
},
{
key: "initQualityButton",
value: function() {
var e = this;
this.player.options.video.quality && this.player.template.qualityList.addEventListener("click",
function(t) {
t.target.classList.contains("dplayer-quality-item") && e.player.switchQuality(t.target.dataset.index)
})
}
},
{
key: "initScreenshotButton",
value: function() {
var e = this;
this.player.options.screenshot && this.player.template.camareButton.addEventListener("click",
function() {
var t, n = document.createElement("canvas");
n.width = e.player.video.videoWidth,
n.height = e.player.video.videoHeight,
n.getContext("2d").drawImage(e.player.video, 0, 0, n.width, n.height),
n.toBlob(function(e) {
t = URL.createObjectURL(e);
var n = document.createElement("a");
n.href = t,
n.download = "DPlayer.png",
n.style.display = "none",
document.body.appendChild(n),
n.click(),
document.body.removeChild(n),
URL.revokeObjectURL(t)
}),
e.player.events.trigger("screenshot", t)
})
}
},
{
key: "initSubtitleButton",
value: function() {
var e = this;
this.player.options.subtitle && (this.player.events.on("subtitle_show",
function() {
e.player.template.subtitleButton.dataset.balloon = e.player.tran("Hide subtitle"),
e.player.template.subtitleButtonInner.style.opacity = "",
e.player.user.set("subtitle", 1)
}), this.player.events.on("subtitle_hide",
function() {
e.player.template.subtitleButton.dataset.balloon = e.player.tran("Show subtitle"),
e.player.template.subtitleButtonInner.style.opacity = "0.4",
e.player.user.set("subtitle", 0)
}), this.player.template.subtitleButton.addEventListener("click",
function() {
e.player.subtitle.toggle()
}))
}
},
{
key: "setAutoHide",
value: function() {
var e = this;
this.show(),
clearTimeout(this.autoHideTimer),
this.autoHideTimer = setTimeout(function() { ! e.player.video.played.length || e.player.paused || e.disableAutoHide || e.hide()
},
3e3)
}
},
{
key: "show",
value: function() {
this.player.container.classList.remove("dplayer-hide-controller")
}
},
{
key: "hide",
value: function() {
this.player.container.classList.add("dplayer-hide-controller"),
this.player.setting.hide(),
this.player.comment && this.player.comment.hide()
}
},
{
key: "isShow",
value: function() {
return ! this.player.container.classList.contains("dplayer-hide-controller")
}
},
{
key: "toggle",
value: function() {
this.isShow() ? this.hide() : this.show()
}
},
{
key: "destroy",
value: function() {
clearTimeout(this.autoHideTimer)
}
}]) && ye(t.prototype, n),
i && ye(t, i),
e
} ();
function ve(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var ge = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.player = t,
this.player.template.mask.addEventListener("click",
function() {
n.hide()
}),
this.player.template.settingButton.addEventListener("click",
function() {
n.show()
}),
this.loop = this.player.options.loop,
this.player.template.loopToggle.checked = this.loop,
this.player.template.loop.addEventListener("click",
function() {
n.player.template.loopToggle.checked = !n.player.template.loopToggle.checked,
n.player.template.loopToggle.checked ? n.loop = !0 : n.loop = !1,
n.hide()
}),
this.showDanmaku = this.player.user.get("danmaku"),
this.showDanmaku || this.player.danmaku && this.player.danmaku.hide(),
this.player.template.showDanmakuToggle.checked = this.showDanmaku,
this.player.template.showDanmaku.addEventListener("click",
function() {
n.player.template.showDanmakuToggle.checked = !n.player.template.showDanmakuToggle.checked,
n.player.template.showDanmakuToggle.checked ? (n.showDanmaku = !0, n.player.danmaku.show()) : (n.showDanmaku = !1, n.player.danmaku.hide()),
n.player.user.set("danmaku", n.showDanmaku ? 1 : 0),
n.hide()
}),
this.unlimitDanmaku = this.player.user.get("unlimited"),
this.player.template.unlimitDanmakuToggle.checked = this.unlimitDanmaku,
this.player.template.unlimitDanmaku.addEventListener("click",
function() {
n.player.template.unlimitDanmakuToggle.checked = !n.player.template.unlimitDanmakuToggle.checked,
n.player.template.unlimitDanmakuToggle.checked ? (n.unlimitDanmaku = !0, n.player.danmaku.unlimit(!0)) : (n.unlimitDanmaku = !1, n.player.danmaku.unlimit(!1)),
n.player.user.set("unlimited", n.unlimitDanmaku ? 1 : 0),
n.hide()
}),
this.player.template.speed.addEventListener("click",
function() {
n.player.template.settingBox.classList.add("dplayer-setting-box-narrow"),
n.player.template.settingBox.classList.add("dplayer-setting-box-speed")
});
for (var i = function(e) {
n.player.template.speedItem[e].addEventListener("click",
function() {
n.player.speed(n.player.template.speedItem[e].dataset.speed),
n.hide()
})
},
a = 0; a < this.player.template.speedItem.length; a++) i(a);
if (this.player.danmaku) {
this.player.on("danmaku_opacity",
function(e) {
n.player.bar.set("danmaku", e, "width"),
n.player.user.set("opacity", e)
}),
this.player.danmaku.opacity(this.player.user.get("opacity"));
var r = function(e) {
var t = e || window.event,
i = ((t.clientX || t.changedTouches[0].clientX) - o.getBoundingClientRectViewLeft(n.player.template.danmakuOpacityBarWrap)) / 130;
i = Math.max(i, 0),
i = Math.min(i, 1),
n.player.danmaku.opacity(i)
},
s = function e() {
document.removeEventListener(o.nameMap.dragEnd, e),
document.removeEventListener(o.nameMap.dragMove, r),
n.player.template.danmakuOpacityBox.classList.remove("dplayer-setting-danmaku-active")
};
this.player.template.danmakuOpacityBarWrapWrap.addEventListener("click",
function(e) {
var t = e || window.event,
i = ((t.clientX || t.changedTouches[0].clientX) - o.getBoundingClientRectViewLeft(n.player.template.danmakuOpacityBarWrap)) / 130;
i = Math.max(i, 0),
i = Math.min(i, 1),
n.player.danmaku.opacity(i)
}),
this.player.template.danmakuOpacityBarWrapWrap.addEventListener(o.nameMap.dragStart,
function() {
document.addEventListener(o.nameMap.dragMove, r),
document.addEventListener(o.nameMap.dragEnd, s),
n.player.template.danmakuOpacityBox.classList.add("dplayer-setting-danmaku-active")
})
}
}
var t, n, i;
return t = e,
(n = [{
key: "hide",
value: function() {
var e = this;
this.player.template.settingBox.classList.remove("dplayer-setting-box-open"),
this.player.template.mask.classList.remove("dplayer-mask-show"),
setTimeout(function() {
e.player.template.settingBox.classList.remove("dplayer-setting-box-narrow"),
e.player.template.settingBox.classList.remove("dplayer-setting-box-speed")
},
300),
this.player.controller.disableAutoHide = !1
}
},
{
key: "show",
value: function() {
this.player.template.settingBox.classList.add("dplayer-setting-box-open"),
this.player.template.mask.classList.add("dplayer-mask-show"),
this.player.controller.disableAutoHide = !0
}
}]) && ve(t.prototype, n),
i && ve(t, i),
e
} ();
function be(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var we = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.player = t,
this.player.template.mask.addEventListener("click",
function() {
n.hide()
}),
this.player.template.commentButton.addEventListener("click",
function() {
n.show()
}),
this.player.template.commentSettingButton.addEventListener("click",
function() {
n.toggleSetting()
}),
this.player.template.commentColorSettingBox.addEventListener("click",
function() {
if (n.player.template.commentColorSettingBox.querySelector("input:checked+span")) {
var e = n.player.template.commentColorSettingBox.querySelector("input:checked").value;
n.player.template.commentSettingFill.style.fill = e,
n.player.template.commentInput.style.color = e,
n.player.template.commentSendFill.style.fill = e
}
}),
this.player.template.commentInput.addEventListener("click",
function() {
n.hideSetting()
}),
this.player.template.commentInput.addEventListener("keydown",
function(e) {
13 === (e || window.event).keyCode && n.send()
}),
this.player.template.commentSendButton.addEventListener("click",
function() {
n.send()
})
}
var t, n, i;
return t = e,
(n = [{
key: "show",
value: function() {
this.player.controller.disableAutoHide = !0,
this.player.template.controller.classList.add("dplayer-controller-comment"),
this.player.template.mask.classList.add("dplayer-mask-show"),
this.player.container.classList.add("dplayer-show-controller"),
this.player.template.commentInput.focus()
}
},
{
key: "hide",
value: function() {
this.player.template.controller.classList.remove("dplayer-controller-comment"),
this.player.template.mask.classList.remove("dplayer-mask-show"),
this.player.container.classList.remove("dplayer-show-controller"),
this.player.controller.disableAutoHide = !1,
this.hideSetting()
}
},
{
key: "showSetting",
value: function() {
this.player.template.commentSettingBox.classList.add("dplayer-comment-setting-open")
}
},
{
key: "hideSetting",
value: function() {
this.player.template.commentSettingBox.classList.remove("dplayer-comment-setting-open")
}
},
{
key: "toggleSetting",
value: function() {
this.player.template.commentSettingBox.classList.contains("dplayer-comment-setting-open") ? this.hideSetting() : this.showSetting()
}
},
{
key: "send",
value: function() {
var e = this;
this.player.template.commentInput.blur(),
this.player.template.commentInput.value.replace(/^\s+|\s+$/g, "") ? this.player.danmaku.send({
text: this.player.template.commentInput.value,
color: o.color2Number(this.player.container.querySelector(".dplayer-comment-setting-color input:checked").value),
type: parseInt(this.player.container.querySelector(".dplayer-comment-setting-type input:checked").value)
},
function() {
e.player.template.commentInput.value = "",
e.hide()
}) : this.player.notice(this.player.tran("Please input danmaku content!"))
}
}]) && be(t.prototype, n),
i && be(t, i),
e
} ();
var ke = function e(t) { !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
t.options.hotkey && document.addEventListener("keydown",
function(e) {
if (t.focus) {
var n = document.activeElement.tagName.toUpperCase(),
i = document.activeElement.getAttribute("contenteditable");
if ("INPUT" !== n && "TEXTAREA" !== n && "" !== i && "true" !== i) {
var a, o = e || window.event;
switch (o.keyCode) {
case 32:
o.preventDefault(),
t.toggle();
break;
case 37:
o.preventDefault(),
t.seek(t.video.currentTime - 5),
t.controller.setAutoHide();
break;
case 39:
o.preventDefault(),
t.seek(t.video.currentTime + 5),
t.controller.setAutoHide();
break;
case 38:
o.preventDefault(),
a = t.volume() + .1,
t.volume(a);
break;
case 40:
o.preventDefault(),
a = t.volume() - .1,
t.volume(a)
}
}
}
}),
document.addEventListener("keydown",
function(e) {
switch ((e || window.event).keyCode) {
case 27:
t.fullScreen.isFullScreen("web") && t.fullScreen.cancel("web")
}
})
};
function xe(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var Se = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.player = t,
this.shown = !1,
Array.prototype.slice.call(this.player.template.menuItem).forEach(function(e, t) {
n.player.options.contextmenu[t].click && e.addEventListener("click",
function() {
n.player.options.contextmenu[t].click(n.player),
n.hide()
})
}),
this.player.container.addEventListener("contextmenu",
function(e) {
if (n.shown) n.hide();
else {
var t = e || window.event;
t.preventDefault();
var i = n.player.container.getBoundingClientRect();
n.show(t.clientX - i.left, t.clientY - i.top),
n.player.template.mask.addEventListener("click",
function() {
n.hide()
})
}
})
}
var t, n, i;
return t = e,
(n = [{
key: "show",
value: function(e, t) {
this.player.template.menu.classList.remove("dplayer-menu-show");
var n = this.player.container.getBoundingClientRect();
e + this.player.template.menu.offsetWidth >= n.width ? (this.player.template.menu.style.right = n.width - e + "px", this.player.template.menu.style.left = "initial") : (this.player.template.menu.style.left = e + "px", this.player.template.menu.style.right = "initial"),
t + this.player.template.menu.offsetHeight >= n.height ? (this.player.template.menu.style.bottom = n.height - t + "px", this.player.template.menu.style.top = "initial") : (this.player.template.menu.style.top = t + "px", this.player.template.menu.style.bottom = "initial"),
this.player.template.mask.classList.add("dplayer-mask-show"),
this.shown = !0,
this.player.events.trigger("contextmenu_show")
}
},
{
key: "hide",
value: function() {
this.player.template.mask.classList.remove("dplayer-mask-show"),
this.player.template.menu.classList.remove("dplayer-menu-show"),
this.shown = !1,
this.player.events.trigger("contextmenu_hide")
}
}]) && xe(t.prototype, n),
i && xe(t, i),
e
} ();
function Te(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var Le = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.container = t.template.infoPanel,
this.template = t.template,
this.video = t.video,
this.player = t,
this.template.infoPanelClose.addEventListener("click",
function() {
n.hide()
})
}
var t, n, i;
return t = e,
(n = [{
key: "show",
value: function() {
this.beginTime = Date.now(),
this.update(),
this.player.timer.enable("info"),
this.player.timer.enable("fps"),
this.container.classList.remove("dplayer-info-panel-hide")
}
},
{
key: "hide",
value: function() {
this.player.timer.disable("info"),
this.player.timer.disable("fps"),
this.container.classList.add("dplayer-info-panel-hide")
}
},
{
key: "triggle",
value: function() {
this.container.classList.contains("dplayer-info-panel-hide") ? this.show() : this.hide()
}
},
{
key: "update",
value: function() {
this.template.infoVersion.innerHTML = "v".concat("1.25.0", " ").concat("8eb2fdd"),
this.template.infoType.innerHTML = this.player.type,
this.template.infoUrl.innerHTML = this.player.options.video.url,
this.template.infoResolution.innerHTML = "".concat(this.player.video.videoWidth, " x ").concat(this.player.video.videoHeight),
this.template.infoDuration.innerHTML = this.player.video.duration,
this.player.options.danmaku && (this.template.infoDanmakuId.innerHTML = this.player.options.danmaku.id, this.template.infoDanmakuApi.innerHTML = this.player.options.danmaku.api, this.template.infoDanmakuAmount.innerHTML = this.player.danmaku.dan.length)
}
},
{
key: "fps",
value: function(e) {
this.template.infoFPS.innerHTML = "".concat(e.toFixed(1))
}
}]) && Te(t.prototype, n),
i && Te(t, i),
e
} (),
Ee = n(1),
qe = n.n(Ee);
function Be(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1,
i.configurable = !0,
"value" in i && (i.writable = !0),
Object.defineProperty(e, i.key, i)
}
}
var Me = 0,
Ce = [],
_e = function() {
function e(t) {
var n = this; !
function(e, t) {
if (! (e instanceof t)) throw new TypeError("Cannot call a class as a function")
} (this, e),
this.options = u(t),
this.options.video.quality && (this.qualityIndex = this.options.video.defaultQuality, this.quality = this.options.video.quality[this.options.video.defaultQuality]),
this.tran = new p(this.options.lang).tran,
this.events = new ee,
this.user = new ae(this),
this.container = this.options.container,
this.container.classList.add("dplayer"),
this.options.danmaku || this.container.classList.add("dplayer-no-danmaku"),
this.options.live && this.container.classList.add("dplayer-live"),
o.isMobile && this.container.classList.add("dplayer-mobile"),
this.arrow = this.container.offsetWidth <= 500,
this.arrow && this.container.classList.add("dplayer-arrow"),
this.template = new J({
container: this.container,
options: this.options,
index: Me,
tran: this.tran
}),
this.video = this.template.video,
this.bar = new le(this.template),
this.bezel = new pe(this.template.bezel),
this.fullScreen = new ne(this),
this.controller = new fe(this),
this.options.danmaku && (this.danmaku = new G({
container: this.template.danmaku,
opacity: this.user.get("opacity"),
callback: function() {
setTimeout(function() {
n.template.danmakuLoading.style.display = "none",
n.options.autoplay && n.play()
},
0)
},
error: function(e) {
n.notice(e)
},
apiBackend: this.options.apiBackend,
borderColor: this.options.theme,
height: this.arrow ? 24 : 30,
time: function() {
return n.video.currentTime
},
unlimited: this.user.get("unlimited"),
api: {
id: this.options.danmaku.id,
address: this.options.danmaku.api,
token: this.options.danmaku.token,
maximum: this.options.danmaku.maximum,
addition: this.options.danmaku.addition,
user: this.options.danmaku.user
},
events: this.events,
tran: function(e) {
return n.tran(e)
}
}), this.comment = new we(this)),
this.setting = new ge(this),
document.addEventListener("click",
function() {
n.focus = !1
},
!0),
this.container.addEventListener("click",
function() {
n.focus = !0
},
!0),
this.paused = !0,
this.timer = new ue(this),
this.hotkey = new ke(this),
this.contextmenu = new Se(this),
this.initVideo(this.video, this.quality && this.quality.type || this.options.video.type),
this.infoPanel = new Le(this),
!this.danmaku && this.options.autoplay && this.play(),
Me++,
Ce.push(this)
}
var t, n, a;
return t = e,
a = [{
key: "version",
get: function() {
return "1.25.0"
}
}],
(n = [{
key: "seek",
value: function(e) {
e = Math.max(e, 0),
this.video.duration && (e = Math.min(e, this.video.duration)),
this.video.currentTime < e ? this.notice("".concat(this.tran("FF"), " ").concat((e - this.video.currentTime).toFixed(0), " ").concat(this.tran("s"))) : this.video.currentTime > e && this.notice("".concat(this.tran("REW"), " ").concat((this.video.currentTime - e).toFixed(0), " ").concat(this.tran("s"))),
this.video.currentTime = e,
this.danmaku && this.danmaku.seek(),
this.bar.set("played", e / this.video.duration, "width"),
this.template.ptime.innerHTML = o.secondToTime(e)
}
},
{
key: "play",
value: function() {
var e = this;
if (this.paused = !1, this.video.paused && this.bezel.
switch (U.play), this.template.playButton.innerHTML = U.pause, i.a.resolve(this.video.play()).
catch(function() {
e.pause()
}).then(function() {}), this.timer.enable("loading"), this.container.classList.remove("dplayer-paused"), this.container.classList.add("dplayer-playing"), this.danmaku && this.danmaku.play(), this.options.mutex) for (var t = 0; t < Ce.length; t++) this !== Ce[t] && Ce[t].pause()
}
},
{
key: "pause",
value: function() {
this.paused = !0,
this.container.classList.remove("dplayer-loading"),
this.video.paused || this.bezel.
switch (U.pause),
this.template.playButton.innerHTML = U.play,
this.video.pause(),
this.timer.disable("loading"),
this.container.classList.remove("dplayer-playing"),
this.container.classList.add("dplayer-paused"),
this.danmaku && this.danmaku.pause()
}
},
{
key: "switchVolumeIcon",
value: function() {
this.volume() >= .95 ? this.template.volumeIcon.innerHTML = U.volumeUp: this.volume() > 0 ? this.template.volumeIcon.innerHTML = U.volumeDown: this.template.volumeIcon.innerHTML = U.volumeOff
}
},
{
key: "volume",
value: function(e, t, n) {
if (e = parseFloat(e), !isNaN(e)) {
e = Math.max(e, 0),
e = Math.min(e, 1),
this.bar.set("volume", e, "width");
var i = "".concat((100 * e).toFixed(0), "%");
this.template.volumeBarWrapWrap.dataset.balloon = i,
t || this.user.set("volume", e),
n || this.notice("".concat(this.tran("Volume"), " ").concat((100 * e).toFixed(0), "%")),
this.video.volume = e,
this.video.muted && (this.video.muted = !1),
this.switchVolumeIcon()
}
return this.video.volume
}
},
{
key: "toggle",
value: function() {
this.video.paused ? this.play() : this.pause()
}
},
{
key: "on",
value: function(e, t) {
this.events.on(e, t)
}
},
{
key: "switchVideo",
value: function(e, t) {
this.pause(),
this.video.poster = e.pic ? e.pic: "",
this.video.src = e.url,
this.initMSE(this.video, e.type || "auto"),
t && (this.template.danmakuLoading.style.display = "block", this.bar.set("played", 0, "width"), this.bar.set("loaded", 0, "width"), this.template.ptime.innerHTML = "00:00", this.template.danmaku.innerHTML = "", this.danmaku && this.danmaku.reload({
id: t.id,
address: t.api,
token: t.token,
maximum: t.maximum,
addition: t.addition,
user: t.user
}))
}
},
{
key: "initMSE",
value: function(e, t) {
var n = this;
if (this.type = t, this.options.video.customType && this.options.video.customType[t])"[object Function]" === Object.prototype.toString.call(this.options.video.customType[t]) ? this.options.video.customType[t](this.video, this) : console.error("Illegal customType: ".concat(t));
else switch ("auto" === this.type && (/m3u8(#|\?|$)/i.exec(e.src) ? this.type = "hls": /.flv(#|\?|$)/i.exec(e.src) ? this.type = "flv": /.mpd(#|\?|$)/i.exec(e.src) ? this.type = "dash": this.type = "normal"), "hls" === this.type && (e.canPlayType("application/x-mpegURL") || e.canPlayType("application/vnd.apple.mpegURL")) && (this.type = "normal"), this.type) {
case "hls":
if (Hls) if (Hls.isSupported()) {
var i = new Hls;
i.loadSource(e.src),
i.attachMedia(e)
} else this.notice("Error: Hls is not supported.");
else this.notice("Error: Can't find Hls.");
break;
case "flv":
if (flvjs && flvjs.isSupported()) if (flvjs.isSupported()) {
var a = flvjs.createPlayer({
type: "flv",
url: e.src
});
a.attachMediaElement(e),
a.load()
} else this.notice("Error: flvjs is not supported.");
else this.notice("Error: Can't find flvjs.");
break;
case "dash":
dashjs ? dashjs.MediaPlayer().create().initialize(e, e.src, !1) : this.notice("Error: Can't find dashjs.");
break;
case "webtorrent":
if (WebTorrent) if (WebTorrent.WEBRTC_SUPPORT) {
this.container.classList.add("dplayer-loading");
var o = new WebTorrent,
r = e.src;
o.add(r,
function(e) {
e.files.find(function(e) {
return e.name.endsWith(".mp4")
}).renderTo(n.video, {
autoplay: n.options.autoplay
},
function() {
n.container.classList.remove("dplayer-loading")
})
})
} else this.notice("Error: Webtorrent is not supported.");
else this.notice("Error: Can't find Webtorrent.")
}
}
},
{
key: "initVideo",
value: function(e, t) {
var n = this;
this.initMSE(e, t),
this.on("durationchange",
function() {
1 !== e.duration && e.duration !== 1 / 0 && (n.template.dtime.innerHTML = o.secondToTime(e.duration))
}),
this.on("progress",
function() {
var t = e.buffered.length ? e.buffered.end(e.buffered.length - 1) / e.duration: 0;
n.bar.set("loaded", t, "width")
}),
this.on("error",
function() {
n.video.error && n.tran && n.notice && (n.type, n.notice(n.tran("Video load failed"), -1))
}),
this.on("ended",
function() {
n.bar.set("played", 1, "width"),
n.setting.loop ? (n.seek(0), n.play()) : n.pause(),
n.danmaku && (n.danmaku.danIndex = 0)
}),
this.on("play",
function() {
n.paused && n.play()
}),
this.on("pause",
function() {
n.paused || n.pause()
}),
this.on("timeupdate",
function() {
n.bar.set("played", n.video.currentTime / n.video.duration, "width");
var e = o.secondToTime(n.video.currentTime);
n.template.ptime.innerHTML !== e && (n.template.ptime.innerHTML = e)
});
for (var i = function(t) {
e.addEventListener(n.events.videoEvents[t],
function() {
n.events.trigger(n.events.videoEvents[t])
})
},
a = 0; a < this.events.videoEvents.length; a++) i(a);
this.volume(this.user.get("volume"), !0, !0),
this.options.subtitle && (this.subtitle = new re(this.template.subtitle, this.video, this.options.subtitle, this.events), this.user.get("subtitle") || this.subtitle.hide())
}
},
{
key: "switchQuality",
value: function(e) {
var t = this;
if (e = "string" == typeof e ? parseInt(e) : e, this.qualityIndex !== e && !this.switchingQuality) {
this.qualityIndex = e,
this.switchingQuality = !0,
this.quality = this.options.video.quality[e],
this.template.qualityButton.innerHTML = this.quality.name;
var n = this.video.paused;
this.video.pause();
var i = qe()({
current: !1,
pic: null,
screenshot: this.options.screenshot,
preload: "auto",
url: this.quality.url,
subtitle: this.options.subtitle
}),
a = (new DOMParser).parseFromString(i, "text/html").body.firstChild;
this.template.videoWrap.insertBefore(a, this.template.videoWrap.getElementsByTagName("div")[0]),
this.prevVideo = this.video,
this.video = a,
this.initVideo(this.video, this.quality.type || this.options.video.type),
this.seek(this.prevVideo.currentTime),
this.notice("".concat(this.tran("Switching to"), " ").concat(this.quality.name, " ").concat(this.tran("quality")), -1),
this.events.trigger("quality_start", this.quality),
this.on("canplay",
function() {
if (t.prevVideo) {
if (t.video.currentTime !== t.prevVideo.currentTime) return void t.seek(t.prevVideo.currentTime);
t.template.videoWrap.removeChild(t.prevVideo),
t.video.classList.add("dplayer-video-current"),
n || t.video.play(),
t.prevVideo = null,
t.notice("".concat(t.tran("Switched to"), " ").concat(t.quality.name, " ").concat(t.tran("quality"))),
t.switchingQuality = !1,
t.events.trigger("quality_end")
}
})
}
}
},
{
key: "notice",
value: function(e) {
var t = this,
n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2e3,
i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .8;
this.template.notice.innerHTML = e,
this.template.notice.style.opacity = i,
this.noticeTime && clearTimeout(this.noticeTime),
this.events.trigger("notice_show", e),
n > 0 && (this.noticeTime = setTimeout(function() {
t.template.notice.style.opacity = 0,
t.events.trigger("notice_hide")
},
n))
}
},
{
key: "resize",
value: function() {
this.danmaku && this.danmaku.resize(),
this.controller.thumbnails && this.controller.thumbnails.resize(160, this.video.videoHeight / this.video.videoWidth * 160, this.template.barWrap.offsetWidth),
this.events.trigger("resize")
}
},
{
key: "speed",
value: function(e) {
this.video.playbackRate = e
}
},
{
key: "destroy",
value: function() {
Ce.splice(Ce.indexOf(this), 1),
this.pause(),
this.controller.destroy(),
this.timer.destroy(),
this.video.src = "",
this.container.innerHTML = "",
this.events.trigger("destroy")
}
}]) && Be(t.prototype, n),
a && Be(t, a),
e
} ();
console.log("\n".concat(" %c DPlayer v", "1.25.0", " ").concat("8eb2fdd", " %c http://dplayer.js.org ", "\n", "\n"), "color: #fadfa3; background: #030307; padding:5px 0;", "background: #fadfa3; padding:5px 0;");
t.
default = _e
}]).
default
});
//# sourceMappingURL=DPlayer.min.js.map