var huawei = huawei || {};
typeof module != "undefined" && (module.exports = huawei);
// html标签增加特定class, attribute,限定样式,兼容浏览器用
document.documentElement.className += " ie" + document.documentMode;
document.documentElement.setAttribute("data-userAgent", navigator.userAgent);
$(document).on("videojs-loaded.setup-video", function () {
// return;
setTimeout(function () {
$(".js_video_player")
.filter('[data-play-nopop="1"]')
.each(function () {
var $t = $(this);
// $t.addClass("invisible");
var vid = "myvideo-" + generateUUID();
var options = $(this).attr("data-player-id", vid).data("options");
var data = $(this).data();
delete data.options;
$.extend(options, data);
// if ($t.attr("data-play-nopop") == "1")
$t.parent()
.find(".player-outer-box")
.remove()
.end()
.prepend('
');
window.initPlayer(vid, options, false);
});
$(".js_video_player")
.not('[data-play-nopop="1"]')
.each(function () {
var vid = "myvideo-" + generateUUID();
var options = $(this).attr("data-player-id", vid).data("options");
var data = $(this).data();
delete data.options;
$.extend(options, data);
options.autoplay = false;
window.initPlayer(vid, options, true);
});
}, 10);
});
$(function ($) {
huawei.playerLoad();
// huawei.mobilePlayerInit();
});
huawei.playerSetup = function () {
// bof
(function ($) {
var playerInstance = null;
$(document).on("click", ".js-close-video", function (e) {
var $vbox = $(this).closest(".video-box");
$vbox.find("video").trigger("pause");
setTimeout(function () {
$vbox
.removeClass("show")
.delay(500)
.promise()
.then(function () {
$(this).hide();
});
}, 10);
});
$(document).off("vclick", ".js_video_player, .js-play-btn, .btn-play");
$(document)
.off("click", ".js_video_player, .js-play-btn, .btn-play")
.on("click", ".js_video_player, .js-play-btn, .btn-play", function (e) {
if (typeof videojs == "undefined") {
if (window.console) console.log("player 还未加载");
return false;
}
var $t = $(this);
var vid = $t.attr("data-player-id");
$("#" + vid)
.closest(".video-box")
.show()
.delay(10)
.promise()
.then(function () {
$(this).addClass("show");
});
setTimeout(function () {
videojs(vid).play();
}, 100);
return false;
});
$(document).on("click", ".js-close-video-popup", function (e) {
playerInstance.pause();
$("body").removeClass("video-popup");
$(this).closest(".videojs_player_wrapper").removeClass("active");
});
})(jQuery);
// eof
};
huawei.playerLoad = function (invokeSetup) {
jQuery.loadScript = function (url, options) {
// Allow user to set any option except for dataType, cache, and url
options = $.extend(options || {}, {
dataType: "script",
cache: true,
url: url,
});
/*
* Use $.ajax() since it is more flexible than $.getScript
* Return the jqXHR object so we can chain callbacks
*/
return jQuery.ajax(options);
};
window["lang"] = document.URL.indexOf("/cn/") >= 0 || $("html[lang=zh]").length ? "cn" : "en";
window["videojsLanguage"] = window["lang"] == "cn" ? "zh-CN" : "en";
window["playerLang"] = {};
window["playerLang"]["en"] = {
"Switch-Quality": "Switch quality",
"Download-Video": "Download video",
};
window["playerLang"]["cn"] = {
"Switch-Quality": "选择分辨率",
"Download-Video": "下载视频",
};
function getVideoJs7() {
$(
""
).prependTo("head");
$(
''
).prependTo("head");
return jQuery
.loadScript(
"https://auto.huawei.com/marketingcloud/pep/asset//20000004/ias-index/js/video.min.js"
)
.then(function (d) {});
}
invokeSetup = typeof invokeSetup == "boolean" ? invokeSetup : true;
var ismobile = isMobile();
var ie = isIE89();
var videoFn = getVideoJs7;
if (typeof videojs != "undefined") {
videoFn = function () {
var dfd = jQuery.Deferred();
setTimeout(function () {
dfd.resolve("ok");
}, 10);
return dfd;
};
}
var something = (function () {
var executed = false;
return function () {
if (!executed) {
executed = true;
// do something
videoFn().done(function (d) {
$(document).trigger("videojs-loaded");
if (!invokeSetup) return;
huawei.playerSetup();
if (ismobile) {
var $m = $(".js_video_player")
.filter("[data-play-nopop=1]")
.not("[data-mobile-init=0]");
$m.attr("data-player-autostart", "0");
setTimeout(function () {
$m.trigger("click");
// $(".js_video_player").filter("[data-player-mobile-init=1]").attr("data-player-autostart", "0").trigger("click");
}, 100);
}
});
}
};
})();
function load_jwplayer_fn() {
something();
}
load_jwplayer_fn();
};
huawei.mobilePlayerInit = function () {
if (!isMobile()) return;
window.mobVideoFlag = true;
// $(".js_video_player").filter("[data-player-id]").attr("data-player-autostart", "0").trigger("click");
$(".js_video_player").each(function (i, o) {
if ($(this).attr("run_at_pc_module") || $(this).attr("data-mobile-init") == "0") {
return;
}
var player_id = "js-player-" + generateUUID();
var player_placeholder =
'';
// $(this).attr("data-player-id", player_id).attr("data-play-nopop", 1)
$(this).attr("href", "javascript:void(0)").parent().prepend(player_placeholder);
$(this).attr("data-onclick", $(this).attr("onclick")).prop("onclick", null);
});
};
window.initPlayer = function (playerid, options, append) {
options = options || {};
append = append || false;
var $vc = $(
''
);
if (!append) $vc.replaceAll($("#" + playerid));
else
$("body").append(
$vc
.addClass("content")
.append(
''
)
.wrapAll('')
.parent()
.hide()
);
var player_options = {
controls: true,
autoplay: true,
preload: "metadata",
fluid: true,
sources: [],
aspectRatio: "16:9",
muted: false,
plugins: {},
language: window["videojsLanguage"],
};
options["aspectRatio"] = options["aspectRatio"] || options["aspectratio"] || "16:9";
options["muted"] = options["muted"] || options["mute"] || false;
options["loop"] = options["loop"] || options["repeat"] || false;
if (videojs.getPlugin && videojs.getPlugin("videoJsResolutionSwitcher")) {
var res = window.innerWidth >= 768 ? 720 : "low";
player_options.plugins["videoJsResolutionSwitcher"] = {
default: res, // Default resolution [{Number}, 'low', 'high'],
dynamicLabel: true,
textControl: window["playerLang"][window["lang"]]["Switch-Quality"],
};
}
if (videojs.getPlugin && videojs.getPlugin("vjsdownload")) {
player_options.plugins["vjsdownload"] = {
beforeElement: "playbackRateMenuButton",
textControl: window["playerLang"][window["lang"]]["Download-Video"],
name: "downloadButton",
//downloadURL: 'https://insert_source_here.mp4' //optional if you need a different download url than the source
};
}
$.extend(player_options, options);
var player = videojs.getPlayers()[playerid];
if (player) player.dispose();
var player = videojs(playerid, player_options);
if (player_options["autoplay"])
setTimeout(function () {
player.play();
}, 1000);
if (videojs.getComponent("QualitySelector")) {
player.controlBar
.addChild("QualitySelector", {
textControl: "Quality",
})
.controlText(window["playerLang"][window["lang"]]["Switch-Quality"]);
}
if (player.ga) player.ga();
if (player_options.gaEvent) {
var flag = false;
var evt = function (e) {
if (flag) return;
flag = true;
var gaEvent = new Function("e", player_options.gaEvent);
gaEvent.apply(e);
};
if (player.one) player.one("play", evt);
else player.on("play", evt);
}
// var hasSend = false;
// player.on("play", function (e) {
// if (hasSend) return;
// hasSend = true;
// var url = player.currentSrc();
// try {
// utag.link({
// tealium_event: "video_clicked",
// video_id: url,
// video_name: "",
// });
// } catch (e) {}
// });
return player;
};
function isIE89() {
var ie = /(msie ([6-9]|10)|Trident)/i.test(navigator.userAgent);
return ie;
}
function isMobile() {
var isMobile = {
Android: function () {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function () {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function () {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function () {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function () {
return navigator.userAgent.match(/IEMobile/i);
},
any: function () {
return (
isMobile.Android() ||
isMobile.BlackBerry() ||
isMobile.iOS() ||
isMobile.Opera() ||
isMobile.Windows()
);
},
};
return isMobile.any();
}
function generateUUID() {
var d = new Date().getTime();
var d2 =
(typeof performance !== "undefined" && performance.now && performance.now() * 1000) || 0;
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = Math.random() * 16;
if (d > 0) {
r = (d + r) % 16 | 0;
d = Math.floor(d / 16);
} else {
r = (d2 + r) % 16 | 0;
d2 = Math.floor(d2 / 16);
}
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
});
}
// 播放器图标样式
$(document).on("videojs-loaded.style", function () {
var style =
"\n ";
setTimeout(function () {
$(style).appendTo("head");
}, 10);
});
// 多分辨率插件
$(document).on("videojs-loaded.videojs-resolution-switcher", function () {
$(
""
).appendTo("head");
/*! videojs-resolution-switcher - 2015-7-26
* Copyright (c) 2016 Kasper Moskwiak
* Modified by Pierre Kraft
* Licensed under the Apache-2.0 license. */
!(function () {
"use strict";
var e = null;
(e =
void 0 === window.videojs && "function" == typeof require
? require("video.js")
: window.videojs),
(function (e, t) {
var l,
s = {},
r = {},
i = {};
function o(e, t, l, s) {
return (
(r = { label: l, sources: t }),
"function" == typeof s
? s(e, t, l)
: (e.src(
t.map(function (e) {
return { src: e.src, type: e.type, res: e.res };
})
),
e)
);
}
var n = t.getComponent("MenuItem"),
a = t.extend(n, {
constructor: function (e, t, l, s) {
(this.onClickListener = l),
(this.label = s),
n.call(this, e, t),
(this.src = t.src),
this.on("click", this.onClick),
this.on("touchstart", this.onClick),
t.initialySelected &&
(this.showAsLabel(),
this.selected(!0),
this.addClass("vjs-selected"));
},
showAsLabel: function () {
this.label && (this.label.innerHTML = this.options_.label);
},
onClick: function (e) {
this.onClickListener(this);
var t = this.player_.currentTime(),
l = this.player_.paused(),
s = this.player_.playbackRate(),
r = this.player_.options_.poster;
this.showAsLabel(), this.addClass("vjs-selected");
var i = this.player_;
setTimeout(function () {
i.play();
}, 500),
l
? this.player_.bigPlayButton.show()
: (this.player_.bigPlayButton.hide(),
r && this.player_.posterImage.setSrc("")),
"function" != typeof e &&
"function" == typeof this.options_.customSourcePicker &&
(e = this.options_.customSourcePicker);
var n = "loadeddata";
"Youtube" !== this.player_.techName_ &&
"none" === this.player_.preload() &&
"Flash" !== this.player_.techName_ &&
(n = "timeupdate"),
o(this.player_, this.src, this.options_.label, e).one(
n,
function () {
this.player_.currentTime(t),
l ||
(this.player_.playbackRate(s),
this.player_.play(),
this.player_.posterImage.setSrc(r)),
this.player_.trigger("resolutionchange");
}
);
},
}),
c = t.getComponent("MenuButton"),
u = t.extend(c, {
constructor: function (e, l, s, r) {
if (
((this.sources = l.sources),
(this.label = r),
(this.label.innerHTML = l.initialySelectedLabel),
c.call(this, e, l, s),
this.controlText("Quality"),
s.dynamicLabel)
)
this.el().appendChild(r);
else {
var i = document.createElement("span");
t.dom.appendContent(i, l.initialySelectedLabel),
t.dom.addClass(i, "vjs-resolution-button-staticlabel"),
this.el().appendChild(i);
}
},
createItems: function () {
var e = [],
t = (this.sources && this.sources.label) || {},
l = function (t) {
e.map(function (e) {
e.selected(e === t), e.removeClass("vjs-selected");
});
};
for (var s in t)
t.hasOwnProperty(s) &&
(e.push(
new a(
this.player_,
{
label: s,
src: t[s],
initialySelected:
s === this.options_.initialySelectedLabel,
customSourcePicker:
this.options_.customSourcePicker,
},
l,
this.label
)
),
(i[s] = e[e.length - 1]));
return e;
},
});
(l = function (e) {
var l = t.mergeOptions(s, e),
n = this,
a = document.createElement("span"),
c = {};
function h(e, t) {
return e.res && t.res ? +t.res - +e.res : 0;
}
function d(e) {
var t = { label: {}, res: {}, type: {} };
return (
e.map(function (e) {
p(t, "label", e),
p(t, "res", e),
p(t, "type", e),
y(t, "label", e),
y(t, "res", e),
y(t, "type", e);
}),
t
);
}
function p(e, t, l) {
null == e[t][l[t]] && (e[t][l[t]] = []);
}
function y(e, t, l) {
e[t][l[t]].push(l);
}
t.dom.addClass(a, "vjs-resolution-button-label"),
this.el().appendChild(a),
(n.updateSrc = function (e) {
if (!e) return n.src();
n.controlBar.resolutionSwitcher &&
(n.controlBar.resolutionSwitcher.dispose(),
delete n.controlBar.resolutionSwitcher),
(e = e.sort(h));
var s = (function (e, t) {
var s = l.default,
r = "";
"high" === s
? ((s = t[0].res), (r = t[0].label))
: "low" !== s && null != s && e.res[s]
? e.res[s] && (r = e.res[s][0].label)
: ((s = t[t.length - 1].res), (r = t[t.length - 1].label));
return { res: s, label: r, sources: e.res[s] };
})((c = d(e)), e),
r = new u(
n,
{
sources: c,
initialySelectedLabel: s.label,
initialySelectedRes: s.res,
customSourcePicker: l.customSourcePicker,
},
l,
a
);
return (
t.dom.addClass(r.el(), "vjs-resolution-button"),
(n.controlBar.resolutionSwitcher = n.controlBar.el_.insertBefore(
r.el_,
n.controlBar.getChild("fullscreenToggle").el_
)),
(n.controlBar.resolutionSwitcher.dispose = function () {
this.parentNode.removeChild(this);
}),
o(n, s.sources, s.label)
);
}),
(n.currentResolution = function (e, t) {
return (
console.log("currentResolution: ", e),
null == e
? r
: (console.log("currentResolution: ", i[e]),
null != i[e] && i[e].onClick(t),
n)
);
}),
(n.getGroupedSrc = function () {
return c;
}),
n.ready(function () {
n.options_.sources.length > 1 && n.updateSrc(n.options_.sources),
"Youtube" === n.techName_ &&
(function (e) {
e.tech_.ytPlayer.setPlaybackQuality("default"),
e.tech_.ytPlayer.addEventListener(
"onPlaybackQualityChange",
function () {
e.trigger("resolutionchange");
}
),
e.one("play", function () {
var t =
e.tech_.ytPlayer.getAvailableQualityLevels(),
s = {
highres: {
res: 1080,
label: "1080",
yt: "highres",
},
hd1080: {
res: 1080,
label: "1080",
yt: "hd1080",
},
hd720: {
res: 720,
label: "720",
yt: "hd720",
},
large: {
res: 480,
label: "480",
yt: "large",
},
medium: {
res: 360,
label: "360",
yt: "medium",
},
small: {
res: 240,
label: "240",
yt: "small",
},
tiny: {
res: 144,
label: "144",
yt: "tiny",
},
auto: {
res: 0,
label: "auto",
yt: "default",
},
},
r = [];
t.map(function (t) {
r.push({
src: e.src().src,
type: e.src().type,
label: s[t].label,
res: s[t].res,
_yt: s[t].yt,
});
});
var i = "auto",
o = 0,
n =
((c = d(r)).label.auto,
new u(
e,
{
sources: c,
initialySelectedLabel: i,
initialySelectedRes: o,
customSourcePicker: function (
t,
l,
s
) {
return (
e.tech_.ytPlayer.setPlaybackQuality(
l[0]._yt
),
e
);
},
},
l,
a
));
n.el().classList.add("vjs-resolution-button"),
(e.controlBar.resolutionSwitcher =
e.controlBar.addChild(n));
});
})(n);
});
}),
(t.registerPlugin || t.plugin)("videoJsResolutionSwitcher", l);
})(window, e);
})();
});
// ga统计插件
$(document).on("videojs-loaded.videojs-ga", function () {
/*
* videojs-ga - v0.4.2 - 2015-02-06
* Copyright (c) 2015 Michael Bensoussan
* Licensed MIT
*/
(function () {
var __indexOf =
[].indexOf ||
function (item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) return i;
}
return -1;
};
videojs.registerPlugin = videojs.registerPlugin || videojs.plugin;
videojs.registerPlugin("ga", function (options) {
var dataSetupOptions,
defaultsEventsToTrack,
end,
error,
eventCategory,
eventLabel,
eventsToTrack,
fullscreen,
loaded,
parsedOptions,
pause,
percentsAlreadyTracked,
percentsPlayedInterval,
play,
resize,
seekEnd,
seekStart,
seeking,
sendbeacon,
timeupdate,
volumeChange;
if (options == null) {
options = {};
}
dataSetupOptions = {};
if (this.options()["data-setup"]) {
parsedOptions = JSON.parse(this.options()["data-setup"]);
if (parsedOptions.ga) {
dataSetupOptions = parsedOptions.ga;
}
}
defaultsEventsToTrack = [
"loaded",
"percentsPlayed",
"start",
"end",
"seek",
"play",
"pause",
"resize",
"volumeChange",
"error",
"fullscreen",
"downloadvideo",
"resolutionchange",
];
eventsToTrack =
options.eventsToTrack || dataSetupOptions.eventsToTrack || defaultsEventsToTrack;
percentsPlayedInterval =
options.percentsPlayedInterval || dataSetupOptions.percentsPlayedInterval || 10;
eventCategory = options.eventCategory || dataSetupOptions.eventCategory || "Video";
eventLabel = options.eventLabel || dataSetupOptions.eventLabel;
options.debug = options.debug || false;
percentsAlreadyTracked = [];
seekStart = seekEnd = 0;
seeking = false;
loaded = function () {
if (!eventLabel) {
eventLabel = this.currentSrc()
.split("/")
.slice(-1)[0]
.replace(/\.(\w{3,4})(\?.*)?$/i, "");
}
if (__indexOf.call(eventsToTrack, "loadedmetadata") >= 0) {
sendbeacon("loadedmetadata", true);
}
};
timeupdate = function () {
var currentTime, duration, percent, percentPlayed, _i;
currentTime = Math.round(this.currentTime());
duration = Math.round(this.duration());
percentPlayed = Math.round((currentTime / duration) * 100);
for (percent = _i = 0; _i <= 99; percent = _i += percentsPlayedInterval) {
if (
percentPlayed >= percent &&
__indexOf.call(percentsAlreadyTracked, percent) < 0
) {
if (
__indexOf.call(eventsToTrack, "start") >= 0 &&
percent === 0 &&
percentPlayed > 0
) {
sendbeacon("start", false);
} else if (
__indexOf.call(eventsToTrack, "percentsPlayed") >= 0 &&
percentPlayed !== 0
) {
sendbeacon("percent played", false, percent);
// utag ga4
// utagLink({
// 'tealium_event' : 'video_progress',
// 'video_url' : this.currentSrc(),
// 'video_percent': percent
// });
}
if (percentPlayed > 0) {
percentsAlreadyTracked.push(percent);
}
}
}
if (__indexOf.call(eventsToTrack, "seek") >= 0) {
seekStart = seekEnd;
seekEnd = currentTime;
if (Math.abs(seekStart - seekEnd) > 1) {
seeking = true;
sendbeacon("seek start", false, seekStart);
sendbeacon("seek end", false, seekEnd);
}
}
};
var isStart = true;
end = function () {
sendbeacon("end", false);
isStart = true;
// utagLink({
// 'tealium_event' : 'video_complete',
// 'video_url' : this.currentSrc()
// });
};
play = function () {
var currentTime;
currentTime = Math.round(this.currentTime());
sendbeacon("play", false, currentTime);
seeking = false;
if (isStart) {
isStart = false;
// utagLink({
// 'tealium_event' : 'video_start',
// 'video_url' : this.currentSrc()
// });
}
};
pause = function () {
var currentTime, duration;
currentTime = Math.round(this.currentTime());
duration = Math.round(this.duration());
if (currentTime !== duration && !seeking) {
sendbeacon("pause", false, currentTime);
}
};
volumeChange = function () {
var volume;
volume = this.muted() === true ? 0 : this.volume();
sendbeacon("volume change", false, volume);
};
resize = function () {
// sendbeacon('resize - ' + this.width() + "*" + this.height(), true);
};
error = function () {
var currentTime;
currentTime = Math.round(this.currentTime());
sendbeacon("error", true, currentTime);
};
fullscreen = function () {
var currentTime;
currentTime = Math.round(this.currentTime());
if (
(typeof this.isFullscreen === "function" ? this.isFullscreen() : void 0) ||
(typeof this.isFullScreen === "function" ? this.isFullScreen() : void 0)
) {
sendbeacon("enter fullscreen", false, currentTime);
} else {
sendbeacon("exit fullscreen", false, currentTime);
}
};
var downloadvideo = function () {
var currentTime;
currentTime = Math.round(this.currentTime());
sendbeacon("downloadvideo", false, currentTime);
};
var _this = this;
sendbeacon = function (action, nonInteraction, value) {
eventLabel =
_this.currentSrc().split("/").slice(-1)[0] +
"|" +
location.pathname +
location.search;
if (window.ga) {
ga("send", "event", {
eventCategory: eventCategory,
eventAction: action,
eventLabel: eventLabel,
eventValue: value,
nonInteraction: nonInteraction,
});
} else if (window._gaq) {
_gaq.push([
"_trackEvent",
eventCategory,
action,
eventLabel,
value,
nonInteraction,
]);
} else if (options.debug) {
console.log("Google Analytics not detected");
}
};
// function utagLink(options){
// utag.link(options);
// }
this.ready(function () {
this.on("loadedmetadata", loaded);
this.on("timeupdate", timeupdate);
if (__indexOf.call(eventsToTrack, "resolutionchange") >= 0) {
this.on("resolutionchange", function () {
var currentTime = Math.round(this.currentTime());
sendbeacon("resolutionchange", false, currentTime);
});
}
if (__indexOf.call(eventsToTrack, "downloadvideo") >= 0) {
this.on("downloadvideo", downloadvideo);
}
if (__indexOf.call(eventsToTrack, "end") >= 0) {
this.on("ended", end);
}
if (__indexOf.call(eventsToTrack, "play") >= 0) {
this.on("play", play);
}
if (__indexOf.call(eventsToTrack, "pause") >= 0) {
this.on("pause", pause);
}
if (__indexOf.call(eventsToTrack, "volumeChange") >= 0) {
this.on("volumechange", volumeChange);
}
if (__indexOf.call(eventsToTrack, "resize") >= 0) {
this.on("resize", resize);
}
if (__indexOf.call(eventsToTrack, "error") >= 0) {
this.on("error", error);
}
if (__indexOf.call(eventsToTrack, "fullscreen") >= 0) {
return this.on("fullscreenchange", fullscreen);
}
});
return {
sendbeacon: sendbeacon,
};
});
}).call(this);
});
// 下载插件
$(document).on("videojs-loaded.videojs-download", function () {
/**
* videojs-vjsdownload
* @version 1.0.4
* @copyright 2019 7Ds7
* @license Apache-2.0
*/
!(function (e) {
if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
else if ("function" == typeof define && define.amd) define([], e);
else {
var t;
(t =
"undefined" != typeof window
? window
: "undefined" != typeof global
? global
: "undefined" != typeof self
? self
: this),
(t.videojsVjsdownload = e());
}
})(function () {
return (function e(t, o, n) {
function r(l, u) {
if (!o[l]) {
if (!t[l]) {
var f = "function" == typeof require && require;
if (!u && f) return f(l, !0);
if (i) return i(l, !0);
var a = new Error("Cannot find module '" + l + "'");
throw ((a.code = "MODULE_NOT_FOUND"), a);
}
var d = (o[l] = { exports: {} });
t[l][0].call(
d.exports,
function (e) {
var o = t[l][1][e];
return r(o || e);
},
d,
d.exports,
e,
t,
o,
n
);
}
return o[l].exports;
}
for (var i = "function" == typeof require && require, l = 0; l < n.length; l++) r(n[l]);
return r;
})(
{
1: [
function (e, t, o) {
(function (e) {
"use strict";
function n(e, t) {
if (!(e instanceof t))
throw new TypeError("Cannot call a class as a function");
}
function r(e, t) {
if ("function" != typeof t && null !== t)
throw new TypeError(
"Super expression must either be null or a function, not " +
typeof t
);
(e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
enumerable: !1,
writable: !0,
configurable: !0,
},
})),
t &&
(Object.setPrototypeOf
? Object.setPrototypeOf(e, t)
: (e.__proto__ = t));
}
Object.defineProperty(o, "__esModule", { value: !0 });
var i = (function () {
function e(e, t) {
for (var o = 0; o < t.length; o++) {
var n = t[o];
(n.enumerable = n.enumerable || !1),
(n.configurable = !0),
"value" in n && (n.writable = !0),
Object.defineProperty(e, n.key, n);
}
}
return function (t, o, n) {
return o && e(t.prototype, o), n && e(t, n), t;
};
})(),
l = function (e, t, o) {
for (var n = !0; n; ) {
var r = e,
i = t,
l = o;
(n = !1), null === r && (r = Function.prototype);
var u = Object.getOwnPropertyDescriptor(r, i);
if (void 0 !== u) {
if ("value" in u) return u.value;
var f = u.get;
if (void 0 === f) return;
return f.call(l);
}
var a = Object.getPrototypeOf(r);
if (null === a) return;
(e = a), (t = i), (o = l), (n = !0), (u = a = void 0);
}
},
u =
"undefined" != typeof window
? window.videojs
: void 0 !== e
? e.videojs
: null,
f = (function (e) {
return e && e.__esModule ? e : { default: e };
})(u),
a = {
beforeElement: "fullscreenToggle",
textControl: "Download video",
name: "downloadButton",
downloadURL: null,
},
d = f.default.getComponent("Button"),
c = (function (e) {
function t() {
n(this, t),
l(
Object.getPrototypeOf(t.prototype),
"constructor",
this
).apply(this, arguments);
}
return (
r(t, e),
i(t, [
{
key: "buildCSSClass",
value: function () {
return (
"vjs-vjsdownload " +
l(
Object.getPrototypeOf(t.prototype),
"buildCSSClass",
this
).call(this)
);
},
},
{
key: "handleClick",
value: function () {
var e = this.player();
window.open(
this.options_.downloadURL || e.currentSrc(),
"Download"
),
e.trigger("downloadvideo");
},
},
]),
t
);
})(d),
s = function (e, t) {
var o = e.controlBar.addChild(new c(e, t), {});
o.controlText(t.textControl),
e.controlBar
.el()
.insertBefore(
o.el(),
e.controlBar.getChild(t.beforeElement).el()
),
e.addClass("vjs-vjsdownload");
},
p = function (e) {
var t = this;
this.ready(function () {
s(t, f.default.mergeOptions(a, e));
});
};
f.default.registerPlugin("vjsdownload", p),
(o.default = p),
(t.exports = o.default);
}).call(
this,
"undefined" != typeof global
? global
: "undefined" != typeof self
? self
: "undefined" != typeof window
? window
: {}
);
},
{},
],
},
{},
[1]
)(1);
});
});
// 中文语言包
$(document).on("videojs-loaded.videojs-language", function () {
videojs.addLanguage("zh-CN", {
Play: "播放",
Pause: "暂停",
"Current Time": "当前时间",
Duration: "时长",
"Remaining Time": "剩余时间",
"Stream Type": "媒体流类型",
LIVE: "直播",
Loaded: "加载完成",
Progress: "进度",
Fullscreen: "全屏",
"Non-Fullscreen": "退出全屏",
"Picture-in-Picture": "画中画",
"Exit Picture-in-Picture": "退出画中画",
Mute: "静音",
Unmute: "取消静音",
"Playback Rate": "播放速度",
Subtitles: "字幕",
"subtitles off": "关闭字幕",
Captions: "内嵌字幕",
"captions off": "关闭内嵌字幕",
Chapters: "节目段落",
"Close Modal Dialog": "关闭弹窗",
Descriptions: "描述",
"descriptions off": "关闭描述",
"Audio Track": "音轨",
"You aborted the media playback": "视频播放被终止",
"A network error caused the media download to fail part-way.":
"网络错误导致视频下载中途失败。",
"The media could not be loaded, either because the server or network failed or because the format is not supported.":
"视频因格式不支持或者服务器或网络的问题无法加载。",
"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":
"由于视频文件损坏或是该视频使用了你的浏览器不支持的功能,播放终止。",
"No compatible source was found for this media.": "无法找到此视频兼容的源。",
"The media is encrypted and we do not have the keys to decrypt it.":
"视频已加密,无法解密。",
"Play Video": "播放视频",
Close: "关闭",
"Modal Window": "弹窗",
"This is a modal window": "这是一个弹窗",
"This modal can be closed by pressing the Escape key or activating the close button.":
"可以按ESC按键或启用关闭按钮来关闭此弹窗。",
", opens captions settings dialog": ", 开启标题设置弹窗",
", opens subtitles settings dialog": ", 开启字幕设置弹窗",
", opens descriptions settings dialog": ", 开启描述设置弹窗",
", selected": ", 选择",
"captions settings": "字幕设定",
"Audio Player": "音频播放器",
"Video Player": "视频播放器",
Replay: "重新播放",
"Progress Bar": "进度条",
"Volume Level": "音量",
"subtitles settings": "字幕设定",
"descriptions settings": "描述设定",
Text: "文字",
White: "白",
Black: "黑",
Red: "红",
Green: "绿",
Blue: "蓝",
Yellow: "黄",
Magenta: "紫红",
Cyan: "青",
Background: "背景",
Window: "窗口",
Transparent: "透明",
"Semi-Transparent": "半透明",
Opaque: "不透明",
"Font Size": "字体尺寸",
"Text Edge Style": "字体边缘样式",
None: "无",
Raised: "浮雕",
Depressed: "压低",
Uniform: "均匀",
Dropshadow: "下阴影",
"Font Family": "字体库",
"Proportional Sans-Serif": "比例无细体",
"Monospace Sans-Serif": "单间隔无细体",
"Proportional Serif": "比例细体",
"Monospace Serif": "单间隔细体",
Casual: "舒适",
Script: "手写体",
"Small Caps": "小型大写字体",
Reset: "重置",
"restore all settings to the default values": "恢复全部设定至预设值",
Done: "完成",
"Caption Settings Dialog": "字幕设定窗口",
"Beginning of dialog window. Escape will cancel and close the window.":
"打开对话窗口。Escape键将取消并关闭对话窗口",
"End of dialog window.": "结束对话窗口",
"Seek to live, currently behind live": "尝试直播,当前为延时播放",
"Seek to live, currently playing live": "尝试直播,当前为实时播放",
"progress bar timing: currentTime={1} duration={2}": "{1}/{2}",
"{1} is loading.": "正在加载 {1}。",
});
});