@@ -30,7 +30,7 @@ pnpm add ezuikit-js
30
30
### 引入 ezuikit-js
31
31
32
32
``` js
33
- import EZUIKit from ' ezuikit-js' ;
33
+ import EZUIKit from " ezuikit-js" ;
34
34
```
35
35
36
36
#### 如果你使用原生方法,可以通过标签引用
@@ -56,13 +56,14 @@ import EZUIKit from 'ezuikit-js';
56
56
57
57
``` js
58
58
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" ,
62
63
width: 600 ,
63
64
height: 400 ,
64
65
handleError : (err ) => {
65
- if (err .type === ' handleRunTimeInfoError' && err .data .nErrorCode === 5 ) {
66
+ if (err .type === " handleRunTimeInfoError" && err .data .nErrorCode === 5 ) {
66
67
// 加密设备密码错误
67
68
}
68
69
},
@@ -73,11 +74,12 @@ const player = new EZUIKit.EZUIKitPlayer({
73
74
74
75
``` js
75
76
const player = new EZUIKit.EZUIKitPlayer ({
76
- id: ' video-container' , // 视频容器ID
77
+ id: " video-container" , // 视频容器ID
77
78
width: 600 ,
78
79
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" ,
81
83
});
82
84
```
83
85
@@ -115,14 +117,14 @@ alpha(功能测试)、beta(集成测试)为我们的非正式版本,
115
117
116
118
``` js
117
119
const player = new EZUIKit.EZUIKitPlayer ({
118
- id: ' playWind' ,
120
+ id: " playWind" ,
119
121
width: 600 ,
120
122
height: 400 ,
121
- template: ' pcLive' ,
122
- url: ' ' ,
123
- accessToken: ' ' ,
123
+ template: " pcLive" ,
124
+ url: " " ,
125
+ accessToken: " " ,
124
126
env: {
125
- domain: ' https://iusopen.ezvizlife.com' , // 北美地区
127
+ domain: " https://iusopen.ezvizlife.com" , // 北美地区
126
128
},
127
129
});
128
130
```
@@ -203,7 +205,7 @@ ezopen://open.ys7.com/${设备序列号}/{通道号}.hd.live<br/>
203
205
204
206
##### 云存储回放
205
207
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 >
207
209
208
210
<tr ><td >audio</td ><td >boolean</td ><td >是否默认开启声音 true:打开(默认) false:关闭 </td ><td >N</td ></tr >
209
211
<tr ><td >width</td ><td >int</td ><td >视频宽度,默认值为容器容器DOM宽度 </td ><td >Y</td ></tr >
@@ -378,7 +380,7 @@ themeData将主题数据本地化,设置本地数据,需要删除template参
378
380
player .play ();
379
381
// 方式2
380
382
player .play ().then (() => {
381
- console .log (' 执行播放成功后其他动作' );
383
+ console .log (" 执行播放成功后其他动作" );
382
384
});
383
385
```
384
386
@@ -389,7 +391,7 @@ player.play().then(() => {
389
391
player .stop ();
390
392
// 方式2
391
393
player .stop ().then (() => {
392
- console .log (' 执行停止成功后其他动作' );
394
+ console .log (" 执行停止成功后其他动作" );
393
395
});
394
396
```
395
397
@@ -400,7 +402,7 @@ player.stop().then(() => {
400
402
player .openSound ();
401
403
// 方式2
402
404
player .openSound ().then (() => {
403
- console .log (' 执行开启声音成功后其他动作' );
405
+ console .log (" 执行开启声音成功后其他动作" );
404
406
});
405
407
```
406
408
@@ -417,10 +419,10 @@ player.closeSound();
417
419
418
420
``` js
419
421
// 方式1
420
- player .startSave (' 唯一文件名' );
422
+ player .startSave (" 唯一文件名" );
421
423
// 方式2
422
- player .startSave (' 唯一文件名' ).then (() => {
423
- console .log (' 执行开始录制成功后其他动作' );
424
+ player .startSave (" 唯一文件名" ).then (() => {
425
+ console .log (" 执行开始录制成功后其他动作" );
424
426
});
425
427
```
426
428
@@ -431,20 +433,20 @@ player.startSave('唯一文件名').then(() => {
431
433
player .stopSave ();
432
434
// 方式2
433
435
player .stopSave ().then (() => {
434
- console .log (' 执行停止录制成功后其他动作' );
436
+ console .log (" 执行停止录制成功后其他动作" );
435
437
});
436
438
```
437
439
438
440
#### 抓图
439
441
440
442
``` js
441
443
// 方式1 - 下载到本地
442
- player .capturePicture (' 文件名' );
444
+ player .capturePicture (" 文件名" );
443
445
// 方式2 - 返回base64格式
444
446
const capCallback = (data ) => {
445
- console .log (' data' , data);
447
+ console .log (" data" , data);
446
448
};
447
- player .capturePicture (' default' , capCallback);
449
+ player .capturePicture (" default" , capCallback);
448
450
```
449
451
450
452
#### 开始对讲
@@ -497,7 +499,7 @@ player.setProfile({ microphoneId });
497
499
#### 监听麦克风音量变化
498
500
499
501
``` js
500
- player .eventEmitter .on (' volumeChange' , ({ data }) => {
502
+ player .eventEmitter .on (" volumeChange" , ({ data }) => {
501
503
// 动态显示音柱,100ms触发一次
502
504
console .log (` ${ data * 100 } %` );
503
505
});
@@ -519,7 +521,7 @@ player.cancelFullScreen();
519
521
520
522
``` js
521
523
player .getOSDTime ().then ((time ) => {
522
- console .log (' 获取到的当前播放时间' , time);
524
+ console .log (" 获取到的当前播放时间" , time);
523
525
});
524
526
```
525
527
@@ -529,7 +531,7 @@ player.getOSDTime().then((time) => {
529
531
530
532
``` js
531
533
player .changePlayUrl (options).then (() => {
532
- console .log (' 切换成功' );
534
+ console .log (" 切换成功" );
533
535
});
534
536
```
535
537
@@ -554,9 +556,9 @@ options 参数说明
554
556
player .Theme .changeTheme (template);
555
557
556
558
// 预览切回放场景示例
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" );
560
562
});
561
563
```
562
564
@@ -575,7 +577,7 @@ template 参数说明
575
577
player .enableZoom ();
576
578
// 方式2
577
579
player .enableZoom ().then (() => {
578
- console .log (' 开启电子放大成功' );
580
+ console .log (" 开启电子放大成功" );
579
581
});
580
582
```
581
583
@@ -586,7 +588,7 @@ player.enableZoom().then(() => {
586
588
player .closeZoom ();
587
589
// 方式2
588
590
player .closeZoom ().then (() => {
589
- console .log (' 关闭电子放大成功' );
591
+ console .log (" 关闭电子放大成功" );
590
592
});
591
593
```
592
594
@@ -632,7 +634,7 @@ options 参数说明
632
634
633
635
## 事件
634
636
635
- 所有事件名 ` EZUIKitPlayer.EVENTS ` , 事件监听player .eventEmitter.on() 和事件取消 player.eventEmitter.off()
637
+ 所有事件名 ` EZUIKitPlayer.EVENTS ` , 事件监听 player .eventEmitter.on() 和事件取消 player.eventEmitter.off()
636
638
637
639
#### 流信息事件
638
640
@@ -642,7 +644,7 @@ options 参数说明
642
644
// 监听流信息事件
643
645
player .eventEmitter .on (EZUIKitPlayer .EVENTS .streamInfoCB , (info ) => {
644
646
// 包括 视频信息 音频信息
645
- console .log (' streamInfoCB' , info);
647
+ console .log (" streamInfoCB" , info);
646
648
});
647
649
```
648
650
@@ -661,7 +663,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.streamInfoCB, (info) => {
661
663
// 监听音频信息变化
662
664
player .eventEmitter .on (EZUIKitPlayer .EVENTS .audioInfo , (info ) => {
663
665
// {"audioFormat":8193,"audioFormatName":"AAC","audioChannels":1,"audioBitsPerSample":16,"audioSamplesRate":16000,"audioBitRate":32000}
664
- console .log (' audioInfo' , info);
666
+ console .log (" audioInfo" , info);
665
667
});
666
668
```
667
669
@@ -682,7 +684,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.audioInfo, (info) => {
682
684
// 监听视频信息变化
683
685
player .eventEmitter .on (EZUIKitPlayer .EVENTS .videoInfo , (info ) => {
684
686
// {"videoFormat":5,"videoFormatName":"H265","width":3840,"height":2160,"frameRate":15,"intervalOfIFrame":0}
685
- console .log (' videoInfo' , info);
687
+ console .log (" videoInfo" , info);
686
688
});
687
689
```
688
690
@@ -701,7 +703,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.videoInfo, (info) => {
701
703
// 监听截图事件
702
704
player .eventEmitter .on (EZUIKitPlayer .EVENTS .capturePicture , (info ) => {
703
705
// {data: CapturePictureInfoDate}
704
- console .log (' capturePictureInfo' , info);
706
+ console .log (" capturePictureInfo" , info);
705
707
});
706
708
```
707
709
@@ -718,7 +720,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.capturePicture, (info) => {
718
720
// 监听截图事件
719
721
player .eventEmitter .on (EZUIKitPlayer .EVENTS .capturePicture , (info ) => {
720
722
// {data: CapturePictureInfoData}
721
- console .log (' capturePictureInfo' , info);
723
+ console .log (" capturePictureInfo" , info);
722
724
});
723
725
```
724
726
@@ -735,7 +737,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.capturePicture, (info) => {
735
737
// 监听截图事件
736
738
player .eventEmitter .on (EZUIKitPlayer .EVENTS .changeVideoLevel , (info ) => {
737
739
// {data: VideoLevelData}
738
- console .log (' changeVideoLevel' , info);
740
+ console .log (" changeVideoLevel" , info);
739
741
});
740
742
```
741
743
@@ -785,7 +787,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.destroy, () => {
785
787
});
786
788
```
787
789
788
- ### 全屏相关事件
790
+ #### 全屏相关事件
789
791
790
792
全屏事件 ` EZUIKitPlayer.EVENTS.fullscreen `
791
793
@@ -815,7 +817,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.exitFullscreen, () => {
815
817
// 监听全屏变化事件
816
818
player .eventEmitter .on (EZUIKitPlayer .EVENTS .fullscreenChange , (data ) => {
817
819
// {data: FullscreenChangeData}
818
- console .log (' fullscreenChange' , data);
820
+ console .log (" fullscreenChange" , data);
819
821
});
820
822
```
821
823
@@ -841,15 +843,15 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.init, () => {
841
843
});
842
844
```
843
845
844
- #### resize事件
846
+ #### resize 事件
845
847
846
- resize事件事件 ` EZUIKitPlayer.EVENTS.resize `
848
+ resize 事件事件 ` EZUIKitPlayer.EVENTS.resize `
847
849
848
850
``` js
849
851
// 监听resize事件
850
852
player .eventEmitter .on (EZUIKitPlayer .EVENTS .resize , () => {
851
853
// {data: {"width": number,"height":number}}
852
- console .log (' resize' , data);
854
+ console .log (" resize" , data);
853
855
});
854
856
```
855
857
@@ -886,9 +888,9 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.resume, () => {
886
888
});
887
889
```
888
890
889
- #### seek事件
891
+ #### seek 事件
890
892
891
- seek事件 ` EZUIKitPlayer.EVENTS.seek ` , 仅支持回放
893
+ seek 事件 ` EZUIKitPlayer.EVENTS.seek ` , 仅支持回放
892
894
893
895
``` js
894
896
// 监听seek事件
@@ -960,18 +962,21 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.recTimeChange, () => {
960
962
// 监听获取云存储回片段事件
961
963
player .eventEmitter .on (EZUIKitPlayer .EVENTS .http .getCloudRecTimes , (list ) => {
962
964
// {data: {"width": number,"height":number}}
963
- console .log (' list' , list);
965
+ console .log (" list" , list);
964
966
});
965
967
```
966
968
967
969
获取云录制回片段事件 ` EZUIKitPlayer.EVENTS.http.getCloudRecordTimes `
968
970
969
971
``` js
970
972
// 监听获取云录制回片段事件
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
+ );
975
980
```
976
981
977
982
获取本地录制回片段事件 ` EZUIKitPlayer.EVENTS.http.getLocalRecTimes `
@@ -980,7 +985,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getCloudRecordTimes, (list) =>
980
985
// 监听获取本地录制回片段事件
981
986
player .eventEmitter .on (EZUIKitPlayer .EVENTS .http .getLocalRecTimes , (list ) => {
982
987
// {data: {"width": number,"height":number}}
983
- console .log (' list' , list);
988
+ console .log (" list" , list);
984
989
});
985
990
```
986
991
@@ -990,7 +995,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getLocalRecTimes, (list) => {
990
995
// 监听获取设备信息事件
991
996
player .eventEmitter .on (EZUIKitPlayer .EVENTS .http .getDeviceInfo , (info ) => {
992
997
// {"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);
994
999
});
995
1000
```
996
1001
@@ -1000,7 +1005,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.http.getDeviceInfo, (info) => {
1000
1005
// 监听获取设备信息事件
1001
1006
player .eventEmitter .on (EZUIKitPlayer .EVENTS .http .getDeviceList , (info ) => {
1002
1007
// {"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);
1004
1009
});
1005
1010
```
1006
1011
@@ -1086,7 +1091,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.talkSuccess, () => {
1086
1091
// 监听对讲开启失败事件
1087
1092
player .eventEmitter .on (EZUIKitPlayer .EVENTS .talkError , (error ) => {
1088
1093
// ...
1089
- console .error (' talkError' , error);
1094
+ console .error (" talkError" , error);
1090
1095
});
1091
1096
```
1092
1097
@@ -1137,7 +1142,7 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.zoom.closeZoom, () => {
1137
1142
// 监听电子放大变化事件
1138
1143
player .eventEmitter .on (EZUIKitPlayer .EVENTS .zoom .onZoomChange , (info ) => {
1139
1144
// {"zoom": string,"reset"?:boolean}
1140
- console .log (' onZoomChange' , info);
1145
+ console .log (" onZoomChange" , info);
1141
1146
});
1142
1147
```
1143
1148
@@ -1194,10 +1199,13 @@ player.eventEmitter.on(EZUIKitPlayer.EVENTS.ptz.ptzDirection, () => {
1194
1199
1195
1200
``` js
1196
1201
// 监听点击云台控制控件方向事件
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
+ );
1201
1209
```
1202
1210
1203
1211
#### 日期选择器相关事件
0 commit comments