!function(e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("leleplayer", [], t) : "object" == typeof exports ? exports.leleplayer = t() : e.leleplayer = t()
}("undefined" != typeof self ? self : this, function() {
return function(e) {
function t(i) {
if (n[i])
return n[i].exports;
var a = n[i] = {
i: i,
l: !1,
exports: {}
};
return e[i].call(a.exports, a, a.exports, t),
a.l = !0,
a.exports
}
var n = {};
return t.m = e,
t.c = n,
t.d = function(e, n, i) {
t.o(e, n) || Object.defineProperty(e, n, {
configurable: !1,
enumerable: !0,
get: i
})
}
,
t.n = function(e) {
var n = e && e.__esModule ? function() {
return e.default
}
: function() {
return e
}
;
return t.d(n, "a", n),
n
}
,
t.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}
,
t.p = "/",
t(t.s = 5)
}([function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
});
var i = /mobile/i.test(window.navigator.userAgent)
, a = {
secondToTime: function(e) {
var t = function(e) {
return e < 10 ? "0" + e : "" + e
}
, n = Math.floor(e / 3600)
, i = Math.floor((e - 3600 * n) / 60)
, a = Math.floor(e - 3600 * n - 60 * i);
return (n > 0 ? [n, i, a] : [i, a]).map(t).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
},
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: i,
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: i ? "touchstart" : "mousedown",
dragMove: i ? "touchmove" : "mousemove",
dragEnd: i ? "touchend" : "mouseup"
}
};
t.default = a
}
, function(e, t, n) {
"use strict";
var i, 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
}
;
i = function() {
return this
}();
try {
i = i || Function("return this")() || (0,
eval)("this")
} catch (e) {
"object" === ("undefined" == typeof window ? "undefined" : a(window)) && (i = window)
}
e.exports = i
}
, function(e, t, n) {
"use strict";
function i(e) {
return e && e.__esModule ? e : {
default: e
}
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = n(16)
, o = i(a)
, s = n(17)
, r = i(s)
, l = n(18)
, c = i(l)
, u = n(19)
, d = i(u)
, p = n(20)
, h = i(p)
, y = n(21)
, m = i(y)
, f = n(22)
, v = i(f)
, g = n(23)
, b = i(g)
, k = n(24)
, w = i(k)
, x = n(25)
, S = i(x)
, T = n(26)
, L = i(T)
, M = n(27)
, _ = i(M)
, q = n(28)
, E = i(q)
, B = n(29)
, P = i(B)
, C = n(30)
, O = i(C)
, z = n(31)
, F = i(z)
, I = {
play: o.default,
pause: r.default,
volumeUp: c.default,
volumeDown: d.default,
volumeOff: h.default,
full: m.default,
fullWeb: v.default,
setting: b.default,
right: w.default,
comment: S.default,
commentOff: L.default,
send: _.default,
pallette: E.default,
camera: P.default,
subtitle: O.default,
loading: F.default
};
t.default = I
}
, function(e, t, n) {
"use strict";
e.exports = n(33)
}
, function(e, t, n) {
var i = n(3);
e.exports = function(e) {
"use strict";
e = e || {};
var t = ""
, n = e.enableSubtitle
, a = e.subtitle
, o = e.current
, s = e.pic
, r = i.$escape
, l = e.screenshot
, c = e.preload
, u = e.url
, n = a && "webvtt" === a.type;
return t += '\n'
}
}
, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}),
n(6);
var i = n(7)
, a = function(e) {
return e && e.__esModule ? e : {
default: e
}
}(i);
console.log('%c页面加载完毕消耗了' + Math.round(performance.now() * 100) / 100 + 'ms', 'background:#fff;color:#333;text-shadow:0 0 2px #eee,0 0 3px #eee,0 0 3px #eee,0 0 2px #eee,0 0 3px #eee;');
t.default = a.default
}
, function(e, t) {}
, 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(8)
, r = i(s)
, l = n(0)
, c = i(l)
, u = n(12)
, d = i(u)
, p = n(14)
, h = i(p)
, y = n(15)
, m = i(y)
, f = n(2)
, v = i(f)
, g = n(35)
, b = i(g)
, k = n(36)
, w = i(k)
, x = n(37)
, S = i(x)
, T = n(38)
, L = i(T)
, M = n(39)
, _ = i(M)
, q = n(40)
, E = i(q)
, B = n(41)
, P = i(B)
, C = n(42)
, O = i(C)
, z = n(43)
, F = i(z)
, I = n(45)
, j = i(I)
, D = n(46)
, W = i(D)
, H = n(47)
, A = i(H)
, V = n(48)
, R = i(V)
, X = n(49)
, N = i(X)
, U = n(4)
, $ = i(U)
, Q = 0
, J = []
, Y = function() {
function e(t) {
var n = this;
a(this, e),
this.options = (0,
d.default)(t),
this.options.video.quality && (this.qualityIndex = this.options.video.defaultQuality,
this.quality = this.options.video.quality[this.options.video.defaultQuality]),
this.tran = new h.default(this.options.lang).tran,
this.events = new w.default,
this.user = new L.default(this),
this.container = this.options.container,
this.container.classList.add("leleplayer"),
this.options.danmaku || this.container.classList.add("leleplayer-no-danmaku"),
this.options.live && this.container.classList.add("leleplayer-live"),
c.default.isMobile && this.container.classList.add("leleplayer-mobile"),
this.arrow = this.container.offsetWidth <= 500,
this.arrow && this.container.classList.add("leleplayer-arrow"),
this.template = new m.default({
container: this.container,
options: this.options,
index: Q,
tran: this.tran
}),
this.video = this.template.video,
this.bar = new E.default(this.template),
this.bezel = new O.default(this.template.bezel),
this.fullScreen = new S.default(this),
this.controller = new F.default(this),
this.options.danmaku && (this.danmaku = new b.default({
container: this.template.danmaku,
opacity: this.user.get("opacity"),
callback: function() {
setTimeout(function() {
n.template.danmakuLoading.style.display = "none",
setTimeout(function() {
if (document.getElementById('link2-success') != null) {
document.getElementById('link2-success').style.display = "block"
}
}, 1 * 1500),
n.options.autoplay && n.play()
}, 0)
},
error: function(e) {
document.getElementById('link2-success').remove(),
setTimeout(function() {
document.getElementById('link2-error').style.display = "block"
}, 1 * 1000),
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
}),
this.comment = new W.default(this)),
this.setting = new j.default(this),
document.addEventListener("click", function() {
n.focus = !1
}, !0),
this.container.addEventListener("click", function() {
n.focus = !0
}, !0),
this.paused = !0,
this.time = new P.default(this),
this.hotkey = new A.default(this),
this.contextmenu = new R.default(this),
this.initVideo(this.video, this.quality && this.quality.type || this.options.video.type),
this.infoPanel = new N.default(this),
!this.danmaku && this.options.autoplay && this.play(),
Q++,
J.push(this)
}
return o(e, [{
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(this.tran("FF") + " " + (e - this.video.currentTime).toFixed(0) + " " + this.tran("s")) : this.video.currentTime > e && this.notice(this.tran("REW") + " " + (this.video.currentTime - e).toFixed(0) + " " + this.tran("s")),
this.video.currentTime = e,
this.danmaku && this.danmaku.seek(),
this.bar.set("played", e / this.video.duration, "width")
}
}, {
key: "play",
value: function() {
var e = this;
if (this.paused = !1,
this.video.paused && this.bezel.switch(v.default.play),
this.template.playButton.innerHTML = v.default.pause,
r.default.resolve(this.video.play()).catch(function() {
e.pause()
}).then(function() {}),
this.time.enable("loading"),
this.time.enable("progress"),
this.container.classList.remove("leleplayer-paused"),
this.container.classList.add("leleplayer-playing"),
this.danmaku && this.danmaku.play(),
this.options.mutex)
for (var t = 0; t < J.length; t++)
this !== J[t] && J[t].pause()
}
}, {
key: "pause",
value: function() {
this.paused = !0,
this.container.classList.remove("leleplayer-loading"),
this.video.paused || this.bezel.switch(v.default.pause),
this.ended = !1,
this.template.playButton.innerHTML = v.default.play,
this.video.pause(),
this.time.disable("loading"),
this.time.disable("progress"),
this.container.classList.remove("leleplayer-playing"),
this.container.classList.add("leleplayer-paused"),
this.danmaku && this.danmaku.pause()
}
}, {
key: "switchVolumeIcon",
value: function() {
this.volume() >= .95 ? this.template.volumeIcon.innerHTML = v.default.volumeUp : this.volume() > 0 ? this.template.volumeIcon.innerHTML = v.default.volumeDown : this.template.volumeIcon.innerHTML = v.default.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 = (100 * e).toFixed(0) + "%";
this.template.volumeBarWrapWrap.dataset.balloon = i,
t || this.user.set("volume", e),
n || this.notice(this.tran("Volume") + " " + (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: " + 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"),
this.type) {
case "hls":
if (Hls)
if (Hls.isSupported()) {
var i = new Hls;
i.loadSource(e.src),
i.attachMedia(e)
} else
this.notice("");
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("leleplayer-loading");
var o = new WebTorrent
, s = e.src;
o.add(s, function(e) {
e.files.find(function(e) {
return e.name.endsWith(".mp4")
}).renderTo(n.video, {
autoplay: n.options.autoplay
}, function() {
n.container.classList.remove("leleplayer-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 && (n.template.dtime.innerHTML = c.default.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() {
setTimeout(function() {
if(document.getElementById('link3-error') != null){
document.getElementById('link3-error').style.display = "block";
}
}, 5 * 1000),
n.tran && n.notice && (n.type,
n.notice(n.tran("This video fails to load"), -1))
}),
this.ended = !1,
this.on("ended", function() {
n.bar.set("played", 1, "width"),
n.setting.loop ? (n.seek(0),
e.play()) : (n.ended = !0,
n.pause()),
n.danmaku && (n.danmaku.danIndex = 0)
}),
this.on("play", function() {
n.paused && n.play()
}),
this.on("pause", function() {
n.paused || n.pause()
});
for (var i = 0; i < this.events.videoEvents.length; i++)
!function(t) {
e.addEventListener(n.events.videoEvents[t], function() {
n.events.trigger(n.events.videoEvents[t])
})
}(i);
this.volume(this.user.get("volume"), !0, !0),
this.options.subtitle && (this.subtitle = new _.default(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 (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 = (0,
$.default)({
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(this.tran("Switching to") + " " + this.quality.name + " " + 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("leleplayer-video-current"),
n || t.video.play(),
t.prevVideo = null,
t.notice(t.tran("Switched to") + " " + t.quality.name + " " + 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),
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.events.trigger("resize")
}
}, {
key: "speed",
value: function(e) {
this.video.playbackRate = e
}
}, {
key: "destroy",
value: function() {
J.splice(J.indexOf(this), 1),
this.pause(),
this.controller.destroy(),
this.time.destroy(),
this.video.src = "",
this.container.innerHTML = "",
this.events.trigger("destroy");
for (var e in this)
this.hasOwnProperty(e) && "paused" !== e && delete this[e]
}
}]),
e
}();
t.default = Y
}
, function(e, t, n) {
"use strict";
(function(t) {
function n() {}
function i(e, t) {
return function() {
e.apply(t, arguments)
}
}
function a(e) {
if (!(this instanceof a))
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 = [],
u(e, this)
}
function o(e, t) {
for (; 3 === e._state; )
e = e._value;
if (0 === e._state)
return void e._deferreds.push(t);
e._handled = !0,
a._immediateFn(function() {
var n = 1 === e._state ? t.onFulfilled : t.onRejected;
if (null === n)
return void (1 === e._state ? s : r)(t.promise, e._value);
var i;
try {
i = n(e._value)
} catch (e) {
return void r(t.promise, e)
}
s(t.promise, i)
})
}
function s(e, t) {
try {
if (t === e)
throw new TypeError("A promise cannot be resolved with itself.");
if (t && ("object" === (void 0 === t ? "undefined" : d(t)) || "function" == typeof t)) {
var n = t.then;
if (t instanceof a)
return e._state = 3,
e._value = t,
void l(e);
if ("function" == typeof n)
return void u(i(n, t), e)
}
e._state = 1,
e._value = t,
l(e)
} catch (t) {
r(e, t)
}
}
function r(e, t) {
e._state = 2,
e._value = t,
l(e)
}
function l(e) {
2 === e._state && 0 === e._deferreds.length && a._immediateFn(function() {
e._handled || a._unhandledRejectionFn(e._value)
});
for (var t = 0, n = e._deferreds.length; t < n; t++)
o(e, e._deferreds[t]);
e._deferreds = null
}
function c(e, t, n) {
this.onFulfilled = "function" == typeof e ? e : null,
this.onRejected = "function" == typeof t ? t : null,
this.promise = n
}
function u(e, t) {
var n = !1;
try {
e(function(e) {
n || (n = !0,
s(t, e))
}, function(e) {
n || (n = !0,
r(t, e))
})
} catch (e) {
if (n)
return;
n = !0,
r(t, e)
}
}
var d = "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
}
, p = setTimeout;
a.prototype.catch = function(e) {
return this.then(null, e)
}
,
a.prototype.then = function(e, t) {
var i = new this.constructor(n);
return o(this, new c(e,t,i)),
i
}
,
a.all = function(e) {
return new a(function(t, n) {
function i(e, s) {
try {
if (s && ("object" === (void 0 === s ? "undefined" : d(s)) || "function" == typeof s)) {
var r = s.then;
if ("function" == typeof r)
return void r.call(s, function(t) {
i(e, t)
}, n)
}
a[e] = s,
0 == --o && t(a)
} catch (e) {
n(e)
}
}
if (!e || void 0 === e.length)
throw new TypeError("Promise.all accepts an array");
var a = Array.prototype.slice.call(e);
if (0 === a.length)
return t([]);
for (var o = a.length, s = 0; s < a.length; s++)
i(s, a[s])
}
)
}
,
a.resolve = function(e) {
return e && "object" === (void 0 === e ? "undefined" : d(e)) && e.constructor === a ? e : new a(function(t) {
t(e)
}
)
}
,
a.reject = function(e) {
return new a(function(t, n) {
n(e)
}
)
}
,
a.race = function(e) {
return new a(function(t, n) {
for (var i = 0, a = e.length; i < a; i++)
e[i].then(t, n)
}
)
}
,
a._immediateFn = "function" == typeof t && function(e) {
t(e)
}
|| function(e) {
p(e, 0)
}
,
a._unhandledRejectionFn = function(e) {
"undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", e)
}
,
e.exports = a
}
).call(t, n(9).setImmediate)
}
, function(e, t, n) {
"use strict";
function i(e, t) {
this._id = e,
this._clearFn = t
}
var a = Function.prototype.apply;
t.setTimeout = function() {
return new i(a.call(setTimeout, window, arguments),clearTimeout)
}
,
t.setInterval = function() {
return new i(a.call(setInterval, window, arguments),clearInterval)
}
,
t.clearTimeout = t.clearInterval = function(e) {
e && e.close()
}
,
i.prototype.unref = i.prototype.ref = function() {}
,
i.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(10),
t.setImmediate = setImmediate,
t.clearImmediate = clearImmediate
}
, function(e, t, n) {
"use strict";
(function(e, t) {
!function(e, n) {
function i(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 i = {
callback: e,
args: t
};
return c[l] = i,
r(l),
l++
}
function a(e) {
delete c[e]
}
function o(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)
}
}
function s(e) {
if (u)
setTimeout(s, 0, e);
else {
var t = c[e];
if (t) {
u = !0;
try {
o(t)
} finally {
a(e),
u = !1
}
}
}
}
if (!e.setImmediate) {
var r, 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) ? function() {
r = function(e) {
t.nextTick(function() {
s(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
}
}() ? function() {
var t = "setImmediate$" + Math.random() + "$"
, n = function(n) {
n.source === e && "string" == typeof n.data && 0 === n.data.indexOf(t) && s(+n.data.slice(t.length))
};
e.addEventListener ? e.addEventListener("message", n, !1) : e.attachEvent("onmessage", n),
r = function(n) {
e.postMessage(t + n, "*")
}
}() : e.MessageChannel ? function() {
var e = new MessageChannel;
e.port1.onmessage = function(e) {
s(e.data)
}
,
r = function(t) {
e.port2.postMessage(t)
}
}() : d && "onreadystatechange"in d.createElement("script") ? function() {
var e = d.documentElement;
r = function(t) {
var n = d.createElement("script");
n.onreadystatechange = function() {
s(t),
n.onreadystatechange = null,
e.removeChild(n),
n = null
}
,
e.appendChild(n)
}
}() : function() {
r = function(e) {
setTimeout(s, 0, e)
}
}(),
p.setImmediate = i,
p.clearImmediate = a
}
}("undefined" == typeof self ? void 0 === e ? void 0 : e : self)
}
).call(t, n(1), n(11))
}
, function(e, t, n) {
"use strict";
function i() {
throw new Error("setTimeout has not been defined")
}
function a() {
throw new Error("clearTimeout has not been defined")
}
function o(e) {
if (d === setTimeout)
return setTimeout(e, 0);
if ((d === i || !d) && setTimeout)
return d = setTimeout,
setTimeout(e, 0);
try {
return d(e, 0)
} catch (t) {
try {
return d.call(null, e, 0)
} catch (t) {
return d.call(this, e, 0)
}
}
}
function s(e) {
if (p === clearTimeout)
return clearTimeout(e);
if ((p === a || !p) && clearTimeout)
return p = clearTimeout,
clearTimeout(e);
try {
return p(e)
} catch (t) {
try {
return p.call(null, e)
} catch (t) {
return p.call(this, e)
}
}
}
function r() {
f && y && (f = !1,
y.length ? m = y.concat(m) : v = -1,
m.length && l())
}
function l() {
if (!f) {
var e = o(r);
f = !0;
for (var t = m.length; t; ) {
for (y = m,
m = []; ++v < t; )
y && y[v].run();
v = -1,
t = m.length
}
y = null,
f = !1,
s(e)
}
}
function c(e, t) {
this.fun = e,
this.array = t
}
function u() {}
var d, p, h = e.exports = {};
!function() {
try {
d = "function" == typeof setTimeout ? setTimeout : i
} catch (e) {
d = i
}
try {
p = "function" == typeof clearTimeout ? clearTimeout : a
} catch (e) {
p = a
}
}();
var y, m = [], f = !1, v = -1;
h.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];
m.push(new c(e,t)),
1 !== m.length || f || o(l)
}
,
c.prototype.run = function() {
this.fun.apply(null, this.array)
}
,
h.title = "browser",
h.browser = !0,
h.env = {},
h.argv = [],
h.version = "",
h.versions = {},
h.on = u,
h.addListener = u,
h.once = u,
h.off = u,
h.removeListener = u,
h.removeAllListeners = u,
h.emit = u,
h.prependListener = u,
h.prependOnceListener = u,
h.listeners = function(e) {
return []
}
,
h.binding = function(e) {
throw new Error("process.binding is not supported")
}
,
h.cwd = function() {
return "/"
}
,
h.chdir = function(e) {
throw new Error("process.chdir is not supported")
}
,
h.umask = function() {
return 0
}
}
, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
});
var 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
}
, a = n(13)
, o = function(e) {
return e && e.__esModule ? e : {
default: e
}
}(a);
t.default = function(e) {
var t = {
container: e.element || document.getElementsByClassName("leleplayer")[0],
live: !1,
autoplay: !1,
theme: "#b7daff",
loop: !1,
lang: (navigator.language || navigator.browserLanguage).toLowerCase(),
screenshot: !1,
hotkey: !0,
preload: "auto",
volume: .7,
apiBackend: o.default,
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" === i(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: config.yjtest,
link: config.yjrule,
tzym: "_blank"
}]),
e
}
}
, function(e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
});
var i = function(e, t, n, i, a) {
var o = new XMLHttpRequest;
o.onreadystatechange = function() {
if (4 === o.readyState) {
if (o.status >= 200 && o.status < 300 || 304 === o.status) {
var e = JSON.parse(o.responseText);
return 23 !== e.code ? i(o, e) : n(o, e)
}
a(o)
}
}
,
o.open(null !== t ? "POST" : "GET", e, !0),
o.send(null !== t ? JSON.stringify(t) : null)
};
t.default = {
send: function(e, t, n) {
i(e, t, function(e, t) {
console.log("发送弹幕成功"),
n && n()
}, function(e, t) {
alert(t.msg)
}, function(e) {
console.log("Request was unsuccessful: " + e.status)
})
},
read: function(e, t) {
i(e, null, function(e, n) {
t(null, n.danmuku)
}, function(e, n) {
t({
status: e.status,
response: n
})
}, function(e) {
t({
status: e.status,
response: null
})
})
}
}
}
, function(e, t, n) {
"use strict";
function i(e) {
var t = this;
this.lang = e,
this.tran = function(e) {
return a[t.lang] && a[t.lang][e] ? a[t.lang][e] : e
}
}
Object.defineProperty(t, "__esModule", {
value: !0
});
var a = {
"zh-cn": {
"Danmaku is loading": "弹幕加载中",
Top: "顶部",
Bottom: "底部",
Rolling: "滚动",
"Input danmaku, hit Enter": "发个弹幕见证当下",
"About author": "关于作者",
"leleplayer feedback": "播放器意见反馈",
"About ipian": "关于爱片网播放器",
Loop: "洗脑循环",
Speed: "速度",
"Opacity for danmaku": "弹幕透明度",
Normal: "正常",
"Please input danmaku content!": "要输入弹幕内容啊喂!",
"Set danmaku color": "弹幕颜色",
"Set danmaku type": "弹幕模式",
"Show danmaku": "显示弹幕",
"This video fails to load": "视频加载失败",
"Switching to": "正在切换至",
"Switched to": "已经切换至",
quality: "画质",
FF: "快进",
REW: "快退",
"Unlimited danmaku": "海量弹幕",
"Send danmaku": "发送弹幕",
Setting: "设置",
"Full screen": "全屏",
"Picture in picture": "画中画",
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": "關於作者",
"leleplayer feedback": "播放器意見反饋",
"About ipian": "關於愛片網播放器",
Loop: "循環播放",
Speed: "速度",
"Opacity for danmaku": "彈幕透明度",
Normal: "正常",
"Please input danmaku content!": "請輸入彈幕内容啊!",
"Set danmaku color": "設置彈幕顏色",
"Set danmaku type": "設置彈幕類型",
"Show danmaku": "顯示彈幕",
"This video fails to load": "視頻加載失敗",
"Switching to": "正在切換至",
"Switched to": "已經切換至",
quality: "畫質",
FF: "快進",
REW: "快退",
"Unlimited danmaku": "海量彈幕",
"Send danmaku": "發送彈幕",
Setting: "設置",
"Full screen": "全屏",
"Picture in picture": "頁面全屏",
Send: "發送",
Screenshot: "截圖",
s: "秒",
"Show subtitle": "顯示字幕",
"Hide subtitle": "隱藏字幕",
Volume: "音量",
Live: "直播",
"Video info": "視頻統計信息"
}
};
t.default = i
}
, 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(2)
, r = i(s)
, l = n(32)
, c = i(l)
, u = function() {
function e(t) {
a(this, e),
this.container = t.container,
this.options = t.options,
this.index = t.index,
this.tran = t.tran,
this.init()
}
return o(e, [{
key: "init",
value: function() {
this.container.innerHTML = (0,
c.default)({
options: this.options,
index: this.index,
tran: this.tran,
icons: r.default,
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(".leleplayer-volume-bar-inner"),
this.volumeBarWrap = this.container.querySelector(".leleplayer-volume-bar"),
this.volumeBarWrapWrap = this.container.querySelector(".leleplayer-volume-bar-wrap"),
this.volumeButton = this.container.querySelector(".leleplayer-volume"),
this.volumeIcon = this.container.querySelector(".leleplayer-volume-icon .leleplayer-icon-content"),
this.playedBar = this.container.querySelector(".leleplayer-played"),
this.loadedBar = this.container.querySelector(".leleplayer-loaded"),
this.playedBarWrap = this.container.querySelector(".leleplayer-bar-wrap"),
this.playedBarTime = this.container.querySelector(".leleplayer-bar-time"),
this.danmaku = this.container.querySelector(".leleplayer-danmaku"),
this.danmakuLoading = this.container.querySelector(".leleplayer-danloading"),
this.video = this.container.querySelector(".leleplayer-video-current"),
this.bezel = this.container.querySelector(".leleplayer-bezel-icon"),
this.playButton = this.container.querySelector(".leleplayer-play-icon"),
this.videoWrap = this.container.querySelector(".leleplayer-video-wrap"),
this.controllerMask = this.container.querySelector(".leleplayer-controller-mask"),
this.ptime = this.container.querySelector(".leleplayer-ptime"),
this.settingButton = this.container.querySelector(".leleplayer-setting-icon"),
this.settingBox = this.container.querySelector(".leleplayer-setting-box"),
this.mask = this.container.querySelector(".leleplayer-mask"),
this.loop = this.container.querySelector(".leleplayer-setting-loop"),
this.loopToggle = this.container.querySelector(".leleplayer-setting-loop .leleplayer-toggle-setting-input"),
this.showDanmaku = this.container.querySelector(".leleplayer-setting-showdan"),
this.showDanmakuToggle = this.container.querySelector(".leleplayer-showdan-setting-input"),
this.unlimitDanmaku = this.container.querySelector(".leleplayer-setting-danunlimit"),
this.unlimitDanmakuToggle = this.container.querySelector(".leleplayer-danunlimit-setting-input"),
this.speed = this.container.querySelector(".leleplayer-setting-speed"),
this.speedItem = this.container.querySelectorAll(".leleplayer-setting-speed-item"),
this.danmakuOpacityBar = this.container.querySelector(".leleplayer-danmaku-bar-inner"),
this.danmakuOpacityBarWrap = this.container.querySelector(".leleplayer-danmaku-bar"),
this.danmakuOpacityBarWrapWrap = this.container.querySelector(".leleplayer-danmaku-bar-wrap"),
this.danmakuOpacityBox = this.container.querySelector(".leleplayer-setting-danmaku"),
this.dtime = this.container.querySelector(".leleplayer-dtime"),
this.controller = this.container.querySelector(".leleplayer-controller"),
this.commentInput = this.container.querySelector(".leleplayer-comment-input"),
this.commentButton = this.container.querySelector(".leleplayer-comment-icon"),
this.lelecomment = this.container.querySelector(".lele-leleplayer-comment-input"),
this.commentSettingBox = this.container.querySelector(".leleplayer-comment-setting-box"),
this.commentSettingButton = this.container.querySelector(".leleplayer-comment-setting-icon"),
this.commentSettingFill = this.container.querySelector(".leleplayer-comment-setting-icon path"),
this.commentSendButton = this.container.querySelector(".leleplayer-send-icon"),
this.commentSendFill = this.container.querySelector(".leleplayer-send-icon path"),
this.commentColorSettingBox = this.container.querySelector(".leleplayer-comment-setting-color"),
this.browserFullButton = this.container.querySelector(".leleplayer-full-icon"),
this.webFullButton = this.container.querySelector(".leleplayer-full-in-icon"),
this.menu = this.container.querySelector(".leleplayer-menu"),
this.menuItem = this.container.querySelectorAll(".leleplayer-menu-item"),
this.qualityList = this.container.querySelector(".leleplayer-quality-list"),
this.camareButton = this.container.querySelector(".leleplayer-camera-icon"),
this.subtitleButton = this.container.querySelector(".leleplayer-subtitle-icon"),
this.subtitleButtonInner = this.container.querySelector(".leleplayer-subtitle-icon .leleplayer-icon-content"),
this.subtitle = this.container.querySelector(".leleplayer-subtitle"),
this.qualityButton = this.container.querySelector(".leleplayer-quality-icon"),
this.barPreview = this.container.querySelector(".leleplayer-bar-preview"),
this.barWrap = this.container.querySelector(".leleplayer-bar-wrap"),
this.notice = this.container.querySelector(".leleplayer-notice"),
this.infoPanel = this.container.querySelector(".leleplayer-info-panel"),
this.infoPanelClose = this.container.querySelector(".leleplayer-info-panel-close"),
this.infoVersion = this.container.querySelector(".leleplayer-info-panel-item-version .leleplayer-info-panel-item-data"),
this.infoFPS = this.container.querySelector(".leleplayer-info-panel-item-fps .leleplayer-info-panel-item-data"),
this.infoType = this.container.querySelector(".leleplayer-info-panel-item-type .leleplayer-info-panel-item-data"),
this.infoUrl = this.container.querySelector(".leleplayer-info-panel-item-url .leleplayer-info-panel-item-data"),
this.infoResolution = this.container.querySelector(".leleplayer-info-panel-item-resolution .leleplayer-info-panel-item-data"),
this.infoDuration = this.container.querySelector(".leleplayer-info-panel-item-duration .leleplayer-info-panel-item-data"),
this.infoDanmakuId = this.container.querySelector(".leleplayer-info-panel-item-danmaku-id .leleplayer-info-panel-item-data"),
this.infoDanmakuApi = this.container.querySelector(".leleplayer-info-panel-item-danmaku-api .leleplayer-info-panel-item-data"),
this.infoDanmakuAmount = this.container.querySelector(".leleplayer-info-panel-item-danmaku-amount .leleplayer-info-panel-item-data")
}
}]),
e
}();
t.default = u
}
, 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(3);
e.exports = function(e) {
"use strict";
e = e || {};
var t = ""
, a = (arguments[1],
e.video)
, o = e.options
, s = i.$escape
, r = e.tran
, l = e.icons
, c = e.index
, u = i.$each;
e.$value,
e.$index;
return t += '
播放器连接成功
弹幕正在连接中
弹幕已填装完毕弹幕库连接失败
视频正在连接中视频连接失败...请断开代理,如果没有代理就是视频失效,请留言反馈! \n\n ',
function(e) {
t += e
}(n(4)(a)),
t += "\n ",
o.logo && (t += '\n
\n
,
t += ')
\n
\n '),
t += '\n
\n
\n
\n \n ',
o.danmaku && (t += '\n ',
t += s(r("Danmaku is loading")),
t += "\n "),
t += '\n ',
t += l.loading,
t += '\n
\n
\n\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n 0:00 /\n 0:00\n \n ',
o.live && (t += '\n
',
t += s(r("Live")),
t += "\n "),
t += '\n
\n
\n ',
o.video.quality && (t += '\n
\n
\n
\n
\n ',
u(o.video.quality, function(e, n) {
t += '\n
',
t += s(e.name),
t += "
\n "
}),
t += "\n
\n
\n
\n "),
t += '\n \n ",
o.subtitle && (t += '\n
\n \n
\n "),
t += '\n
\n
\n
\n
\n
\n
',
t += s(r("Speed")),
t += '\n
',
t += l.right,
t += '
\n
\n
\n
',
t += s(r("Loop")),
t += '\n
\n \n \n
\n
\n
\n
\n
\n 0.5\n
\n
\n 0.75\n
\n
\n ',
t += s(r("Normal")),
t += '\n
\n
\n 1.25\n
\n
\n 1.5\n
\n
\n 2\n
\n
\n
\n
\n ',
t += "\n ",
o.screenshot && (t += '\n
\n ',
t += l.camera,
t += "\n \n "),
t += '\n
\n
\n
\n
\n
\n
\n \n \n\n
关闭
\n
\n 播放器版本\n \n
\n
\n 播放器帧率\n \n
\n
\n 视频类型\n \n
\n
\n 视频地址\n \n
\n
\n 视频分辨率\n \n
\n
\n 视频时长\n \n
\n ',
o.danmaku && (t += '\n
\n 弹幕 ID\n \n
\n
\n 弹幕API\n \n
\n
\n 弹幕数量\n \n
\n
视频标题
\n '),
t += '\n
\n\n'
}
}
, function(e, t, n) {
"use strict";
(function(t) {
function i(e) {
return "string" != typeof e && (e = void 0 === e || null === e ? "" : "function" == typeof e ? i(e.call(e)) : JSON.stringify(e)),
e
}
function a(e) {
var t = "" + e
, n = r.exec(t);
if (!n)
return e;
var i = ""
, a = void 0
, o = void 0
, s = void 0;
for (a = n.index,
o = 0; a < t.length; a++) {
switch (t.charCodeAt(a)) {
case 34:
s = """;
break;
case 38:
s = "&";
break;
case 39:
s = "'";
break;
case 60:
s = "<";
break;
case 62:
s = ">";
break;
default:
continue
}
o !== a && (i += t.substring(o, a)),
o = a + 1,
i += s
}
return o !== a ? i + t.substring(o, a) : i
}
var o = n(34)
, s = Object.create(o ? t : window)
, r = /["&'<>]/;
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 lydz = document.referrer;
if (lydz == '') {
lydz = document.URL;
}
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,
referer: lydz,
};
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("leleplayer-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("leleplayer-danmaku-item"),
o.classList.add("leleplayer-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("leleplayer-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("leleplayer-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("leleplayer-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("leleplayer-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":
// 进入画中画
if (document.pictureInPictureEnabled == true) {
if (document.getElementById('enterhzh') != null) {
document.getElementById('enterhzh').addEventListener('click', ()=>{
lelevideo.requestPictureInPicture().catch(error=>{
console.log(error);
}
);
}
);
document.getElementById('enterhzh').id = "exithzh";
// 进入画中画模式时候执行
lelevideo.addEventListener('enterpictureinpicture', function() {
$('head').append('');
});
lelevideo.addEventListener('leavepictureinpicture', function() {
$('head').append('');
});
}
} else {
layer.msg('抱歉,当前浏览器不支持画中画功能', {
time: 3000
});
}
}
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":
// 退出画中画
if (document.pictureInPictureEnabled == true) {
if (document.getElementById('exithzh') != null) {
document.getElementById('exithzh').addEventListener('click', ()=>{
document.exitPictureInPicture().catch(error=>{
console.log(error);
}
);
}
);
document.getElementById('exithzh').id = "enterhzh";
}
} else {
layer.msg('抱歉,当前浏览器不支持画中画功能', {
time: 3000
});
}
}
}
}, {
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: "leleplayer-danmaku-opacity",
volume: "leleplayer-volume",
unlimited: "leleplayer-danmaku-unlimited",
danmaku: "leleplayer-danmaku-show",
subtitle: "leleplayer-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("leleplayer-subtitle-hide"),
this.events.trigger("subtitle_show")
}
}, {
key: "hide",
value: function() {
this.container.classList.add("leleplayer-subtitle-hide"),
this.events.trigger("subtitle_hide")
}
}, {
key: "toggle",
value: function() {
this.container.classList.contains("leleplayer-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("leleplayer-loading"),
i = !0),
i && n > t && !e.player.video.paused && (e.player.container.classList.remove("leleplayer-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("leleplayer-bezel-transition")
})
}
return a(e, [{
key: "switch",
value: function(e) {
this.container.innerHTML = e,
this.container.classList.add("leleplayer-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("leleplayer-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("leleplayer-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("leleplayer-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 = "video.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("leleplayer-hide-controller")
}
}, {
key: "hide",
value: function() {
this.player.container.classList.add("leleplayer-hide-controller"),
this.player.setting.hide(),
this.player.comment && this.player.comment.hide()
}
}, {
key: "isShow",
value: function() {
return !this.player.container.classList.contains("leleplayer-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("leleplayer-setting-box-narrow"),
n.player.template.settingBox.classList.add("leleplayer-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("leleplayer-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("leleplayer-setting-danmaku-active")
})
}
}
return a(e, [{
key: "hide",
value: function() {
var e = this;
this.player.template.settingBox.classList.remove("leleplayer-setting-box-open"),
this.player.template.mask.classList.remove("leleplayer-mask-show"),
setTimeout(function() {
e.player.template.settingBox.classList.remove("leleplayer-setting-box-narrow"),
e.player.template.settingBox.classList.remove("leleplayer-setting-box-speed")
}, 300),
this.player.controller.disableAutoHide = !1
}
}, {
key: "show",
value: function() {
this.player.template.settingBox.classList.add("leleplayer-setting-box-open"),
this.player.template.mask.classList.add("leleplayer-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.lelecomment.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("leleplayer-controller-comment"),
this.player.template.mask.classList.add("leleplayer-mask-show"),
this.player.container.classList.add("leleplayer-show-controller"),
this.player.template.commentInput.focus()
}
}, {
key: "hide",
value: function() {
this.player.template.controller.classList.remove("leleplayer-controller-comment"),
this.player.template.mask.classList.remove("leleplayer-mask-show"),
this.player.container.classList.remove("leleplayer-show-controller"),
this.player.controller.disableAutoHide = !1,
this.hideSetting()
}
}, {
key: "showSetting",
value: function() {
this.player.template.commentSettingBox.classList.add("leleplayer-comment-setting-open")
}
}, {
key: "hideSetting",
value: function() {
this.player.template.commentSettingBox.classList.remove("leleplayer-comment-setting-open")
}
}, {
key: "toggleSetting",
value: function() {
this.player.template.commentSettingBox.classList.contains("leleplayer-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(".leleplayer-comment-setting-color input:checked").value,
type: this.player.container.querySelector(".leleplayer-comment-setting-type input:checked").value,
size: this.player.container.querySelector(".leleplayer-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("leleplayer-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("leleplayer-mask-show"),
this.player.events.trigger("contextmenu_show")
}
}, {
key: "hide",
value: function() {
this.player.template.mask.classList.remove("leleplayer-mask-show"),
this.player.template.menu.classList.remove("leleplayer-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("leleplayer-info-panel-hide")
}
}, {
key: "hide",
value: function() {
this.player.time.disable("info"),
this.player.time.disable("fps"),
this.container.classList.add("leleplayer-info-panel-hide")
}
}, {
key: "triggle",
value: function() {
this.container.classList.contains("leleplayer-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.0.8",
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 leleck = {
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()
}
};