ezuikit-js 0.4.1-beta.0 → 0.4.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/demos/base-demo/index.html +5 -5
- package/ezuikit.js +57 -82
- 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
|
@@ -26067,69 +26067,6 @@ class Theme {
|
|
|
26067
26067
|
PC端 & 直播 =》 pcLive
|
|
26068
26068
|
PC端 & 回放地址 => pcRec
|
|
26069
26069
|
*/
|
|
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
26070
|
if (this.jSPlugin.themeId) {
|
|
26134
26071
|
switch (this.jSPlugin.themeId) {
|
|
26135
26072
|
case 'pcLive':
|
|
@@ -26175,11 +26112,9 @@ class Theme {
|
|
|
26175
26112
|
this.Ptz = new Ptz(jSPlugin);
|
|
26176
26113
|
}
|
|
26177
26114
|
}
|
|
26178
|
-
//设备信息
|
|
26179
|
-
this.getDeviceInfo();
|
|
26180
26115
|
}
|
|
26181
26116
|
fetchThemeData(themeId) {
|
|
26182
|
-
const url =
|
|
26117
|
+
const url = `${this.jSPlugin.env.domain}/jssdk/ezopen/template/getDetail?accessToken=${this.jSPlugin.accessToken}&id=${themeId}`;
|
|
26183
26118
|
fetch(url, {
|
|
26184
26119
|
method: 'GET'
|
|
26185
26120
|
})
|
|
@@ -26351,9 +26286,16 @@ class Theme {
|
|
|
26351
26286
|
}
|
|
26352
26287
|
break;
|
|
26353
26288
|
case 'hd':
|
|
26354
|
-
if (
|
|
26355
|
-
document.getElementById(`${this.jSPlugin.id}-hd`)
|
|
26356
|
-
|
|
26289
|
+
if (options[item]) {
|
|
26290
|
+
if(document.getElementById(`${this.jSPlugin.id}-hd`)) {
|
|
26291
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[0].style = "display:block";
|
|
26292
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[1].style = "display:none";
|
|
26293
|
+
}
|
|
26294
|
+
} else {
|
|
26295
|
+
if(document.getElementById(`${this.jSPlugin.id}-hd`)) {
|
|
26296
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[1].style = "display:block";
|
|
26297
|
+
document.getElementById(`${this.jSPlugin.id}-hd-content`).children[1].children[0].style = "display:none";
|
|
26298
|
+
}
|
|
26357
26299
|
}
|
|
26358
26300
|
break;
|
|
26359
26301
|
case 'cloudRec':
|
|
@@ -26807,8 +26749,7 @@ class Theme {
|
|
|
26807
26749
|
btnItem.onclick = (e) => {
|
|
26808
26750
|
const { hd } = this.decoderState.state;
|
|
26809
26751
|
// 选择清晰度选项时才触发事件
|
|
26810
|
-
|
|
26811
|
-
if (hd && e.target.id === 'select-sd') {
|
|
26752
|
+
if (hd && e.target.id === `${this.jSPlugin.id}-select-sd`) {
|
|
26812
26753
|
//decoder.changePlayUrl({ hd: false });
|
|
26813
26754
|
console.log("切换到标清");
|
|
26814
26755
|
this.jSPlugin.changePlayUrl({ hd: false });
|
|
@@ -27019,6 +26960,8 @@ class Theme {
|
|
|
27019
26960
|
window.addEventListener(item, (data) => fullscreenchange());
|
|
27020
26961
|
});
|
|
27021
26962
|
this.inited = true;
|
|
26963
|
+
//设备信息
|
|
26964
|
+
this.getDeviceInfo();
|
|
27022
26965
|
}
|
|
27023
26966
|
getDeviceInfo() {
|
|
27024
26967
|
const deviceAPISuccess = (data) => {
|
|
@@ -28639,15 +28582,47 @@ var EZUIKitV3$1 = EZUIKitV3;
|
|
|
28639
28582
|
|
|
28640
28583
|
/* eslint-disable valid-jsdoc */
|
|
28641
28584
|
|
|
28585
|
+
// iframe模板 - 兼容旧版本
|
|
28586
|
+
const matchTemplate = (templateName, params) => {
|
|
28587
|
+
const IFRAMETEMPLATE = ['simple','standard','security','vioce','theme'];
|
|
28588
|
+
const LOCALTEMPLATE = ['pcLive','pcRec','mobileLive','mobileRec','noData'];
|
|
28589
|
+
if(typeof templateName === 'undefined') {
|
|
28590
|
+
return {
|
|
28591
|
+
templateType: 'local',
|
|
28592
|
+
templateId: ''
|
|
28593
|
+
}
|
|
28594
|
+
} if (typeof templateName === 'string') {
|
|
28595
|
+
|
|
28596
|
+
if(templateName.length === 32) {
|
|
28597
|
+
return {
|
|
28598
|
+
templateType: 'remote',
|
|
28599
|
+
templateId: templateName
|
|
28600
|
+
}
|
|
28601
|
+
} else if (IFRAMETEMPLATE.indexOf(templateName) !== -1) {
|
|
28602
|
+
// 精简版且不使用头部,底部,仅播放视频,建议使用按需加载避免iframe内存额外消耗
|
|
28603
|
+
if (templateName === 'simple' && typeof params.header === 'undefined' && typeof params.footer === 'undefined') {
|
|
28604
|
+
return {
|
|
28605
|
+
templateType: 'local',
|
|
28606
|
+
templateId: ''
|
|
28607
|
+
}
|
|
28608
|
+
}
|
|
28609
|
+
return {
|
|
28610
|
+
templateType: 'iframe',
|
|
28611
|
+
templateId: templateName
|
|
28612
|
+
}
|
|
28613
|
+
} else if (LOCALTEMPLATE.indexOf(templateName) !== -1) {
|
|
28614
|
+
return {
|
|
28615
|
+
templateType: 'local',
|
|
28616
|
+
templateId: templateName
|
|
28617
|
+
}
|
|
28618
|
+
}
|
|
28619
|
+
}
|
|
28620
|
+
};
|
|
28621
|
+
|
|
28642
28622
|
class EZUIKitPlayer {
|
|
28643
28623
|
constructor(params) {
|
|
28644
28624
|
const { autoplay = true } = params;
|
|
28645
28625
|
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
28626
|
window.EZUIKit[params.id] = {state: {
|
|
28652
28627
|
EZUIKitPlayer: {
|
|
28653
28628
|
init: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.init || false,
|
|
@@ -28655,18 +28630,18 @@ class EZUIKitPlayer {
|
|
|
28655
28630
|
talkInit: window.EZUIKit[params.id] && window.EZUIKit[params.id].state && window.EZUIKit[params.id].state.EZUIKitPlayer.talkInit || false
|
|
28656
28631
|
}}
|
|
28657
28632
|
};
|
|
28658
|
-
if
|
|
28633
|
+
if(matchTemplate(this.params.template, params).templateType !== 'iframe'){
|
|
28659
28634
|
this.id = params.id;
|
|
28660
28635
|
this.width = params.width;
|
|
28661
28636
|
this.height = params.height;
|
|
28662
28637
|
this.url = params.url;
|
|
28663
28638
|
this.accessToken = params.accessToken;
|
|
28664
|
-
this.themeId = params.
|
|
28639
|
+
this.themeId = matchTemplate(params.template, params).templateId;
|
|
28665
28640
|
this.id = params.id;
|
|
28666
28641
|
this.audio = params.audio;
|
|
28667
28642
|
addJs("https://open.ys7.com/assets/ezuikit_v4.0/js/AudioRenderer.js", () => {
|
|
28668
28643
|
addJs("https://open.ys7.com/assets/ezuikit_v4.0/js/SuperRender_10.js", () => {
|
|
28669
|
-
addJs("https://
|
|
28644
|
+
addJs("https://open.ys7.com/assets/ezuikit_v4.0/js/jsPlugin-4.0.1.min.js", () => {
|
|
28670
28645
|
var initEZUIKitPlayerPromise = this.initEZUIKitPlayer(params);
|
|
28671
28646
|
initEZUIKitPlayerPromise.then((data) => {
|
|
28672
28647
|
console.log("初始化成功", data);
|
|
@@ -28691,7 +28666,7 @@ class EZUIKitPlayer {
|
|
|
28691
28666
|
}
|
|
28692
28667
|
}
|
|
28693
28668
|
initEZUIKitPlayer(params) {
|
|
28694
|
-
const { id,
|
|
28669
|
+
const { id, width = 600, height = 400 } = params;
|
|
28695
28670
|
if (!document.getElementById(`${id}-wrap`)) {
|
|
28696
28671
|
document.getElementById(id).style = `display:inline-block;width:${width}px;height:${height}px;`;
|
|
28697
28672
|
var wapDom = document.createElement("div");
|
|
@@ -28768,7 +28743,7 @@ class EZUIKitPlayer {
|
|
|
28768
28743
|
}
|
|
28769
28744
|
this.errorHander = new Code();
|
|
28770
28745
|
this.jSPlugin = jSPlugin;
|
|
28771
|
-
if (themeId && !window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit) {
|
|
28746
|
+
if (this.themeId && !window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit) {
|
|
28772
28747
|
this.Theme = new Theme(this, id);
|
|
28773
28748
|
window.EZUIKit[params.id].state.EZUIKitPlayer.themeInit = true;
|
|
28774
28749
|
}
|
|
@@ -29353,7 +29328,7 @@ class EZUIKitPlayer {
|
|
|
29353
29328
|
reSize(width, height) {
|
|
29354
29329
|
this.width = width;
|
|
29355
29330
|
this.height = height;
|
|
29356
|
-
document.getElementById(`${this.id}-wrap`).style
|
|
29331
|
+
document.getElementById(`${this.id}-wrap`).style = `width:${width}px;position:relative;`;
|
|
29357
29332
|
this.jSPlugin.JS_Resize(width, height);
|
|
29358
29333
|
}
|
|
29359
29334
|
fullScreen() {
|