Skip to content

Commit daeeced

Browse files
committed
docs: update
1 parent 3832ebb commit daeeced

File tree

1 file changed

+68
-60
lines changed

1 file changed

+68
-60
lines changed

README.md

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pnpm add ezuikit-js
3030
### 引入 ezuikit-js
3131

3232
```js
33-
import EZUIKit from 'ezuikit-js';
33+
import EZUIKit from "ezuikit-js";
3434
```
3535

3636
#### 如果你使用原生方法,可以通过标签引用
@@ -56,13 +56,14 @@ import EZUIKit from 'ezuikit-js';
5656

5757
```js
5858
const player = new EZUIKit.EZUIKitPlayer({
59-
id: 'video-container', // 视频容器ID
60-
accessToken: 'at.3bvmj4ycamlgdwgw1ig1jruma0wpohl6-48zifyb39c-13t5am6-yukyi86mz',
61-
url: 'ezopen://open.ys7.com/BD3957004/1.live',
59+
id: "video-container", // 视频容器ID
60+
accessToken:
61+
"at.3bvmj4ycamlgdwgw1ig1jruma0wpohl6-48zifyb39c-13t5am6-yukyi86mz",
62+
url: "ezopen://open.ys7.com/BD3957004/1.live",
6263
width: 600,
6364
height: 400,
6465
handleError: (err) => {
65-
if (err.type === 'handleRunTimeInfoError' && err.data.nErrorCode === 5) {
66+
if (err.type === "handleRunTimeInfoError" && err.data.nErrorCode === 5) {
6667
// 加密设备密码错误
6768
}
6869
},
@@ -73,11 +74,12 @@ const player = new EZUIKit.EZUIKitPlayer({
7374

7475
```js
7576
const player = new EZUIKit.EZUIKitPlayer({
76-
id: 'video-container', // 视频容器ID
77+
id: "video-container", // 视频容器ID
7778
width: 600,
7879
height: 400,
79-
accessToken: 'at.3bvmj4ycamlgdwgw1ig1jruma0wpohl6-48zifyb39c-13t5am6-yukyi86mz',
80-
url: 'ezopen://open.ys7.com/BD3957004/1.rec',
80+
accessToken:
81+
"at.3bvmj4ycamlgdwgw1ig1jruma0wpohl6-48zifyb39c-13t5am6-yukyi86mz",
82+
url: "ezopen://open.ys7.com/BD3957004/1.rec",
8183
});
8284
```
8385

@@ -115,14 +117,14 @@ alpha(功能测试)、beta(集成测试)为我们的非正式版本,
115117
116118
```js
117119
const player = new EZUIKit.EZUIKitPlayer({
118-
id: 'playWind',
120+
id: "playWind",
119121
width: 600,
120122
height: 400,
121-
template: 'pcLive',
122-
url: '',
123-
accessToken: '',
123+
template: "pcLive",
124+
url: "",
125+
accessToken: "",
124126
env: {
125-
domain: 'https://iusopen.ezvizlife.com', // 北美地区
127+
domain: "https://iusopen.ezvizlife.com", // 北美地区
126128
},
127129
});
128130
```
@@ -203,7 +205,7 @@ ezopen://open.ys7.com/${设备序列号}/{通道号}.hd.live<br/>
203205

204206
##### 云存储回放
205207

206-
初始化参数 url 值为:<br/> ezopen://open.ys7.com/${设备序列号}/{通道号}.cloud.rec?begin=yyyyMMddhhmmss视频 ezopen 协议播放地址 详见:<a href="https://open.ys7.com/help/23" target="_blank">ezopen 协议</a> </td><td>Y</td></tr>
208+
初始化参数 url 值为:<br/> ezopen://open.ys7.com/${设备序列号}/{通道号}.cloud.rec?begin=yyyyMMddhhmmss 视频 ezopen 协议播放地址 详见:<a href="https://open.ys7.com/help/23" target="_blank">ezopen 协议</a> </td><td>Y</td></tr>
207209

208210
<tr><td>audio</td><td>boolean</td><td>是否默认开启声音 true:打开(默认) false:关闭 </td><td>N</td></tr>
209211
<tr><td>width</td><td>int</td><td>视频宽度,默认值为容器容器DOM宽度 </td><td>Y</td></tr>
@@ -378,7 +380,7 @@ themeData将主题数据本地化,设置本地数据,需要删除template参
378380
player.play();
379381
// 方式2
380382
player.play().then(() => {
381-
console.log('执行播放成功后其他动作');
383+
console.log("执行播放成功后其他动作");
382384
});
383385
```
384386

@@ -389,7 +391,7 @@ player.play().then(() => {
389391
player.stop();
390392
// 方式2
391393
player.stop().then(() => {
392-
console.log('执行停止成功后其他动作');
394+
console.log("执行停止成功后其他动作");
393395
});
394396
```
395397

@@ -400,7 +402,7 @@ player.stop().then(() => {
400402
player.openSound();
401403
// 方式2
402404
player.openSound().then(() => {
403-
console.log('执行开启声音成功后其他动作');
405+
console.log("执行开启声音成功后其他动作");
404406
});
405407
```
406408

@@ -417,10 +419,10 @@ player.closeSound();
417419
418420
```js
419421
// 方式1
420-
player.startSave('唯一文件名');
422+
player.startSave("唯一文件名");
421423
// 方式2
422-
player.startSave('唯一文件名').then(() => {
423-
console.log('执行开始录制成功后其他动作');
424+
player.startSave("唯一文件名").then(() => {
425+
console.log("执行开始录制成功后其他动作");
424426
});
425427
```
426428

@@ -431,20 +433,20 @@ player.startSave('唯一文件名').then(() => {
431433
player.stopSave();
432434
// 方式2
433435
player.stopSave().then(() => {
434-
console.log('执行停止录制成功后其他动作');
436+
console.log("执行停止录制成功后其他动作");
435437
});
436438
```
437439

438440
#### 抓图
439441

440442
```js
441443
// 方式1 - 下载到本地
442-
player.capturePicture('文件名');
444+
player.capturePicture("文件名");
443445
// 方式2 - 返回base64格式
444446
const capCallback = (data) => {
445-
console.log('data', data);
447+
console.log("data", data);
446448
};
447-
player.capturePicture('default', capCallback);
449+
player.capturePicture("default", capCallback);
448450
```
449451

450452
#### 开始对讲
@@ -497,7 +499,7 @@ player.setProfile({ microphoneId });
497499
#### 监听麦克风音量变化
498500

499501
```js
500-
player.eventEmitter.on('volumeChange', ({ data }) => {
502+
player.eventEmitter.on("volumeChange", ({ data }) => {
501503
// 动态显示音柱,100ms触发一次
502504
console.log(`${data * 100}%`);
503505
});
@@ -519,7 +521,7 @@ player.cancelFullScreen();
519521

520522
```js
521523
player.getOSDTime().then((time) => {
522-
console.log('获取到的当前播放时间', time);
524+
console.log("获取到的当前播放时间", time);
523525
});
524526
```
525527

@@ -529,7 +531,7 @@ player.getOSDTime().then((time) => {
529531
530532
```js
531533
player.changePlayUrl(options).then(() => {
532-
console.log('切换成功');
534+
console.log("切换成功");
533535
});
534536
```
535537

@@ -554,9 +556,9 @@ options 参数说明
554556
player.Theme.changeTheme(template);
555557

556558
// 预览切回放场景示例
557-
player.changePlayUrl({ type: 'rec' }).then(() => {
558-
console.log('地址切换成功,开始切换模板主题');
559-
player.Theme.changeTheme('pcRec');
559+
player.changePlayUrl({ type: "rec" }).then(() => {
560+
console.log("地址切换成功,开始切换模板主题");
561+
player.Theme.changeTheme("pcRec");
560562
});
561563
```
562564

@@ -575,7 +577,7 @@ template 参数说明
575577
player.enableZoom();
576578
// 方式2
577579
player.enableZoom().then(() => {
578-
console.log('开启电子放大成功');
580+
console.log("开启电子放大成功");
579581
});
580582
```
581583

@@ -586,7 +588,7 @@ player.enableZoom().then(() => {
586588
player.closeZoom();
587589
// 方式2
588590
player.closeZoom().then(() => {
589-
console.log('关闭电子放大成功');
591+
console.log("关闭电子放大成功");
590592
});
591593
```
592594

@@ -632,7 +634,7 @@ options 参数说明
632634

633635
## 事件
634636

635-
所有事件名 `EZUIKitPlayer.EVENTS`, 事件监听player.eventEmitter.on() 和事件取消 player.eventEmitter.off()
637+
所有事件名 `EZUIKitPlayer.EVENTS`, 事件监听 player.eventEmitter.on() 和事件取消 player.eventEmitter.off()
636638

637639
#### 流信息事件
638640

@@ -642,7 +644,7 @@ options 参数说明
642644
// 监听流信息事件
643645
player.eventEmitter.on(EZUIKitPlayer.EVENTS.streamInfoCB, (info) => {
644646
// 包括 视频信息 音频信息
645-
console.log('streamInfoCB', info);
647+
console.log("streamInfoCB", info);
646648
});
647649
```
648650

@@ -661,7 +663,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.streamInfoCB, (info) => {
661663
// 监听音频信息变化
662664
player.eventEmitter.on(EZUIKitPlayer.EVENTS.audioInfo, (info) => {
663665
// {"audioFormat":8193,"audioFormatName":"AAC","audioChannels":1,"audioBitsPerSample":16,"audioSamplesRate":16000,"audioBitRate":32000}
664-
console.log('audioInfo', info);
666+
console.log("audioInfo", info);
665667
});
666668
```
667669

@@ -682,7 +684,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.audioInfo, (info) => {
682684
// 监听视频信息变化
683685
player.eventEmitter.on(EZUIKitPlayer.EVENTS.videoInfo, (info) => {
684686
// {"videoFormat":5,"videoFormatName":"H265","width":3840,"height":2160,"frameRate":15,"intervalOfIFrame":0}
685-
console.log('videoInfo', info);
687+
console.log("videoInfo", info);
686688
});
687689
```
688690

@@ -701,7 +703,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.videoInfo, (info) => {
701703
// 监听截图事件
702704
player.eventEmitter.on(EZUIKitPlayer.EVENTS.capturePicture, (info) => {
703705
// {data: CapturePictureInfoDate}
704-
console.log('capturePictureInfo', info);
706+
console.log("capturePictureInfo", info);
705707
});
706708
```
707709

@@ -718,7 +720,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.capturePicture, (info) => {
718720
// 监听截图事件
719721
player.eventEmitter.on(EZUIKitPlayer.EVENTS.capturePicture, (info) => {
720722
// {data: CapturePictureInfoData}
721-
console.log('capturePictureInfo', info);
723+
console.log("capturePictureInfo", info);
722724
});
723725
```
724726

@@ -735,7 +737,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.capturePicture, (info) => {
735737
// 监听截图事件
736738
player.eventEmitter.on(EZUIKitPlayer.EVENTS.changeVideoLevel, (info) => {
737739
// {data: VideoLevelData}
738-
console.log('changeVideoLevel', info);
740+
console.log("changeVideoLevel", info);
739741
});
740742
```
741743

@@ -785,7 +787,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.destroy, () => {
785787
});
786788
```
787789

788-
### 全屏相关事件
790+
#### 全屏相关事件
789791

790792
全屏事件 `EZUIKitPlayer.EVENTS.fullscreen`
791793

@@ -815,7 +817,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.exitFullscreen, () => {
815817
// 监听全屏变化事件
816818
player.eventEmitter.on(EZUIKitPlayer.EVENTS.fullscreenChange, (data) => {
817819
// {data: FullscreenChangeData}
818-
console.log('fullscreenChange', data);
820+
console.log("fullscreenChange", data);
819821
});
820822
```
821823

@@ -841,15 +843,15 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.init, () => {
841843
});
842844
```
843845

844-
#### resize事件
846+
#### resize 事件
845847

846-
resize事件事件 `EZUIKitPlayer.EVENTS.resize`
848+
resize 事件事件 `EZUIKitPlayer.EVENTS.resize`
847849

848850
```js
849851
// 监听resize事件
850852
player.eventEmitter.on(EZUIKitPlayer.EVENTS.resize, () => {
851853
// {data: {"width": number,"height":number}}
852-
console.log('resize', data);
854+
console.log("resize", data);
853855
});
854856
```
855857

@@ -886,9 +888,9 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.resume, () => {
886888
});
887889
```
888890

889-
#### seek事件
891+
#### seek 事件
890892

891-
seek事件 `EZUIKitPlayer.EVENTS.seek`, 仅支持回放
893+
seek 事件 `EZUIKitPlayer.EVENTS.seek`, 仅支持回放
892894

893895
```js
894896
// 监听seek事件
@@ -960,18 +962,21 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.recTimeChange, () => {
960962
// 监听获取云存储回片段事件
961963
player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getCloudRecTimes, (list) => {
962964
// {data: {"width": number,"height":number}}
963-
console.log('list', list);
965+
console.log("list", list);
964966
});
965967
```
966968

967969
获取云录制回片段事件 `EZUIKitPlayer.EVENTS.http.getCloudRecordTimes`
968970

969971
```js
970972
// 监听获取云录制回片段事件
971-
player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getCloudRecordTimes, (list) => {
972-
// {data: {"width": number,"height":number}}
973-
console.log('list', list);
974-
});
973+
player.eventEmitter.on(
974+
EZUIKitPlayer.EVENTS.http.getCloudRecordTimes,
975+
(list) => {
976+
// {data: {"width": number,"height":number}}
977+
console.log("list", list);
978+
}
979+
);
975980
```
976981

977982
获取本地录制回片段事件 `EZUIKitPlayer.EVENTS.http.getLocalRecTimes`
@@ -980,7 +985,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getCloudRecordTimes, (list) =>
980985
// 监听获取本地录制回片段事件
981986
player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getLocalRecTimes, (list) => {
982987
// {data: {"width": number,"height":number}}
983-
console.log('list', list);
988+
console.log("list", list);
984989
});
985990
```
986991

@@ -990,7 +995,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getLocalRecTimes, (list) => {
990995
// 监听获取设备信息事件
991996
player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getDeviceInfo, (info) => {
992997
// {"deviceSerial":"BC7799091","deviceName":"前端设备勿动 C6Wi(BC7799091)","localName":"C6Wi(BC7799091)","model":"CS-C6Wi-8D8W2DF","status":1,"defence":0,"isEncrypt":0,"alarmSoundMode":2,"offlineNotify":0,"category":"C6Wi","parentCategory":"IPC","updateTime":1741763026000,"netType":"wireless","signal":"0%","riskLevel":0,"netAddress":"125.121.197.61"}
993-
console.log('info', info);
998+
console.log("info", info);
994999
});
9951000
```
9961001

@@ -1000,7 +1005,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getDeviceInfo, (info) => {
10001005
// 监听获取设备信息事件
10011006
player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getDeviceList, (info) => {
10021007
// {"deviceSerial":"BC7799091","deviceName":"前端设备勿动 C6Wi(BC7799091)","localName":"C6Wi(BC7799091)","model":"CS-C6Wi-8D8W2DF","status":1,"defence":0,"isEncrypt":0,"alarmSoundMode":2,"offlineNotify":0,"category":"C6Wi","parentCategory":"IPC","updateTime":1741763026000,"netType":"wireless","signal":"0%","riskLevel":0,"netAddress":"125.121.197.61"}
1003-
console.log('info', info);
1008+
console.log("info", info);
10041009
});
10051010
```
10061011

@@ -1086,7 +1091,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.talkSuccess, () => {
10861091
// 监听对讲开启失败事件
10871092
player.eventEmitter.on(EZUIKitPlayer.EVENTS.talkError, (error) => {
10881093
// ...
1089-
console.error('talkError', error);
1094+
console.error("talkError", error);
10901095
});
10911096
```
10921097

@@ -1137,7 +1142,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.zoom.closeZoom, () => {
11371142
// 监听电子放大变化事件
11381143
player.eventEmitter.on(EZUIKitPlayer.EVENTS.zoom.onZoomChange, (info) => {
11391144
// {"zoom": string,"reset"?:boolean}
1140-
console.log('onZoomChange', info);
1145+
console.log("onZoomChange", info);
11411146
});
11421147
```
11431148

@@ -1194,10 +1199,13 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.ptz.ptzDirection, () => {
11941199

11951200
```js
11961201
// 监听点击云台控制控件方向事件
1197-
player.eventEmitter.on(EZUIKitPlayer.EVENTS.timeLine.timeWidthChange, (widthType) => {
1198-
// ...
1199-
console.log('timeWidthChange', widthType); // 0 | 1 | 2 | 3
1200-
});
1202+
player.eventEmitter.on(
1203+
EZUIKitPlayer.EVENTS.timeLine.timeWidthChange,
1204+
(widthType) => {
1205+
// ...
1206+
console.log("timeWidthChange", widthType); // 0 | 1 | 2 | 3
1207+
}
1208+
);
12011209
```
12021210

12031211
#### 日期选择器相关事件

0 commit comments

Comments
 (0)