\n ',
function(e) {
t += e
}(n(4)(a)), t += "\n ", o.logo && (t += '\n
\n
,
t += ')
\n
\n '), t += '\n
]/;
s.$escape = function(e) {
return a(i(e))
}, s.$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 = s
}).call(t, n(1))
},
function(e, t, n) {
"use strict";
(function(t) {
e.exports = !1;
try {
e.exports = "[object process]" === Object.prototype.toString.call(t.process)
} catch (e) {}
}).call(t, n(1))
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var 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
},
o = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
s = function() {
function e(t) {
i(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()
}
return o(e, [{
key: "load",
value: function() {
var e = this,
t = void 0;
t = this.options.api.maximum ? this.options.api.address + "&id=" + this.options.api.id + "&max=" + this.options
.api.maximum : this.options.api.address + "&id=" + this.options.api.id;
var n = (this.options.api.addition || []).slice(0);
n.push(t), this.events && this.events.trigger("danmaku_load_start", n), this._readAllEndpoints(n,
function(t) {
e.dan = [].concat.apply([], t).sort(function(e, t) {
return e.time - t.time
}), window.requestAnimationFrame(function() {
e.frame()
}), e.options.callback(), e.events && e.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 = 0; o < e.length; ++o) this.options.apiBackend.read(e[o], function(o) {
return function(s, r) {
if (++a, s) s.response ? n.options.error(s.response.msg) : n.options.error("弹幕加载失败:" + s.status), i[
o] = [];
else {
var l = ["right", "top", "bottom"];
i[o] = r ? r.map(function(e) {
return {
time: e[0],
type: e[1],
color: e[2],
author: e[3],
text: e[4],
size: e[7]
}
}) : []
}
if (a === e.length) return t(i)
}
}(o))
}
}, {
key: "send",
value: function(e, t) {
var n = {
token: this.options.api.token,
player: this.options.api.id,
author: this.options.api.user,
time: this.options.time(),
text: e.text,
color: e.color,
type: e.type,
size: e.size
};
this.options.apiBackend.send(this.options.api.address, n, t), this.dan.splice(this.danIndex, 0, n), this.danIndex++;
var i = {
text: this.htmlEncode(n.text),
color: n.color,
type: n.type,
size: n.size,
border: "2px solid " + this.options.borderColor
};
this.draw(i), this.events && this.events.trigger("danmaku_send", n)
}
}, {
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("yzmplayer-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,
o = this.container.offsetHeight,
s = parseInt(o / n),
r = 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, o) {
for (var c = i / l(o), u = 0; t.unlimited || u < s; u++) {
var d = function(a) {
var o = t.danTunnel[n][a + ""];
if (!o || !o.length) return t.danTunnel[n][a + ""] = [e], e.addEventListener("animationend",
function() {
t.danTunnel[n][a + ""].splice(0, 1)
}), {
v: a % s
};
if ("right" !== n) return "continue";
for (var u = 0; u < o.length; u++) {
var d = r(o[u]) - 10;
if (d <= i - c * l(parseInt(o[u].style.width)) || d <= 0) break;
if (u === o.length - 1) return t.danTunnel[n][a + ""].push(e), e.addEventListener("animationend",
function() {
t.danTunnel[n][a + ""].splice(0, 1)
}), {
v: a % s
}
}
}(u);
switch (d) {
case "continue":
continue;
default:
if ("object" === (void 0 === d ? "undefined" : a(d))) return d.v
}
}
return -1
};
"[object Array]" !== Object.prototype.toString.call(e) && (e = [e]);
for (var u = document.createDocumentFragment(), d = 0; d < e.length; d++) ! function(a) {
e[a].type || (e[a].type = "right"), e[a].color || (e[a].color = "#fff");
e[a].size || (e[a].fontSize = "27.5px");
var o = document.createElement("div");
o.classList.add("yzmplayer-danmaku-item"), o.classList.add("yzmplayer-danmaku-" + e[a].type), e[a].border ?
o.innerHTML = '' + e[a].text + "" : o.innerHTML =
e[a].text, o.style.opacity = t._opacity, o.style.color = e[a].color, o.style.fontSize = e[a].size, o.addEventListener(
"animationend",
function() {
t.container.removeChild(o)
});
var s = t._measure(e[a].text),
r = void 0;
switch (e[a].type) {
case "right":
r = c(o, e[a].type, s), r >= 0 && (o.style.width = s + 1 + "px", o.style.top = n * r + "px", o.style
.transform = "translateX(-" + i + "px)");
break;
case "top":
r = c(o, e[a].type), r >= 0 && (o.style.top = n * r + "px");
break;
case "bottom":
r = c(o, e[a].type), r >= 0 && (o.style.bottom = n * r + "px");
break;
default:
console.error("Can't handled danmaku type: " + e[a].type)
}
r >= 0 && (o.classList.add("yzmplayer-danmaku-move"), u.appendChild(o))
}(d);
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("yzmplayer-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(
"yzmplayer-danmaku-item"), n = 0; n < t.length; n++) t[n].style.transform = "translateX(-" + 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
}
}]), e
}();
t.default = s
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e() {
i(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"
]
}
return a(e, [{
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: " + e), null)
}
}]), e
}();
t.default = o
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = n(0),
s = function(e) {
return e && e.__esModule ? e : {
default: e
}
}(o),
r = function() {
function e(t) {
var n = this;
i(this, e), this.player = t, this.player.events.on("webfullscreen", function() {
n.player.resize()
}), this.player.events.on("webfullscreen_cancel", function() {
n.player.resize(), s.default.setScrollPosition(n.lastScrollPosition)
});
var a = function() {
n.player.resize(), n.isFullScreen("browser") ? n.player.events.trigger("fullscreen") : (s.default.setScrollPosition(
n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel"))
};
this.player.container.addEventListener("fullscreenchange", a), this.player.container.addEventListener(
"mozfullscreenchange", a), this.player.container.addEventListener("webkitfullscreenchange", a)
}
return a(e, [{
key: "isFullScreen",
value: function() {
switch (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser") {
case "browser":
return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement;
case "web":
return this.player.container.classList.contains("yzmplayer-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 = s.default.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();
break;
case "web":
this.player.container.classList.add("yzmplayer-fulled"), document.body.classList.add(
"yzmplayer-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();
break;
case "web":
this.player.container.classList.remove("yzmplayer-fulled"), document.body.classList.remove(
"yzmplayer-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)
}
}]), e
}();
t.default = r
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = n(0),
s = function(e) {
return e && e.__esModule ? e : {
default: e
}
}(o),
r = function() {
function e(t) {
i(this, e), this.storageName = {
opacity: "yzmplayer-danmaku-opacity",
volume: "yzmplayer-volume",
unlimited: "yzmplayer-danmaku-unlimited",
danmaku: "yzmplayer-danmaku-show",
subtitle: "yzmplayer-subtitle-show"
}, this.default = {
opacity: .7,
volume: t.options.volume || .7,
unlimited: (t.options.danmaku && t.options.danmaku.unlimited ? 1 : 0) || 0,
danmaku: 1,
subtitle: 1
}, this.data = {}, this.init()
}
return a(e, [{
key: "init",
value: function() {
for (var e in this.storageName) {
var t = this.storageName[e];
this.data[e] = parseFloat(s.default.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, s.default.storage.set(this.storageName[e], t)
}
}]), e
}();
t.default = r
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e(t, n, a, o) {
i(this, e), this.container = t, this.video = n, this.options = a, this.events = o, this.init()
}
return a(e, [{
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("yzmplayer-subtitle-hide"), this.events.trigger("subtitle_show")
}
}, {
key: "hide",
value: function() {
this.container.classList.add("yzmplayer-subtitle-hide"), this.events.trigger("subtitle_hide")
}
}, {
key: "toggle",
value: function() {
this.container.classList.contains("yzmplayer-subtitle-hide") ? this.show() : this.hide()
}
}]), e
}();
t.default = o
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e(t) {
i(this, e), this.elements = {}, this.elements.volume = t.volumeBar, this.elements.played = t.playedBar, this.elements
.loaded = t.loadedBar, this.elements.danmaku = t.danmakuOpacityBar
}
return a(e, [{
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
}
}]), e
}();
t.default = o
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = n(0),
s = function(e) {
return e && e.__esModule ? e : {
default: e
}
}(o),
r = function() {
function e(t) {
i(this, e), this.player = t, window.requestAnimationFrame = function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(e) {
window.setTimeout(e, 1e3 / 60)
}
}(), this.types = ["loading", "progress", "info", "fps"], this.init()
}
return a(e, [{
key: "init",
value: function() {
for (var e = 0; e < this.types.length; e++) {
var t = this.types[e];
"fps" !== t && this["init" + t + "Checker"]()
}
}
}, {
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("yzmplayer-loading"), i = !0), i && n > t && !e.player.video.paused &&
(e.player.container.classList.remove("yzmplayer-loading"), i = !1), t = n)
}, 100)
}
}, {
key: "initprogressChecker",
value: function() {
var e = this;
this.progressChecker = setInterval(function() {
if (e.enableprogressChecker) {
e.player.bar.set("played", e.player.video.currentTime / e.player.video.duration, "width");
var t = s.default.secondToTime(e.player.video.currentTime);
e.player.template.ptime.innerHTML !== t && (e.player.template.ptime.innerHTML = s.default.secondToTime(
e.player.video.currentTime))
}
}, 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" + e + "Checker"] = !0, "fps" === e && this.initfpsChecker()
}
}, {
key: "disable",
value: function(e) {
this["enable" + e + "Checker"] = !1
}
}, {
key: "destroy",
value: function(e) {
this[e + "Checker"] && clearInterval(this[e + "Checker"])
}
}]), e
}();
t.default = r
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e(t) {
var n = this;
i(this, e), this.container = t, this.container.addEventListener("animationend", function() {
n.container.classList.remove("yzmplayer-bezel-transition")
})
}
return a(e, [{
key: "switch",
value: function(e) {
this.container.innerHTML = e, this.container.classList.add("yzmplayer-bezel-transition")
}
}]), e
}();
t.default = o
},
function(e, t, n) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var o = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
s = n(0),
r = i(s),
l = n(44),
c = i(l),
u = n(2),
d = i(u),
p = function() {
function e(t) {
var n = this;
a(this, e), this.player = t, this.autoHideTimer = 0, r.default.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(), r.default.isMobile || this.initVolumeButton()
}
return o(e, [{
key: "initPlayButton",
value: function() {
var e = this;
this.player.template.playButton.addEventListener("click", function() {
e.player.toggle()
}), r.default.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: "initThumbnails",
value: function() {
var e = this;
this.player.options.video.thumbnails && (this.thumbnails = new c.default({
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)
}))
}
}, {
key: "initPlayedBar",
value: function() {
var e = this,
t = function(t) {
var n = ((t.clientX || t.changedTouches[0].clientX) - r.default.getElementViewLeft(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 = r.default.secondToTime(n * e.player.video.duration)
},
n = function n(i) {
document.removeEventListener(r.default.nameMap.dragEnd, n), document.removeEventListener(r.default.nameMap
.dragMove, t);
var a = ((i.clientX || i.changedTouches[0].clientX) - r.default.getElementViewLeft(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.time.enable("progress")
};
this.player.template.playedBarWrap.addEventListener(r.default.nameMap.dragStart, function() {
e.player.time.disable("progress"), document.addEventListener(r.default.nameMap.dragMove, t), document.addEventListener(
r.default.nameMap.dragEnd, n)
}), this.player.template.playedBarWrap.addEventListener(r.default.nameMap.dragMove, function(t) {
if (e.player.video.duration) {
var n = r.default.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);
r.default.isMobile && e.thumbnails && e.thumbnails.show(), e.thumbnails && e.thumbnails.move(i), e.player
.template.playedBarTime.style.left = i - 20 + "px", e.player.template.playedBarTime.innerText = r.default
.secondToTime(a), e.player.template.playedBarTime.classList.remove("hidden")
}
}), this.player.template.playedBarWrap.addEventListener(r.default.nameMap.dragEnd, function() {
r.default.isMobile && e.thumbnails && e.thumbnails.hide()
}), r.default.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) - r.default.getElementViewLeft(e.player.template.volumeBarWrap) -
5.5) / 35;
e.player.volume(i)
},
n = function n() {
document.removeEventListener(r.default.nameMap.dragEnd, n), document.removeEventListener(r.default.nameMap
.dragMove, t), e.player.template.volumeButton.classList.remove("yzmplayer-volume-active")
};
this.player.template.volumeBarWrapWrap.addEventListener("click", function(t) {
var n = t || window.event,
i = ((n.clientX || n.changedTouches[0].clientX) - r.default.getElementViewLeft(e.player.template.volumeBarWrap) -
5.5) / 35;
e.player.volume(i)
}), this.player.template.volumeBarWrapWrap.addEventListener(r.default.nameMap.dragStart, function() {
document.addEventListener(r.default.nameMap.dragMove, t), document.addEventListener(r.default.nameMap.dragEnd,
n), e.player.template.volumeButton.classList.add("yzmplayer-volume-active")
}), this.player.template.volumeIcon.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 =
d.default.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("yzmplayer-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 = document.createElement("canvas");
t.width = e.player.video.videoWidth, t.height = e.player.video.videoHeight, t.getContext("2d").drawImage(
e.player.video, 0, 0, t.width, t.height);
var n = t.toDataURL();
e.player.template.camareButton.href = n, e.player.template.camareButton.download = "yzmplayer.png", e.player
.events.trigger("screenshot", n)
})
}
}, {
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("yzmplayer-hide-controller")
}
}, {
key: "hide",
value: function() {
this.player.container.classList.add("yzmplayer-hide-controller"), this.player.setting.hide(), this.player
.comment && this.player.comment.hide()
}
}, {
key: "isShow",
value: function() {
return !this.player.container.classList.contains("yzmplayer-hide-controller")
}
}, {
key: "toggle",
value: function() {
this.isShow() ? this.hide() : this.show()
}
}, {
key: "destroy",
value: function() {
clearTimeout(this.autoHideTimer)
}
}]), e
}();
t.default = p
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e(t) {
i(this, e), this.container = t.container, this.barWidth = t.barWidth, this.container.style.backgroundImage =
"url('" + t.url + "')", this.events = t.events
}
return a(e, [{
key: "resize",
value: function(e, t) {
this.container.style.width = e + "px", this.container.style.height = t + "px", this.container.style.top =
2 - t + "px"
}
}, {
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 = "-" + 160 * (Math.ceil(e / this.barWidth * 100) - 1) + "px 0",
this.container.style.left = e - this.container.offsetWidth / 2 + "px"
}
}, {
key: "hide",
value: function() {
this.container.style.display = "none", this.events && this.events.trigger("thumbnails_hide")
}
}]), e
}();
t.default = o
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = n(0),
s = function(e) {
return e && e.__esModule ? e : {
default: e
}
}(o),
r = function() {
function e(t) {
var n = this;
i(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("yzmplayer-setting-box-narrow"), n.player.template.settingBox.classList
.add("yzmplayer-setting-box-speed")
});
for (var a = 0; a < this.player.template.speedItem.length; a++) ! function(e) {
n.player.template.speedItem[e].addEventListener("click", function() {
n.player.speed(n.player.template.speedItem[e].dataset.speed), n.hide()
})
}(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 o = function(e) {
var t = e || window.event,
i = ((t.clientX || t.changedTouches[0].clientX) - s.default.getElementViewLeft(n.player.template.danmakuOpacityBarWrap)) /
130;
i = Math.max(i, 0), i = Math.min(i, 1), n.player.danmaku.opacity(i)
},
r = function e() {
document.removeEventListener(s.default.nameMap.dragEnd, e), document.removeEventListener(s.default.nameMap.dragMove,
o), n.player.template.danmakuOpacityBox.classList.remove("yzmplayer-setting-danmaku-active")
};
this.player.template.danmakuOpacityBarWrapWrap.addEventListener("click", function(e) {
var t = e || window.event,
i = ((t.clientX || t.changedTouches[0].clientX) - s.default.getElementViewLeft(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(s.default.nameMap.dragStart, function() {
document.addEventListener(s.default.nameMap.dragMove, o), document.addEventListener(s.default.nameMap.dragEnd,
r), n.player.template.danmakuOpacityBox.classList.add("yzmplayer-setting-danmaku-active")
})
}
}
return a(e, [{
key: "hide",
value: function() {
var e = this;
this.player.template.settingBox.classList.remove("yzmplayer-setting-box-open"), this.player.template.mask
.classList.remove("yzmplayer-mask-show"), setTimeout(function() {
e.player.template.settingBox.classList.remove("yzmplayer-setting-box-narrow"), e.player.template.settingBox
.classList.remove("yzmplayer-setting-box-speed")
}, 300), this.player.controller.disableAutoHide = !1
}
}, {
key: "show",
value: function() {
this.player.template.settingBox.classList.add("yzmplayer-setting-box-open"), this.player.template.mask.classList
.add("yzmplayer-mask-show"), this.player.controller.disableAutoHide = !0
}
}]), e
}();
t.default = r
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e(t) {
var n = this;
i(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.yzmcomment.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()
})
}
return a(e, [{
key: "show",
value: function() {
this.player.controller.disableAutoHide = !0, this.player.template.controller.classList.add(
"yzmplayer-controller-comment"), this.player.template.mask.classList.add("yzmplayer-mask-show"), this.player
.container.classList.add("yzmplayer-show-controller"), this.player.template.commentInput.focus()
}
}, {
key: "hide",
value: function() {
this.player.template.controller.classList.remove("yzmplayer-controller-comment"), this.player.template.mask
.classList.remove("yzmplayer-mask-show"), this.player.container.classList.remove(
"yzmplayer-show-controller"), this.player.controller.disableAutoHide = !1, this.hideSetting()
}
}, {
key: "showSetting",
value: function() {
this.player.template.commentSettingBox.classList.add("yzmplayer-comment-setting-open")
}
}, {
key: "hideSetting",
value: function() {
this.player.template.commentSettingBox.classList.remove("yzmplayer-comment-setting-open")
}
}, {
key: "toggleSetting",
value: function() {
this.player.template.commentSettingBox.classList.contains("yzmplayer-comment-setting-open") ? this.hideSetting() :
this.showSetting()
}
}, {
key: "send",
value: function() {
var e = this;
if (this.player.template.commentInput.blur(), !this.player.template.commentInput.value.replace(
/^\s+|\s+$/g, "")) return void this.player.notice(this.player.tran("Please input danmaku content!"));
this.player.danmaku.send({
text: this.player.template.commentInput.value,
color: this.player.container.querySelector(".yzmplayer-comment-setting-color input:checked").value,
type: this.player.container.querySelector(".yzmplayer-comment-setting-type input:checked").value,
size: this.player.container.querySelector(".yzmplayer-comment-setting-font input:checked").value
}, function() {
e.player.template.commentInput.value = "", e.hide()
})
}
}]), e
}();
t.default = o
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function e(t) {
i(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 = e || window.event,
o = void 0;
switch (a.keyCode) {
case 32:
a.preventDefault(), t.toggle();
break;
case 37:
a.preventDefault(), t.seek(t.video.currentTime - 5), t.controller.setAutoHide();
break;
case 39:
a.preventDefault(), t.seek(t.video.currentTime + 5), t.controller.setAutoHide();
break;
case 38:
a.preventDefault(), o = t.volume() + .1, t.volume(o);
break;
case 40:
a.preventDefault(), o = t.volume() - .1, t.volume(o)
}
}
}
}), document.addEventListener("keydown", function(e) {
switch ((e || window.event).keyCode) {
case 27:
t.fullScreen.isFullScreen("web") && t.fullScreen.cancel("web")
}
})
};
t.default = a
},
function(e, t, n) {
"use strict";
function i(e) {
if (Array.isArray(e)) {
for (var t = 0, n = Array(e.length); t < e.length; t++) n[t] = e[t];
return n
}
return Array.from(e)
}
function a(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var o = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
s = function() {
function e(t) {
var n = this;
a(this, e), this.player = t, [].concat(i(this.player.template.menuItem)).map(function(e, t) {
return n.player.options.contextmenu[t].click && e.addEventListener("click", function() {
n.player.options.contextmenu[t].click(n.player), n.hide()
}), e
}), this.player.container.addEventListener("contextmenu", function(e) {
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()
})
})
}
return o(e, [{
key: "show",
value: function(e, t) {
this.player.template.menu.classList.add("yzmplayer-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("yzmplayer-mask-show"), this.player.events.trigger(
"contextmenu_show")
}
}, {
key: "hide",
value: function() {
this.player.template.mask.classList.remove("yzmplayer-mask-show"), this.player.template.menu.classList.remove(
"yzmplayer-menu-show"), this.player.events.trigger("contextmenu_hide")
}
}]), e
}();
t.default = s
},
function(e, t, n) {
"use strict";
function i(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = function() {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var i = t[n];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(
e, i.key, i)
}
}
return function(t, n, i) {
return n && e(t.prototype, n), i && e(t, i), t
}
}(),
o = function() {
function e(t) {
var n = this;
i(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()
})
}
return a(e, [{
key: "show",
value: function() {
this.beginTime = Date.now(), this.update(), this.player.time.enable("info"), this.player.time.enable(
"fps"), this.container.classList.remove("yzmplayer-info-panel-hide")
}
}, {
key: "hide",
value: function() {
this.player.time.disable("info"), this.player.time.disable("fps"), this.container.classList.add(
"yzmplayer-info-panel-hide")
}
}, {
key: "triggle",
value: function() {
this.container.classList.contains("yzmplayer-info-panel-hide") ? this.show() : this.hide()
}
}, {
key: "update",
value: function() {
function formatTime(a) {
return [parseInt(a / 60 / 60), parseInt(a / 60 % 60), parseInt(a % 60)].join(":").replace(/\b(\d)\b/g,
"0$1")
}
this.template.infoVersion.innerHTML = "1.2.1", this.template.infoType.innerHTML = this.player.type, this.template
.infoUrl.innerHTML = this.player.options.video.url, this.template.infoResolution.innerHTML = this.player
.video.videoWidth + " x " + this.player.video.videoHeight, this.template.infoDuration.innerHTML =
formatTime(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 - 2)
}
}, {
key: "fps",
value: function(e) {
this.template.infoFPS.innerHTML = "" + e.toFixed(1)
}
}]), e
}();
t.default = o
}
]).default
});
var yzmck = {
set: function(a, b) {
window.sessionStorage.setItem(a, b)
},
get: function(a) {
return window.sessionStorage.getItem(a)
},
del: function(a) {
window.sessionStorage.removeItem(a)
},
clear: function(a) {
window.sessionStorage.clear()
}
};