ezuikit-js 0.5.9 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
- v 0.5.8
1
+ v 0.6.0
2
+
3
+ [fix]兼容低版本火狐浏览器播放视频
4
+
5
+ [fix]修复网站全屏模式下,再次执行视频全屏冲突问题
6
+
7
+
8
+ v 0.5.9
2
9
 
3
10
  [feta]支持用户通过开启谷歌实验室特性启动多线程解码
4
11
 
@@ -319,13 +319,15 @@ var HLS = /*#__PURE__*/function () {
319
319
 
320
320
  _classCallCheck$1(this, HLS);
321
321
 
322
- addJs("https://open.ys7.com/sdk/js/2.0/js/hls.min.js", function () {
322
+ addJs("https://open.ys7.com/assets/ezuikit_v3.4/js/hls.js", function () {
323
323
  console.log("加载hls.min.js成功", window.Hls);
324
324
  console.log("isSupportHls", window.Hls.isSupported());
325
325
 
326
326
  if (window.Hls.isSupported()) {
327
327
  _this.initHLS(videoId, url);
328
328
  }
329
+ }, function () {
330
+ return !!window.Hls;
329
331
  });
330
332
  }
331
333
 
@@ -23755,7 +23757,7 @@ Janus$1.init = function (options) {
23755
23757
  } else if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome' && Janus$1.webRTCAdapter.browserDetails.version < 72) {
23756
23758
  // Chrome does, but it's only usable from version 72 on
23757
23759
  Janus$1.unifiedPlan = false;
23758
- } else if (!('currentDirection' in RTCRtpTransceiver.prototype)) {
23760
+ } else if (typeof RTCRtpTransceiver !== 'undefined' && !('currentDirection' in RTCRtpTransceiver.prototype)) {
23759
23761
  // Safari supports addTransceiver() but not Unified Plan when
23760
23762
  // currentDirection is not defined (see codepen above)
23761
23763
  Janus$1.unifiedPlan = false;
@@ -30795,6 +30797,27 @@ var Monitor = /*#__PURE__*/function () {
30795
30797
  params.clickEventHandle(event.data);
30796
30798
  }
30797
30799
 
30800
+ break;
30801
+
30802
+ case 'iframeFullScreen':
30803
+ if (id == event.data.id) {
30804
+ var requestFullScreen = function requestFullScreen(element) {
30805
+ var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
30806
+
30807
+ if (requestMethod) {
30808
+ requestMethod.call(element);
30809
+ } else if (typeof window.ActiveXObject !== "undefined") {
30810
+ var wscript = new ActiveXObject("WScript.Shell");
30811
+
30812
+ if (wscript !== null) {
30813
+ wscript.SendKeys("{F11}");
30814
+ }
30815
+ }
30816
+ };
30817
+
30818
+ requestFullScreen(document.getElementById("EZUIKitPlayer-" + event.data.id));
30819
+ }
30820
+
30798
30821
  break;
30799
30822
  }
30800
30823
  }
@@ -31223,6 +31246,18 @@ var Monitor = /*#__PURE__*/function () {
31223
31246
  };
31224
31247
 
31225
31248
  EZUIKitPlayer.prototype.changePlayUrl = function (data) {
31249
+ if (data.deviceSerial) {
31250
+ this.opt.deviceSerial = data.deviceSerial;
31251
+ }
31252
+
31253
+ if (data.channelNo) {
31254
+ this.opt.channelNo = data.channelNo;
31255
+ }
31256
+
31257
+ if (data.accessToken) {
31258
+ this.opt.accessToken = data.accessToken;
31259
+ }
31260
+
31226
31261
  var id = 'EZUIKitPlayer-' + this.opt.id;
31227
31262
  var player = document.getElementById(id).contentWindow;
31228
31263
  player.postMessage({
@@ -31879,9 +31914,40 @@ var matchTemplate = function matchTemplate(templateName, params) {
31879
31914
  };
31880
31915
 
31881
31916
  var isVersion2Available = function isVersion2Available() {
31917
+ var ua = window.navigator.userAgent.toLowerCase(); //获取用户端信息
31918
+
31919
+ var info = {
31920
+ sa: /version.*safari/.test(ua),
31921
+ //匹配Safari浏览器
31922
+ ch: /chrome/.test(ua),
31923
+ //匹配Chrome浏览器
31924
+ ff: /gecko/.test(ua) && !/webkit/.test(ua) //匹配Firefox浏览器
31925
+
31926
+ };
31882
31927
  var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
31883
- var isSharedArrayBuffer = window.SharedArrayBuffer;
31884
- return isSharedArrayBuffer && !isMobile;
31928
+
31929
+ if (isMobile) {
31930
+ return false;
31931
+ } else if (info.ch) {
31932
+ var getChromeVersion = function getChromeVersion() {
31933
+ var arr = window.navigator.userAgent.split(' ');
31934
+ var chromeVersion = '';
31935
+
31936
+ for (var i = 0; i < arr.length; i++) {
31937
+ if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
31938
+ }
31939
+
31940
+ if (chromeVersion) {
31941
+ return Number(chromeVersion.split('/')[1].split('.')[0]);
31942
+ } else {
31943
+ return false;
31944
+ }
31945
+ };
31946
+
31947
+ return getChromeVersion() > 91 && !!window.SharedArrayBuffer;
31948
+ }
31949
+
31950
+ return false;
31885
31951
  };
31886
31952
 
31887
31953
  var EZUIKitPlayer = /*#__PURE__*/function () {
@@ -32106,20 +32172,40 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
32106
32172
  }
32107
32173
 
32108
32174
  var initDecoder = function initDecoder(resolve, reject) {
32109
- var jSPlugin = new window.JSPlugin({
32110
- szId: id,
32111
- iType: 2,
32112
- iWidth: width,
32113
- iHeight: height,
32114
- iMaxSplit: 1,
32115
- iCurrentSplit: 1,
32116
- szBasePath: "",
32117
- staticPath: params.staticPath,
32118
- oStyle: {
32119
- border: "none",
32120
- background: "#000000"
32121
- }
32122
- });
32175
+ var jSPlugin;
32176
+
32177
+ if (isVersion2Available()) {
32178
+ jSPlugin = new window.JSPlugin({
32179
+ szId: id,
32180
+ iType: 2,
32181
+ iWidth: width,
32182
+ iHeight: height,
32183
+ iMaxSplit: 1,
32184
+ iCurrentSplit: 1,
32185
+ szBasePath: "",
32186
+ staticPath: params.staticPath,
32187
+ oStyle: {
32188
+ border: "none",
32189
+ background: "#000000"
32190
+ }
32191
+ });
32192
+ } else {
32193
+ jSPlugin = new window.JSPlugin({
32194
+ szId: id,
32195
+ iType: 2,
32196
+ iWidth: width,
32197
+ iHeight: height,
32198
+ iMaxSplit: 1,
32199
+ iCurrentSplit: 1,
32200
+ szBasePath: "",
32201
+ staticPath: params.staticPath,
32202
+ oStyle: {
32203
+ border: "none",
32204
+ background: "#000000"
32205
+ }
32206
+ });
32207
+ }
32208
+
32123
32209
  jSPlugin.EventCallback = {
32124
32210
  loadEventHandler: function loadEventHandler() {},
32125
32211
  zoomEventResponse: function
@@ -0,0 +1,24 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
7
+ <title>Document</title>
8
+ <script src="./ezuikit.js"></script>
9
+ </head>
10
+
11
+ <body>
12
+ <div className="demo">
13
+ <h2>视频模式使用示例:</h2>
14
+ <video id="hlsId" autoplay controls style="width: 600px;height:400px"></video>
15
+ <video id="hlsId2" autoplay controls style="width: 600px;height:400px"></video>
16
+ </div>
17
+ <script>
18
+ var hlsDemo = new EZUIKit.HLS("hlsId","https://open.ys7.com/v3/openlive/C78957921_1_2.m3u8?expire=1687488306&id=461844489422516224&t=96ea4ce49d2ea4f2f65d045edbe8fa1a51ef9fac6f38e150052bc64a91c27db7&ev=100");
19
+
20
+ var hlsDemo2 = new EZUIKit.HLS("hlsId2","https://open.ys7.com/v3/openlive/G39444019_1_2.m3u8?expire=1687487466&id=461840962679742464&t=c076d5a5ad56090e919a6a2500b96169c20a77874cce866a87a7d65e493e6f2f&ev=100");
21
+ </script>
22
+ </body>
23
+
24
+ </html>
package/ezuikit.js CHANGED
@@ -319,13 +319,15 @@ var HLS = /*#__PURE__*/function () {
319
319
 
320
320
  _classCallCheck$1(this, HLS);
321
321
 
322
- addJs("https://open.ys7.com/sdk/js/2.0/js/hls.min.js", function () {
322
+ addJs("https://open.ys7.com/assets/ezuikit_v3.4/js/hls.js", function () {
323
323
  console.log("加载hls.min.js成功", window.Hls);
324
324
  console.log("isSupportHls", window.Hls.isSupported());
325
325
 
326
326
  if (window.Hls.isSupported()) {
327
327
  _this.initHLS(videoId, url);
328
328
  }
329
+ }, function () {
330
+ return !!window.Hls;
329
331
  });
330
332
  }
331
333
 
@@ -23755,7 +23757,7 @@ Janus$1.init = function (options) {
23755
23757
  } else if (Janus$1.webRTCAdapter.browserDetails.browser === 'chrome' && Janus$1.webRTCAdapter.browserDetails.version < 72) {
23756
23758
  // Chrome does, but it's only usable from version 72 on
23757
23759
  Janus$1.unifiedPlan = false;
23758
- } else if (!('currentDirection' in RTCRtpTransceiver.prototype)) {
23760
+ } else if (typeof RTCRtpTransceiver !== 'undefined' && !('currentDirection' in RTCRtpTransceiver.prototype)) {
23759
23761
  // Safari supports addTransceiver() but not Unified Plan when
23760
23762
  // currentDirection is not defined (see codepen above)
23761
23763
  Janus$1.unifiedPlan = false;
@@ -30795,6 +30797,27 @@ var Monitor = /*#__PURE__*/function () {
30795
30797
  params.clickEventHandle(event.data);
30796
30798
  }
30797
30799
 
30800
+ break;
30801
+
30802
+ case 'iframeFullScreen':
30803
+ if (id == event.data.id) {
30804
+ var requestFullScreen = function requestFullScreen(element) {
30805
+ var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
30806
+
30807
+ if (requestMethod) {
30808
+ requestMethod.call(element);
30809
+ } else if (typeof window.ActiveXObject !== "undefined") {
30810
+ var wscript = new ActiveXObject("WScript.Shell");
30811
+
30812
+ if (wscript !== null) {
30813
+ wscript.SendKeys("{F11}");
30814
+ }
30815
+ }
30816
+ };
30817
+
30818
+ requestFullScreen(document.getElementById("EZUIKitPlayer-" + event.data.id));
30819
+ }
30820
+
30798
30821
  break;
30799
30822
  }
30800
30823
  }
@@ -31223,6 +31246,18 @@ var Monitor = /*#__PURE__*/function () {
31223
31246
  };
31224
31247
 
31225
31248
  EZUIKitPlayer.prototype.changePlayUrl = function (data) {
31249
+ if (data.deviceSerial) {
31250
+ this.opt.deviceSerial = data.deviceSerial;
31251
+ }
31252
+
31253
+ if (data.channelNo) {
31254
+ this.opt.channelNo = data.channelNo;
31255
+ }
31256
+
31257
+ if (data.accessToken) {
31258
+ this.opt.accessToken = data.accessToken;
31259
+ }
31260
+
31226
31261
  var id = 'EZUIKitPlayer-' + this.opt.id;
31227
31262
  var player = document.getElementById(id).contentWindow;
31228
31263
  player.postMessage({
@@ -31879,9 +31914,40 @@ var matchTemplate = function matchTemplate(templateName, params) {
31879
31914
  };
31880
31915
 
31881
31916
  var isVersion2Available = function isVersion2Available() {
31917
+ var ua = window.navigator.userAgent.toLowerCase(); //获取用户端信息
31918
+
31919
+ var info = {
31920
+ sa: /version.*safari/.test(ua),
31921
+ //匹配Safari浏览器
31922
+ ch: /chrome/.test(ua),
31923
+ //匹配Chrome浏览器
31924
+ ff: /gecko/.test(ua) && !/webkit/.test(ua) //匹配Firefox浏览器
31925
+
31926
+ };
31882
31927
  var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
31883
- var isSharedArrayBuffer = window.SharedArrayBuffer;
31884
- return isSharedArrayBuffer && !isMobile;
31928
+
31929
+ if (isMobile) {
31930
+ return false;
31931
+ } else if (info.ch) {
31932
+ var getChromeVersion = function getChromeVersion() {
31933
+ var arr = window.navigator.userAgent.split(' ');
31934
+ var chromeVersion = '';
31935
+
31936
+ for (var i = 0; i < arr.length; i++) {
31937
+ if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
31938
+ }
31939
+
31940
+ if (chromeVersion) {
31941
+ return Number(chromeVersion.split('/')[1].split('.')[0]);
31942
+ } else {
31943
+ return false;
31944
+ }
31945
+ };
31946
+
31947
+ return getChromeVersion() > 91 && !!window.SharedArrayBuffer;
31948
+ }
31949
+
31950
+ return false;
31885
31951
  };
31886
31952
 
31887
31953
  var EZUIKitPlayer = /*#__PURE__*/function () {
@@ -32106,20 +32172,40 @@ var EZUIKitPlayer = /*#__PURE__*/function () {
32106
32172
  }
32107
32173
 
32108
32174
  var initDecoder = function initDecoder(resolve, reject) {
32109
- var jSPlugin = new window.JSPlugin({
32110
- szId: id,
32111
- iType: 2,
32112
- iWidth: width,
32113
- iHeight: height,
32114
- iMaxSplit: 1,
32115
- iCurrentSplit: 1,
32116
- szBasePath: "",
32117
- staticPath: params.staticPath,
32118
- oStyle: {
32119
- border: "none",
32120
- background: "#000000"
32121
- }
32122
- });
32175
+ var jSPlugin;
32176
+
32177
+ if (isVersion2Available()) {
32178
+ jSPlugin = new window.JSPlugin({
32179
+ szId: id,
32180
+ iType: 2,
32181
+ iWidth: width,
32182
+ iHeight: height,
32183
+ iMaxSplit: 1,
32184
+ iCurrentSplit: 1,
32185
+ szBasePath: "",
32186
+ staticPath: params.staticPath,
32187
+ oStyle: {
32188
+ border: "none",
32189
+ background: "#000000"
32190
+ }
32191
+ });
32192
+ } else {
32193
+ jSPlugin = new window.JSPlugin({
32194
+ szId: id,
32195
+ iType: 2,
32196
+ iWidth: width,
32197
+ iHeight: height,
32198
+ iMaxSplit: 1,
32199
+ iCurrentSplit: 1,
32200
+ szBasePath: "",
32201
+ staticPath: params.staticPath,
32202
+ oStyle: {
32203
+ border: "none",
32204
+ background: "#000000"
32205
+ }
32206
+ });
32207
+ }
32208
+
32123
32209
  jSPlugin.EventCallback = {
32124
32210
  loadEventHandler: function loadEventHandler() {},
32125
32211
  zoomEventResponse: function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezuikit-js",
3
- "version": "0.5.9",
3
+ "version": "0.6.1",
4
4
  "description": "ezuikit javascript for npm",
5
5
  "main": "ezuikit.js",
6
6
  "scripts": {