ezuikit-js 0.4.0 → 0.4.2
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/demos/base-demo/index.html +5 -5
- package/ezuikit.js +108 -92
- package/package.json +1 -1
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
var playr = new EZUIKit.EZUIKitPlayer({
|
|
34
34
|
id: 'video-container', // 视频容器ID
|
|
35
35
|
accessToken: 'at.740rax9017850gps4kxruugu30cr9gqy-6ezmv0q5bp-0k6u4f4-pgu1gtspi',
|
|
36
|
-
url: 'ezopen://open.ys7.com/C78957921/1.
|
|
37
|
-
template: 'simple', // simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版; theme-可配置主题;
|
|
38
|
-
|
|
36
|
+
url: 'ezopen://open.ys7.com/C78957921/1.rec',
|
|
37
|
+
//template: 'simple', // simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版; theme-可配置主题;
|
|
38
|
+
themeId: "mobileRec",
|
|
39
39
|
autoplay: true,
|
|
40
40
|
// audio: 1, // 是否默认开启声音 0 - 关闭 1 - 开启
|
|
41
41
|
plugin: ['talk'], // 加载插件,talk-对讲
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
handleTalkSuccess: () => console.log("对讲成功回调"),
|
|
46
46
|
handleTalkError: (data) = function(){console.log("对讲失败",data)},
|
|
47
47
|
decoderVersion: "v3.4",
|
|
48
|
-
width:
|
|
49
|
-
height:
|
|
48
|
+
width: 375,
|
|
49
|
+
height:210,
|
|
50
50
|
});
|
|
51
51
|
function fullScreen(){
|
|
52
52
|
var playPromise = playr.fullScreen();
|
package/ezuikit.js
CHANGED
|
@@ -23789,6 +23789,9 @@ var TimeLine$1 = function (jsPlugin) {
|
|
|
23789
23789
|
class Rec {
|
|
23790
23790
|
constructor(jSPlugin) {
|
|
23791
23791
|
this.jSPlugin = jSPlugin;
|
|
23792
|
+
if(!document.getElementById(`${this.jSPlugin.id}-audioControls`)) {
|
|
23793
|
+
return false;
|
|
23794
|
+
}
|
|
23792
23795
|
this.currentTimeWidth = 1; //回放时间轴尺度 1~4
|
|
23793
23796
|
this.timer = null;
|
|
23794
23797
|
this.date = new Date();
|
|
@@ -23909,10 +23912,10 @@ C11.4,16.3,11,16.6,10.6,16.6z" />
|
|
|
23909
23912
|
});
|
|
23910
23913
|
this.syncTimeLine();
|
|
23911
23914
|
// 加载日期选择器
|
|
23912
|
-
addCss(
|
|
23913
|
-
addJs(
|
|
23914
|
-
addJs(
|
|
23915
|
-
addJs(
|
|
23915
|
+
addCss(`${this.jSPlugin.staticPath}/rec/datepicker.min.css`);
|
|
23916
|
+
addJs(`${this.jSPlugin.staticPath}/rec/jquery.min.js`, () => {
|
|
23917
|
+
addJs(`${this.jSPlugin.staticPath}/rec/datepicker.js`, () => {
|
|
23918
|
+
addJs(`${this.jSPlugin.staticPath}/rec/datepicker.zh-CN.js`, () => {
|
|
23916
23919
|
// 日期选择:
|
|
23917
23920
|
$(`#${this.jSPlugin.id}-datepicker`).datepicker({
|
|
23918
23921
|
autoShow: false,
|
|
@@ -25216,9 +25219,9 @@ class Talk {
|
|
|
25216
25219
|
audioRightDOM.setAttribute("controls", true);
|
|
25217
25220
|
audioRight.appendChild(audioRightDOM);
|
|
25218
25221
|
|
|
25219
|
-
addJs(
|
|
25220
|
-
addJs(
|
|
25221
|
-
addJs(
|
|
25222
|
+
addJs(`${this.jSPlugin.staticPath}/talk/adapeter.js`, () => {
|
|
25223
|
+
addJs(`${this.jSPlugin.staticPath}/talk/janus.js`, () => {
|
|
25224
|
+
addJs(`${this.jSPlugin.staticPath}/talk/tts-v4.js`, () => {
|
|
25222
25225
|
// 临时处理
|
|
25223
25226
|
window.EZUIKit["handleTalkError"] = {
|
|
25224
25227
|
handleTalkError: (err)=>{
|
|
@@ -26067,69 +26070,6 @@ class Theme {
|
|
|
26067
26070
|
PC端 & 直播 =》 pcLive
|
|
26068
26071
|
PC端 & 回放地址 => pcRec
|
|
26069
26072
|
*/
|
|
26070
|
-
// switch (matchEzopenUrl(jSPlugin.url).type) {
|
|
26071
|
-
// case 'live':
|
|
26072
|
-
// this.themeData = pcLiveData.data;
|
|
26073
|
-
// if (this.isMobile) {
|
|
26074
|
-
// this.themeData = mobileLiveData.data;
|
|
26075
|
-
// }
|
|
26076
|
-
// break;
|
|
26077
|
-
// case 'rec':
|
|
26078
|
-
// case 'cloud.rec':
|
|
26079
|
-
// this.themeData = pcRecData.data;
|
|
26080
|
-
// if (this.isMobile) {
|
|
26081
|
-
// this.themeData = mobileRecData.data;
|
|
26082
|
-
// }
|
|
26083
|
-
// break;
|
|
26084
|
-
// default:
|
|
26085
|
-
// break;
|
|
26086
|
-
// }
|
|
26087
|
-
// const videoId = jSPlugin.id;
|
|
26088
|
-
// this.header = defaultTheme.header;
|
|
26089
|
-
// this.footer = defaultTheme.footer;
|
|
26090
|
-
// if (!document.getElementById(`${this.jSPlugin.id}-headControl`)) {
|
|
26091
|
-
// const headerContainer = document.createElement('div');
|
|
26092
|
-
// headerContainer.setAttribute('id', `${this.jSPlugin.id}-headControl`);
|
|
26093
|
-
// headerContainer.setAttribute('class', 'head-message');
|
|
26094
|
-
// headerContainer.innerHTML = `<div id='${this.jSPlugin.id}}-headControl-left' style='display:flex'></div><div id='${this.jSPlugin.id}}-headControl-right' style='display:flex'></div>`;
|
|
26095
|
-
// var headerStyle = {
|
|
26096
|
-
// height: "48px",
|
|
26097
|
-
// "line-height": "48px",
|
|
26098
|
-
// display: "flex",
|
|
26099
|
-
// "justify-content": "space-between",
|
|
26100
|
-
// top: 0,
|
|
26101
|
-
// "z-index": 1,
|
|
26102
|
-
// background: "#000000",
|
|
26103
|
-
// color: "#FFFFFF",
|
|
26104
|
-
// width: "100%"
|
|
26105
|
-
// };
|
|
26106
|
-
// headerContainer.style = styleToString(headerStyle);
|
|
26107
|
-
// document.getElementById(`${videoId}-wrap`).insertBefore(headerContainer, document.getElementById(videoId));
|
|
26108
|
-
// }
|
|
26109
|
-
// if (!document.getElementById(`${this.jSPlugin.id}-ez-iframe-footer-container`)) {
|
|
26110
|
-
// const footerContainer = document.createElement('div');
|
|
26111
|
-
// footerContainer.setAttribute('id', `${this.jSPlugin.id}-ez-iframe-footer-container`);
|
|
26112
|
-
// footerContainer.setAttribute('class', 'ez-iframe-footer-container');
|
|
26113
|
-
// var footerStyle = {
|
|
26114
|
-
// "min-height": "48px",
|
|
26115
|
-
// "max-height": "96px",
|
|
26116
|
-
// "position": "relative",
|
|
26117
|
-
// "margin-top": "-48px",
|
|
26118
|
-
// display: "flex",
|
|
26119
|
-
// "flex-wrap": "wrap",
|
|
26120
|
-
// "justify-content": "space-between",
|
|
26121
|
-
// top: 0,
|
|
26122
|
-
// "z-index": 1,
|
|
26123
|
-
// color: "#FFFFFF",
|
|
26124
|
-
// width: "100%"
|
|
26125
|
-
// };
|
|
26126
|
-
// footerContainer.style = styleToString(footerStyle);
|
|
26127
|
-
// footerContainer.innerHTML = `<div id="${this.jSPlugin.id}-audioControls" style='display:flex;justify-content: space-between;height: 48px;width:100%;'><div id='${this.jSPlugin.id}-audioControls-left' style='display:flex'></div><div id='${this.jSPlugin.id}-audioControls-right' style='display:flex'></div></div>`;
|
|
26128
|
-
// insertAfter(footerContainer, document.getElementById(videoId));
|
|
26129
|
-
// }
|
|
26130
|
-
// if (!this.jSPlugin.inited) {
|
|
26131
|
-
// this.initThemeData();
|
|
26132
|
-
// }
|
|
26133
26073
|
if (this.jSPlugin.themeId) {
|
|
26134
26074
|
switch (this.jSPlugin.themeId) {
|
|
26135
26075
|
case 'pcLive':
|
|
@@ -26175,11 +26115,9 @@ class Theme {
|
|
|
26175
26115
|
this.Ptz = new Ptz(jSPlugin);
|
|
26176
26116
|
}
|
|
26177
26117
|
}
|
|
26178
|
-
//设备信息
|
|
26179
|
-
this.getDeviceInfo();
|
|
26180
26118
|
}
|
|
26181
26119
|
fetchThemeData(themeId) {
|
|
26182
|
-
const url =
|
|
26120
|
+
const url = `${this.jSPlugin.env.domain}/jssdk/ezopen/template/getDetail?accessToken=${this.jSPlugin.accessToken}&id=${themeId}`;
|
|
26183
26121
|
fetch(url, {
|
|
26184
26122
|
method: 'GET'
|
|
26185
26123
|
})
|
|
@@ -26351,9 +26289,16 @@ class Theme {
|
|
|
26351
26289
|
}
|
|
26352
26290
|
break;
|
|
26353
26291
|
case 'hd':
|
|
26354
|
-
if (
|
|
26355
|
-
document.getElementById(`${this.jSPlugin.id}-hd`)
|
|
26356
|
-
|
|
26292
|
+
if (options[item]) {
|
|
26293
|
+
if(document.getElementById(`${this.jSPlugin.id}-hd`)) {
|
|
26294
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[0].style = "display:block";
|
|
26295
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[1].style = "display:none";
|
|
26296
|
+
}
|
|
26297
|
+
} else {
|
|
26298
|
+
if(document.getElementById(`${this.jSPlugin.id}-hd`)) {
|
|
26299
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[1].style = "display:block";
|
|
26300
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[0].style = "display:none";
|
|
26301
|
+
}
|
|
26357
26302
|
}
|
|
26358
26303
|
break;
|
|
26359
26304
|
case 'cloudRec':
|
|
@@ -26807,8 +26752,7 @@ class Theme {
|
|
|
26807
26752
|
btnItem.onclick = (e) => {
|
|
26808
26753
|
const { hd } = this.decoderState.state;
|
|
26809
26754
|
// 选择清晰度选项时才触发事件
|
|
26810
|
-
|
|
26811
|
-
if (hd && e.target.id === 'select-sd') {
|
|
26755
|
+
if (hd && e.target.id === `${this.jSPlugin.id}-select-sd`) {
|
|
26812
26756
|
//decoder.changePlayUrl({ hd: false });
|
|
26813
26757
|
console.log("切换到标清");
|
|
26814
26758
|
this.jSPlugin.changePlayUrl({ hd: false });
|
|
@@ -27019,6 +26963,8 @@ class Theme {
|
|
|
27019
26963
|
window.addEventListener(item, (data) => fullscreenchange());
|
|
27020
26964
|
});
|
|
27021
26965
|
this.inited = true;
|
|
26966
|
+
//设备信息
|
|
26967
|
+
this.getDeviceInfo();
|
|
27022
26968
|
}
|
|
27023
26969
|
getDeviceInfo() {
|
|
27024
26970
|
const deviceAPISuccess = (data) => {
|
|
@@ -28639,15 +28585,47 @@ var EZUIKitV3$1 = EZUIKitV3;
|
|
|
28639
28585
|
|
|
28640
28586
|
/* eslint-disable valid-jsdoc */
|
|
28641
28587
|
|
|
28588
|
+
// iframe模板 - 兼容旧版本
|
|
28589
|
+
const matchTemplate = (templateName, params) => {
|
|
28590
|
+
const IFRAMETEMPLATE = ['simple','standard','security','vioce','theme'];
|
|
28591
|
+
const LOCALTEMPLATE = ['pcLive','pcRec','mobileLive','mobileRec','noData'];
|
|
28592
|
+
if(typeof templateName === 'undefined') {
|
|
28593
|
+
return {
|
|
28594
|
+
templateType: 'local',
|
|
28595
|
+
templateId: ''
|
|
28596
|
+
}
|
|
28597
|
+
} if (typeof templateName === 'string') {
|
|
28598
|
+
|
|
28599
|
+
if(templateName.length === 32) {
|
|
28600
|
+
return {
|
|
28601
|
+
templateType: 'remote',
|
|
28602
|
+
templateId: templateName
|
|
28603
|
+
}
|
|
28604
|
+
} else if (IFRAMETEMPLATE.indexOf(templateName) !== -1) {
|
|
28605
|
+
// 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
|
|
28606
|
+
if (templateName === 'simple' && typeof params.header === 'undefined' && typeof params.footer === 'undefined') {
|
|
28607
|
+
return {
|
|
28608
|
+
templateType: 'local',
|
|
28609
|
+
templateId: ''
|
|
28610
|
+
}
|
|
28611
|
+
}
|
|
28612
|
+
return {
|
|
28613
|
+
templateType: 'iframe',
|
|
28614
|
+
templateId: templateName
|
|
28615
|
+
}
|
|
28616
|
+
} else if (LOCALTEMPLATE.indexOf(templateName) !== -1) {
|
|
28617
|
+
return {
|
|
28618
|
+
templateType: 'local',
|
|
28619
|
+
templateId: templateName
|
|
28620
|
+
}
|
|
28621
|
+
}
|
|
28622
|
+
}
|
|
28623
|
+
};
|
|
28624
|
+
|
|
28642
28625
|
class EZUIKitPlayer {
|
|
28643
28626
|
constructor(params) {
|
|
28644
28627
|
const { autoplay = true } = params;
|
|
28645
28628
|
this.params = params;
|
|
28646
|
-
// 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
|
|
28647
|
-
if (this.params.template && this.params.template === 'simple' && typeof this.params.header === 'undefined' && typeof this.params.footer === 'undefined') {
|
|
28648
|
-
this.params.themeId = "";
|
|
28649
|
-
delete this.params.template;
|
|
28650
|
-
}
|
|
28651
28629
|
window.EZUIKit[params.id] = {state: {
|
|
28652
28630
|
EZUIKitPlayer: {
|
|
28653
28631
|
init: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.init || false,
|
|
@@ -28655,18 +28633,22 @@ class EZUIKitPlayer {
|
|
|
28655
28633
|
talkInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit || false
|
|
28656
28634
|
}}
|
|
28657
28635
|
};
|
|
28658
|
-
if
|
|
28636
|
+
if(matchTemplate(this.params.template, params).templateType !== 'iframe'){
|
|
28659
28637
|
this.id = params.id;
|
|
28660
28638
|
this.width = params.width;
|
|
28661
28639
|
this.height = params.height;
|
|
28662
28640
|
this.url = params.url;
|
|
28663
28641
|
this.accessToken = params.accessToken;
|
|
28664
|
-
this.themeId = params.
|
|
28642
|
+
this.themeId = matchTemplate(params.template, params).templateId;
|
|
28665
28643
|
this.id = params.id;
|
|
28666
28644
|
this.audio = params.audio;
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
|
|
28645
|
+
this.staticPath = "https://open.ys7.com/assets/ezuikit_v4.0";
|
|
28646
|
+
if(typeof params.staticPath === 'string') {
|
|
28647
|
+
this.staticPath = params.staticPath;
|
|
28648
|
+
}
|
|
28649
|
+
addJs(`${this.staticPath}/js/AudioRenderer.js`, () => {
|
|
28650
|
+
addJs(`${this.staticPath}/js/SuperRender_10.js`, () => {
|
|
28651
|
+
addJs(`${this.staticPath}/js/jsPlugin-4.0.2.min.js`, () => {
|
|
28670
28652
|
var initEZUIKitPlayerPromise = this.initEZUIKitPlayer(params);
|
|
28671
28653
|
initEZUIKitPlayerPromise.then((data) => {
|
|
28672
28654
|
console.log("初始化成功", data);
|
|
@@ -28691,7 +28673,7 @@ class EZUIKitPlayer {
|
|
|
28691
28673
|
}
|
|
28692
28674
|
}
|
|
28693
28675
|
initEZUIKitPlayer(params) {
|
|
28694
|
-
const { id,
|
|
28676
|
+
const { id, width = 600, height = 400 } = params;
|
|
28695
28677
|
if (!document.getElementById(`${id}-wrap`)) {
|
|
28696
28678
|
document.getElementById(id).style = `display:inline-block;width:${width}px;height:${height}px;`;
|
|
28697
28679
|
var wapDom = document.createElement("div");
|
|
@@ -28710,6 +28692,7 @@ class EZUIKitPlayer {
|
|
|
28710
28692
|
iMaxSplit: 1,
|
|
28711
28693
|
iCurrentSplit: 1,
|
|
28712
28694
|
szBasePath: "",
|
|
28695
|
+
staticPath: params.staticPath,
|
|
28713
28696
|
oStyle: {
|
|
28714
28697
|
border: "none",
|
|
28715
28698
|
background: "#000000"
|
|
@@ -28768,7 +28751,7 @@ class EZUIKitPlayer {
|
|
|
28768
28751
|
}
|
|
28769
28752
|
this.errorHander = new Code();
|
|
28770
28753
|
this.jSPlugin = jSPlugin;
|
|
28771
|
-
if (themeId && !window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit) {
|
|
28754
|
+
if (this.themeId && !window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit) {
|
|
28772
28755
|
this.Theme = new Theme(this, id);
|
|
28773
28756
|
window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
|
|
28774
28757
|
}
|
|
@@ -29100,6 +29083,9 @@ class EZUIKitPlayer {
|
|
|
29100
29083
|
};
|
|
29101
29084
|
}
|
|
29102
29085
|
var wsUrl = getPlayParams(data).websocketConnectUrl;
|
|
29086
|
+
if(this.env && this.env.wsUrl) {
|
|
29087
|
+
wsUrl = this.env.wsUrl;
|
|
29088
|
+
}
|
|
29103
29089
|
var wsParams = {
|
|
29104
29090
|
playURL: getPlayParams(data).websocketStreamingParam
|
|
29105
29091
|
};
|
|
@@ -29275,7 +29261,7 @@ class EZUIKitPlayer {
|
|
|
29275
29261
|
return promise;
|
|
29276
29262
|
}
|
|
29277
29263
|
capturePicture(name, callback = false) {
|
|
29278
|
-
var capturePictureRT = this.jSPlugin.JS_CapturePicture(0, name, "JPEG", callback);
|
|
29264
|
+
var capturePictureRT = this.jSPlugin.JS_CapturePicture(0, name, "JPEG", callback, !!callback);
|
|
29279
29265
|
if (isPromise(capturePictureRT)) {
|
|
29280
29266
|
return capturePictureRT;
|
|
29281
29267
|
}
|
|
@@ -29353,9 +29339,39 @@ class EZUIKitPlayer {
|
|
|
29353
29339
|
reSize(width, height) {
|
|
29354
29340
|
this.width = width;
|
|
29355
29341
|
this.height = height;
|
|
29356
|
-
document.getElementById(`${this.id}-wrap`).style
|
|
29342
|
+
document.getElementById(`${this.id}-wrap`).style = `width:${width}px;position:relative;`;
|
|
29357
29343
|
this.jSPlugin.JS_Resize(width, height);
|
|
29358
29344
|
}
|
|
29345
|
+
fast() {
|
|
29346
|
+
var fastRT = this.jSPlugin.JS_Fast(0);
|
|
29347
|
+
console.log("JS_Fast", fastRT);
|
|
29348
|
+
if (isPromise(fastRT)) {
|
|
29349
|
+
return fastRT;
|
|
29350
|
+
}
|
|
29351
|
+
return new Promise(function (resolve) {
|
|
29352
|
+
resolve(fastRT);
|
|
29353
|
+
});
|
|
29354
|
+
}
|
|
29355
|
+
slow() {
|
|
29356
|
+
var slowRT = this.jSPlugin.JS_Slow(0);
|
|
29357
|
+
console.log("slowRT", slowRT);
|
|
29358
|
+
if (isPromise(slowRT)) {
|
|
29359
|
+
return slowRT;
|
|
29360
|
+
}
|
|
29361
|
+
return new Promise(function (resolve) {
|
|
29362
|
+
resolve(slowRT);
|
|
29363
|
+
});
|
|
29364
|
+
}
|
|
29365
|
+
seek(startTime, endTime) {
|
|
29366
|
+
var seekRT = this.jSPlugin.JS_Seek(0,startTime, endTime);
|
|
29367
|
+
console.log("seekRT", seekRT);
|
|
29368
|
+
if (isPromise(seekRT)) {
|
|
29369
|
+
return seekRT;
|
|
29370
|
+
}
|
|
29371
|
+
return new Promise(function (resolve) {
|
|
29372
|
+
resolve(seekRT);
|
|
29373
|
+
});
|
|
29374
|
+
}
|
|
29359
29375
|
fullScreen() {
|
|
29360
29376
|
var promise = requestFullScreenPromise(document.getElementById(`${this.id}`));
|
|
29361
29377
|
promise.then((data) => {
|