@@ -110,6 +110,7 @@ var addJs = function addJs(filepath, callback, isReadyFun) {
110110 if (!isReady) {
111111 var oJs = document.createElement("script");
112112 oJs.setAttribute("src", filepath);
113+ oJs.setAttribute("crossorigin", true);
113114 oJs.onload = callback;
114115 document.getElementsByTagName("head")[0].appendChild(oJs);
115116 } else {
@@ -31877,6 +31878,12 @@ var matchTemplate = function matchTemplate(templateName, params) {
3187731878 }
3187831879};
3187931880
31881+ var isVersion2Available = function isVersion2Available() {
31882+ var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
31883+ var isSharedArrayBuffer = window.SharedArrayBuffer;
31884+ return isSharedArrayBuffer && !isMobile;
31885+ };
31886+
3188031887var EZUIKitPlayer = /*#__PURE__*/function () {
3188131888 function EZUIKitPlayer(params) {
3188231889 var _this = this;
@@ -31911,11 +31918,13 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
3191131918 this.poster = params.poster;
3191231919 this.speed = 1;
3191331920 this.disabledTimeLine = false;
31921+ this.disabledPTZ = false;
31922+ this.enableSharedArrayBufferGuide = false;
3191431923 this.capacity = {};
3191531924 this.env = {
3191631925 domain: "https://open.ys7.com"
3191731926 };
31918- this.staticPath = "https://open.ys7.com/assets/ezuikit_v4.0";
31927+ this.staticPath = isVersion2Available() ? "https://open.ys7.com/assets/ezuikit_v5.0" : "https://open.ys7.com/assets/ezuikit_v4.0";
3191931928
3192031929 if (typeof params.staticPath === 'string') {
3192131930 this.staticPath = params.staticPath;
@@ -31929,7 +31938,66 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
3192931938 this.disabledTimeLine = params.disabledTimeLine;
3193031939 }
3193131940
31932- addJs("".concat(this.staticPath, "/js/jsPlugin-4.0.2.min.js"), function () {
31941+ if (typeof params.disabledPTZ !== 'undefined') {
31942+ this.disabledPTZ = params.disabledPTZ;
31943+ }
31944+
31945+ if (typeof params.enableSharedArrayBufferGuide !== 'undefined') {
31946+ this.enableSharedArrayBufferGuide = params.enableSharedArrayBufferGuide;
31947+ }
31948+
31949+ var pluginUrl = "".concat(this.staticPath, "/js/jsPlugin-4.0.2.min.js");
31950+
31951+ if (isVersion2Available()) {
31952+ console.log("启用多线程解析视频");
31953+ pluginUrl = "".concat(this.staticPath, "/jsPlugin-2.0.0.min.js");
31954+ } else {
31955+ // 是否引导用户开启谷歌实验室 Google Labs 特性
31956+ //enableSharedArrayBufferGuide
31957+ var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
31958+
31959+ var getChromeVersion = function getChromeVersion() {
31960+ var arr = navigator.userAgent.split(' ');
31961+ var chromeVersion = '';
31962+
31963+ for (var i = 0; i < arr.length; i++) {
31964+ if (/chrome/i.test(arr[i])) {
31965+ chromeVersion = arr[i];
31966+ }
31967+ }
31968+
31969+ if (chromeVersion) {
31970+ return Number(chromeVersion.split('/')[1].split('.')[0]);
31971+ }
31972+
31973+ return false;
31974+ }; // pc端 谷歌浏览器 版本92 ~ 105
31975+
31976+
31977+ if (!isMobile && 91 < getChromeVersion < 106 && this.enableSharedArrayBufferGuide) {
31978+ console.log("提示用户开启谷歌实验室特性");
31979+ var wapDomId = "".concat(this.id, "-wrap");
31980+ var guideDom = document.createElement("div");
31981+ var guideSpan = document.createElement("span");
31982+ guideSpan.innerHTML = "您当前浏览器可以开启谷歌实验室多线程特性,获取更好播放体验,避免浏览器卡顿及崩溃,详见";
31983+ guideDom.appendChild(guideSpan);
31984+ var guideLink = document.createElement("a");
31985+ guideLink.href = "https://open.ys7.com/help/384";
31986+ guideLink.setAttribute("target", "_blank");
31987+ guideDom.appendChild(guideLink);
31988+ guideLink.innerHTML = "开启说明"; //guideDom.innerHTML = "您的浏览器当前使用单进程播放视频,可能因内存占用过高导致浏览器卡顿,您可参考·谷歌浏览器开启多线程(链接)·开启谷歌实验室多线程特性,获取更好播放体验";
31989+
31990+ guideDom.id = "".concat(this.id, "-guide");
31991+ guideDom.style = "font-size:12px;color:red;";
31992+ setTimeout(function () {
31993+ if (document.getElementById(wapDomId)) {
31994+ document.getElementById(wapDomId).insertBefore(guideDom, document.getElementById(_this.id));
31995+ }
31996+ }, 5000);
31997+ }
31998+ }
31999+
32000+ addJs(pluginUrl, function () {
3193332001 if (autoplay) {
3193432002 _this.initTime = new Date().getTime();
3193532003
@@ -32194,7 +32262,11 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
3219432262 var validateCode = getQueryString('checkCode', realUrl);
3219532263
3219632264 if (validateCode) {
32197- _this3.jSPlugin.JS_SetSecretKey(0, validateCode);
32265+ if (typeof _this3.jSPlugin.decoderVersion !== 'undefined' && _this3.jSPlugin.decoderVersion === '2.0') {
32266+ _this3.validateCode = validateCode;
32267+ } else {
32268+ _this3.jSPlugin.JS_SetSecretKey(0, validateCode);
32269+ }
3219832270 } // 回放处理
3219932271
3220032272
@@ -32503,6 +32575,10 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
3250332575 this.jSPlugin.JS_Play(wsUrl, wsParams, 0).then(function () {
3250432576 console.log("播放成功");
3250532577
32578+ if (_this4.validateCode && typeof _this4.jSPlugin.decoderVersion !== 'undefined' && _this4.jSPlugin.decoderVersion === '2.0') {
32579+ _this4.jSPlugin.JS_SetSecretKey(0, _this4.validateCode);
32580+ }
32581+
3250632582 _this4.pluginStatus.loadingClear();
3250732583
3250832584 _this4.pluginStatus.setPlayStatus({
@@ -32661,19 +32737,23 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
3266132737 this.url = url;
3266232738 var promise = new Promise(function (resolve, reject) {
3266332739 _this7.stop().then(function () {
32740+ console.log("changePlayUrl stop success");
32741+
3266432742 if (options.accessToken) {
3266532743 _this7.accessToken = options.accessToken;
3266632744 return _this7.play({
3266732745 accessToken: options.accessToken,
3266832746 url: url
3266932747 }).then(function () {
32748+ console.log("changePlayUrl replay success");
3267032749 resolve(url);
3267132750 })["catch"](function (err) {
3267232751 reject(url);
3267332752 });
3267432753 }
3267532754
3267632755 _this7.play(url).then(function () {
32756+ console.log("changePlayUrl replay success");
3267732757 resolve(url);
3267832758 })["catch"](function (err) {
3267932759 reject(url);
@@ -33152,9 +33232,9 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
3315233232 var end = defaultTime.length;
3315333233 var standardTime = time + defaultTime.substring(start, end);
3315433234 return standardTime.slice(0, 8) + 'T' + standardTime.slice(8) + 'Z';
33155- } else {
33156- throw new Error('回放时间格式有误,请确认');
3315733235 }
33236+
33237+ throw new Error('回放时间格式有误,请确认');
3315833238 }
3315933239
3316033240 var seekRT = this.jSPlugin.JS_Seek(0, startTime, endTime);
0 commit comments