@ylink-sdk/meeting 0.1.4 → 0.1.8
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/LICENSE +20 -20
- package/README.md +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/types/ctrl.d.ts +442 -2
- package/dist/types/data.d.ts +52 -7
- package/dist/types/enums.d.ts +6 -0
- package/dist/ylink-sdk-meeting.es.js +1 -1
- package/dist/ylink-sdk-meeting.umd.js +1 -1
- package/package.json +58 -58
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 ylink
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 ylink
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# @ylink-sdk/meeting
|
|
2
|
-
|
|
3
|
-
通过@ylink-sdk/meeting,开发者可以快速实现加入yealink会议并进行相关会议会控操作
|
|
1
|
+
# @ylink-sdk/meeting
|
|
2
|
+
|
|
3
|
+
通过@ylink-sdk/meeting,开发者可以快速实现加入yealink会议并进行相关会议会控操作
|
package/dist/index.d.ts
CHANGED
package/dist/types/ctrl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ENDPOINT_TYPE, ROLE } from './enums';
|
|
2
|
-
import { UserState, Inbox, ResultInfo } from './data';
|
|
2
|
+
import { UserState, Inbox, ResultInfo, CustomLayout, BasicLayout, Barrage } from './data';
|
|
3
3
|
/**
|
|
4
4
|
* SFU会控返回响应值
|
|
5
5
|
*/
|
|
@@ -13,6 +13,66 @@ export interface Result<T = any> extends Response {
|
|
|
13
13
|
msg: string;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
export interface audioStats {
|
|
17
|
+
/**
|
|
18
|
+
* 编解码器
|
|
19
|
+
*/
|
|
20
|
+
codec: string;
|
|
21
|
+
/**
|
|
22
|
+
* bps 带宽
|
|
23
|
+
*/
|
|
24
|
+
bandwidth: number;
|
|
25
|
+
/**
|
|
26
|
+
* ms 环回延时
|
|
27
|
+
*/
|
|
28
|
+
rtt: number;
|
|
29
|
+
/**
|
|
30
|
+
* ms 抖动
|
|
31
|
+
*/
|
|
32
|
+
jitter: number;
|
|
33
|
+
/**
|
|
34
|
+
* % 丢包率
|
|
35
|
+
*/
|
|
36
|
+
lossrate: number;
|
|
37
|
+
/**
|
|
38
|
+
* 个 丢包数
|
|
39
|
+
*/
|
|
40
|
+
packetlost: number;
|
|
41
|
+
}
|
|
42
|
+
export interface videoStats {
|
|
43
|
+
/**
|
|
44
|
+
* bps 带宽
|
|
45
|
+
*/
|
|
46
|
+
bandwidth: number;
|
|
47
|
+
/**
|
|
48
|
+
* ms 环回延时
|
|
49
|
+
*/
|
|
50
|
+
rtt: number;
|
|
51
|
+
/**
|
|
52
|
+
* ms 抖动
|
|
53
|
+
*/
|
|
54
|
+
jitter: number;
|
|
55
|
+
/**
|
|
56
|
+
* 分辨率宽
|
|
57
|
+
*/
|
|
58
|
+
width: number;
|
|
59
|
+
/**
|
|
60
|
+
* 分辨率高
|
|
61
|
+
*/
|
|
62
|
+
height: number;
|
|
63
|
+
/**
|
|
64
|
+
* 帧率
|
|
65
|
+
*/
|
|
66
|
+
fr: number;
|
|
67
|
+
/**
|
|
68
|
+
* % 丢包率
|
|
69
|
+
*/
|
|
70
|
+
lossrate: number;
|
|
71
|
+
/**
|
|
72
|
+
* 个 丢包数
|
|
73
|
+
*/
|
|
74
|
+
packetlost: number;
|
|
75
|
+
}
|
|
16
76
|
/**
|
|
17
77
|
* 会控功能
|
|
18
78
|
*/
|
|
@@ -22,6 +82,12 @@ export interface Ctrl {
|
|
|
22
82
|
* @since 1.0.0
|
|
23
83
|
*/
|
|
24
84
|
cancelToken: (reason: string) => void;
|
|
85
|
+
developerToken: (params: {
|
|
86
|
+
version: string;
|
|
87
|
+
Authorization: string;
|
|
88
|
+
timestamp: string;
|
|
89
|
+
nonce: string;
|
|
90
|
+
}) => Promise<Result>;
|
|
25
91
|
/**
|
|
26
92
|
* 获取当前会议通告推送的收件箱信息
|
|
27
93
|
* @since 1.0.0
|
|
@@ -90,6 +156,30 @@ export interface Ctrl {
|
|
|
90
156
|
* 入会链接,兼容3x的链接(如果不带meetingNum则必选)
|
|
91
157
|
*/
|
|
92
158
|
url?: string;
|
|
159
|
+
/**
|
|
160
|
+
* 手机区号
|
|
161
|
+
*/
|
|
162
|
+
mobileCode?: string;
|
|
163
|
+
/**
|
|
164
|
+
* 观众注册手机号
|
|
165
|
+
*/
|
|
166
|
+
mobile?: string;
|
|
167
|
+
/**
|
|
168
|
+
* 观众注册邮箱
|
|
169
|
+
*/
|
|
170
|
+
regEmail?: string;
|
|
171
|
+
/**
|
|
172
|
+
* 云账号邮箱
|
|
173
|
+
*/
|
|
174
|
+
accEmail?: string;
|
|
175
|
+
/**
|
|
176
|
+
* 观众 tk
|
|
177
|
+
*/
|
|
178
|
+
tk?: string;
|
|
179
|
+
/**
|
|
180
|
+
* 入会名称
|
|
181
|
+
*/
|
|
182
|
+
displayName?: string;
|
|
93
183
|
}) => Promise<Result>;
|
|
94
184
|
/**
|
|
95
185
|
* ## 加入会议
|
|
@@ -261,6 +351,22 @@ export interface Ctrl {
|
|
|
261
351
|
leave: (params: {
|
|
262
352
|
resultInfo: ResultInfo;
|
|
263
353
|
}) => Promise<Result>;
|
|
354
|
+
/**
|
|
355
|
+
* 上报通话统计
|
|
356
|
+
*/
|
|
357
|
+
callStatsReport: (params: {
|
|
358
|
+
/**
|
|
359
|
+
* 用户ID
|
|
360
|
+
*/
|
|
361
|
+
userID: number;
|
|
362
|
+
stats: {
|
|
363
|
+
audio: audioStats;
|
|
364
|
+
video: videoStats;
|
|
365
|
+
share: videoStats;
|
|
366
|
+
};
|
|
367
|
+
deviceInfo: string;
|
|
368
|
+
protocol: string;
|
|
369
|
+
}) => Promise<Result>;
|
|
264
370
|
/**
|
|
265
371
|
* 闭音
|
|
266
372
|
* @since 1.0.0
|
|
@@ -518,19 +624,335 @@ export interface Ctrl {
|
|
|
518
624
|
actionPlayTimes: number;
|
|
519
625
|
}) => Promise<Result>;
|
|
520
626
|
/**
|
|
521
|
-
*
|
|
627
|
+
* 设置主持人布局
|
|
628
|
+
* @since 1.0.0
|
|
629
|
+
*/
|
|
630
|
+
hostLayout: (params: {
|
|
631
|
+
/**
|
|
632
|
+
* 布局模式,可选参数:basic、custom
|
|
633
|
+
* 当mode=basic时,终端入会默认显示服务器推送的布局类型,但允许主持人、与会者本地切换为其它布局,研讨会观众无法切换
|
|
634
|
+
* 当mode=custom时,终端都固定显示,无法本地切换布局
|
|
635
|
+
*/
|
|
636
|
+
mode: string;
|
|
637
|
+
/**
|
|
638
|
+
* 布局结构体;当mode=basic时无需带;当mode=custom,采用customLayout结构体
|
|
639
|
+
*/
|
|
640
|
+
layout?: CustomLayout | BasicLayout;
|
|
641
|
+
/**
|
|
642
|
+
* 自定义布局是否同时应用于与会者
|
|
643
|
+
*/
|
|
644
|
+
applyToAttendee?: boolean;
|
|
645
|
+
}) => Promise<Result>;
|
|
646
|
+
/**
|
|
647
|
+
* 设置与会者布局
|
|
648
|
+
* @since 1.0.0
|
|
649
|
+
*/
|
|
650
|
+
attendeeLayout: (params: {
|
|
651
|
+
/**
|
|
652
|
+
* 布局模式,可选参数:basic、custom
|
|
653
|
+
* 当mode=basic时,终端入会默认显示服务器推送的布局类型,但允许主持人、与会者本地切换为其它布局,研讨会观众无法切换
|
|
654
|
+
* 当mode=custom时,终端都固定显示,无法本地切换布局
|
|
655
|
+
*/
|
|
656
|
+
mode: string;
|
|
657
|
+
/**
|
|
658
|
+
* 布局结构体;当mode=basic时无需带;当mode=custom,采用customLayout结构体
|
|
659
|
+
*/
|
|
660
|
+
layout?: CustomLayout | BasicLayout;
|
|
661
|
+
}) => Promise<Result>;
|
|
662
|
+
/**
|
|
663
|
+
* 设置观众布局
|
|
664
|
+
* @since 1.0.0
|
|
665
|
+
*/
|
|
666
|
+
audienceLayout: (params: {
|
|
667
|
+
/**
|
|
668
|
+
* 布局模式,可选参数:basic、custom
|
|
669
|
+
* 当mode=basic时,终端入会默认显示服务器推送的布局类型,但允许主持人、与会者本地切换为其它布局,研讨会观众无法切换
|
|
670
|
+
* 当mode=custom时,终端都固定显示,无法本地切换布局
|
|
671
|
+
*/
|
|
672
|
+
mode: string;
|
|
673
|
+
/**
|
|
674
|
+
* 布局结构体;当mode=basic时无需带;当mode=custom,采用customLayout结构体
|
|
675
|
+
*/
|
|
676
|
+
layout?: CustomLayout | BasicLayout;
|
|
677
|
+
}) => Promise<Result>;
|
|
678
|
+
/**
|
|
679
|
+
* 应用个人布局
|
|
680
|
+
* @since 1.0.0
|
|
681
|
+
*/
|
|
682
|
+
personalLayout: (params: {
|
|
683
|
+
/**
|
|
684
|
+
* 布局模式,为custom
|
|
685
|
+
*/
|
|
686
|
+
mode: string;
|
|
687
|
+
/**
|
|
688
|
+
* 布局结构体,采用customLayout
|
|
689
|
+
*/
|
|
690
|
+
layout: CustomLayout;
|
|
691
|
+
/**
|
|
692
|
+
* 个人布局订阅者信息
|
|
693
|
+
*/
|
|
694
|
+
subscriber: {
|
|
695
|
+
userID?: number;
|
|
696
|
+
subjectID?: string;
|
|
697
|
+
};
|
|
698
|
+
}) => Promise<Result>;
|
|
699
|
+
/**
|
|
700
|
+
* 取消个人布局
|
|
701
|
+
* @since 1.0.0
|
|
702
|
+
*/
|
|
703
|
+
personalLayoutDelete: (params: {
|
|
704
|
+
/**
|
|
705
|
+
* 个人布局订阅者参数
|
|
706
|
+
*/
|
|
707
|
+
subscriber: {
|
|
708
|
+
userID?: number;
|
|
709
|
+
subjectID?: string;
|
|
710
|
+
};
|
|
711
|
+
}) => Promise<Result>;
|
|
712
|
+
/**
|
|
713
|
+
* 设置虚拟教室
|
|
714
|
+
* @since 1.0.0
|
|
715
|
+
*/
|
|
716
|
+
virtualClassLayout: (params: {
|
|
717
|
+
/**
|
|
718
|
+
* 布局结构体,采用customLayout
|
|
719
|
+
*/
|
|
720
|
+
layout: CustomLayout;
|
|
721
|
+
/**
|
|
722
|
+
* 布局个数,也是大屏终端屏幕个数
|
|
723
|
+
*/
|
|
724
|
+
count: number;
|
|
725
|
+
/**
|
|
726
|
+
* 黑名单subjectID列表
|
|
727
|
+
*/
|
|
728
|
+
blackList: string[];
|
|
729
|
+
}) => Promise<Result>;
|
|
730
|
+
/**
|
|
731
|
+
* 关闭虚拟教室
|
|
732
|
+
* @since 1.0.0
|
|
733
|
+
*/
|
|
734
|
+
virtualClassClose: () => Promise<Result>;
|
|
735
|
+
/**
|
|
736
|
+
* 设置焦点视频
|
|
737
|
+
* @since 1.0.0
|
|
738
|
+
*/
|
|
739
|
+
spotlight: (params: {
|
|
740
|
+
/**
|
|
741
|
+
* 操作类型 add/remove/replace/removeAll
|
|
742
|
+
*/
|
|
743
|
+
action: string;
|
|
744
|
+
/**
|
|
745
|
+
* 被操作的用户,action不是removeAll则必选
|
|
746
|
+
*/
|
|
747
|
+
userID?: number;
|
|
748
|
+
}) => Promise<Result>;
|
|
749
|
+
/**
|
|
750
|
+
* 大厅全部拒绝
|
|
751
|
+
* @since 1.0.0
|
|
752
|
+
*/
|
|
753
|
+
lobbyRefuseAll: () => Promise<Result>;
|
|
754
|
+
/**
|
|
755
|
+
* 大厅全部准入
|
|
756
|
+
* @since 1.0.0
|
|
757
|
+
*/
|
|
758
|
+
lobbyAdmitAll: () => Promise<Result>;
|
|
759
|
+
/**
|
|
760
|
+
* 发送弹幕
|
|
761
|
+
* @since 1.0.0
|
|
762
|
+
*/
|
|
763
|
+
barrage: (params: Barrage) => Promise<Result>;
|
|
764
|
+
/**
|
|
765
|
+
* 关闭弹幕
|
|
766
|
+
* @since 1.0.0
|
|
767
|
+
*/
|
|
768
|
+
deleteBarrage: () => Promise<Result>;
|
|
769
|
+
/**
|
|
770
|
+
* 获取操作记录
|
|
771
|
+
* @since 1.0.0
|
|
772
|
+
*/
|
|
773
|
+
operationRecord: (params: {
|
|
774
|
+
/**
|
|
775
|
+
* 分页查询参数
|
|
776
|
+
*/
|
|
777
|
+
skip: number;
|
|
778
|
+
/**
|
|
779
|
+
* 查询的数量
|
|
780
|
+
*/
|
|
781
|
+
limit: number;
|
|
782
|
+
/**
|
|
783
|
+
* 排序的规则
|
|
784
|
+
*/
|
|
785
|
+
orderbys?: {
|
|
786
|
+
/**
|
|
787
|
+
* 排序的字段
|
|
788
|
+
*/
|
|
789
|
+
field: string;
|
|
790
|
+
/**
|
|
791
|
+
* 排序的类型,1:升序,-1:降序
|
|
792
|
+
*/
|
|
793
|
+
order: number;
|
|
794
|
+
};
|
|
795
|
+
/**
|
|
796
|
+
* 搜索的key
|
|
797
|
+
*/
|
|
798
|
+
searchKey?: string;
|
|
799
|
+
/**
|
|
800
|
+
* 查询role角色操作
|
|
801
|
+
*/
|
|
802
|
+
role?: string;
|
|
803
|
+
/**
|
|
804
|
+
* 查询对应模块操作
|
|
805
|
+
*/
|
|
806
|
+
opModule?: string;
|
|
807
|
+
/**
|
|
808
|
+
* 操作的结果,true:成功,false:失败
|
|
809
|
+
*/
|
|
810
|
+
opResult?: boolean;
|
|
811
|
+
}) => Promise<Result>;
|
|
812
|
+
/**
|
|
813
|
+
* 获取分享信息
|
|
814
|
+
* @since 1.0.0
|
|
522
815
|
*/
|
|
523
816
|
shareInfo: (params: {
|
|
524
817
|
/**
|
|
525
818
|
* 会议号码
|
|
526
819
|
*/
|
|
527
820
|
meetingNum: string;
|
|
821
|
+
/**
|
|
822
|
+
* 需要预约成员信息带true
|
|
823
|
+
*/
|
|
824
|
+
participant?: boolean;
|
|
528
825
|
}) => Promise<Result>;
|
|
529
826
|
/**
|
|
530
827
|
* 结束会议
|
|
531
828
|
* @since 1.0.0
|
|
532
829
|
*/
|
|
533
830
|
end: () => Promise<Result>;
|
|
831
|
+
/**
|
|
832
|
+
* 结束准备模式
|
|
833
|
+
* @since 1.0.0
|
|
834
|
+
*/
|
|
835
|
+
practiceSession: () => Promise<Result>;
|
|
836
|
+
/**
|
|
837
|
+
* 全部手放下
|
|
838
|
+
* @since 1.0.0
|
|
839
|
+
*/
|
|
840
|
+
replyAllHandUp: () => Promise<Result>;
|
|
841
|
+
/**
|
|
842
|
+
* 全体解禁言
|
|
843
|
+
* @since 1.0.0
|
|
844
|
+
*/
|
|
845
|
+
unmuteAll: () => Promise<Result>;
|
|
846
|
+
/**
|
|
847
|
+
* 全体禁言
|
|
848
|
+
* @since 1.0.0
|
|
849
|
+
*/
|
|
850
|
+
muteAll: () => Promise<Result>;
|
|
851
|
+
/**
|
|
852
|
+
* 通知上报音频转储
|
|
853
|
+
* @since 1.0.0
|
|
854
|
+
*/
|
|
855
|
+
audioDump: () => Promise<Result>;
|
|
856
|
+
mailTemplate: (params: {
|
|
857
|
+
/**
|
|
858
|
+
* 语言
|
|
859
|
+
*/
|
|
860
|
+
language: string;
|
|
861
|
+
}) => Promise<Result>;
|
|
862
|
+
/**
|
|
863
|
+
* 问答
|
|
864
|
+
* @since 1.0.0
|
|
865
|
+
*/
|
|
866
|
+
/**
|
|
867
|
+
* 发送聊天信息
|
|
868
|
+
*/
|
|
869
|
+
msg: (params: {
|
|
870
|
+
/**
|
|
871
|
+
* 终端生成消息唯一id,可用随机数
|
|
872
|
+
*/
|
|
873
|
+
msgID: string;
|
|
874
|
+
/**
|
|
875
|
+
* 消息的类型:text/plain。(后续根据产品需求可拓展支持text/enriched)
|
|
876
|
+
*/
|
|
877
|
+
contentType: string;
|
|
878
|
+
/**
|
|
879
|
+
* 消息内容
|
|
880
|
+
*/
|
|
881
|
+
content: string;
|
|
882
|
+
/**
|
|
883
|
+
* 消息类型,可选:0(群聊)、1(私聊)、2(发给大厅)
|
|
884
|
+
*/
|
|
885
|
+
msgType?: number;
|
|
886
|
+
/**
|
|
887
|
+
* 接收者的信息
|
|
888
|
+
*/
|
|
889
|
+
receiver?: {
|
|
890
|
+
userID: number;
|
|
891
|
+
};
|
|
892
|
+
/**
|
|
893
|
+
* 时间戳,服务器填
|
|
894
|
+
*/
|
|
895
|
+
timestamp?: number;
|
|
896
|
+
/**
|
|
897
|
+
* 发送者的信息,服务器填
|
|
898
|
+
*/
|
|
899
|
+
sender?: {
|
|
900
|
+
userID?: number;
|
|
901
|
+
displayName?: string;
|
|
902
|
+
};
|
|
903
|
+
}) => Promise<Result>;
|
|
904
|
+
/**
|
|
905
|
+
* 查询聊天历史信息
|
|
906
|
+
*/
|
|
907
|
+
historyMsg: (params: {
|
|
908
|
+
/**
|
|
909
|
+
* 最大只返回100条,limit>100 或 limit<1时,limit都取100
|
|
910
|
+
*/
|
|
911
|
+
limit: number;
|
|
912
|
+
}) => Promise<Result>;
|
|
913
|
+
/**
|
|
914
|
+
* 远程桌面
|
|
915
|
+
*/
|
|
916
|
+
remoteDesktop: (params: {
|
|
917
|
+
/**
|
|
918
|
+
* 指令信息(包含request,close,refuse和connect)
|
|
919
|
+
*/
|
|
920
|
+
action: string;
|
|
921
|
+
/**
|
|
922
|
+
* 被操作的用户
|
|
923
|
+
*/
|
|
924
|
+
userID: number;
|
|
925
|
+
}) => Promise<Result>;
|
|
926
|
+
/**
|
|
927
|
+
* 通过会议号结束会议
|
|
928
|
+
*/
|
|
929
|
+
endMeeting: (params: {
|
|
930
|
+
/**
|
|
931
|
+
* 会议号
|
|
932
|
+
*/
|
|
933
|
+
meetingNum: string;
|
|
934
|
+
}) => Promise<Result>;
|
|
935
|
+
/**
|
|
936
|
+
* 获取会议静态
|
|
937
|
+
*/
|
|
938
|
+
meetings: (params: {
|
|
939
|
+
/**
|
|
940
|
+
* 会议号
|
|
941
|
+
*/
|
|
942
|
+
meetingNum: string;
|
|
943
|
+
/**
|
|
944
|
+
* 调取credential接口获取的临时秘钥
|
|
945
|
+
*/
|
|
946
|
+
credential: string;
|
|
947
|
+
/**
|
|
948
|
+
* 需要预约成员信息带true
|
|
949
|
+
*/
|
|
950
|
+
participant?: boolean;
|
|
951
|
+
/**
|
|
952
|
+
* 需要AVC配置信息带true
|
|
953
|
+
*/
|
|
954
|
+
avcConfig?: boolean;
|
|
955
|
+
}) => Promise<Result>;
|
|
534
956
|
/**
|
|
535
957
|
* 获取请求baseURL
|
|
536
958
|
* @since 1.0.0
|
|
@@ -543,6 +965,24 @@ export interface Ctrl {
|
|
|
543
965
|
* @ignore
|
|
544
966
|
*/
|
|
545
967
|
setBaseURL(url: string): void;
|
|
968
|
+
/**
|
|
969
|
+
* 获取 SDK token
|
|
970
|
+
*/
|
|
971
|
+
get accessToken(): string;
|
|
972
|
+
/**
|
|
973
|
+
* 设置 SDK token
|
|
974
|
+
* @param token
|
|
975
|
+
*/
|
|
976
|
+
setAccessToken(token: string): void;
|
|
977
|
+
/**
|
|
978
|
+
* 获取 SDK 版本
|
|
979
|
+
*/
|
|
980
|
+
get version(): string;
|
|
981
|
+
/**
|
|
982
|
+
* 设置 SDK 版本
|
|
983
|
+
* @param version
|
|
984
|
+
*/
|
|
985
|
+
setVersion(version: string): void;
|
|
546
986
|
/**
|
|
547
987
|
* 获取会话ID,标识一次入会的所有请求响应
|
|
548
988
|
* @since 1.0.0
|
package/dist/types/data.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ENDPOINT_TYPE, ROLE } from './enums';
|
|
2
|
+
import { ENDPOINT_TYPE, RECORD_STATUS, ROLE } from './enums';
|
|
3
3
|
/**
|
|
4
4
|
* 入会后的实时会议数据
|
|
5
5
|
*/
|
|
@@ -359,6 +359,19 @@ export interface Data {
|
|
|
359
359
|
type: string;
|
|
360
360
|
};
|
|
361
361
|
};
|
|
362
|
+
/**
|
|
363
|
+
* 直播
|
|
364
|
+
*/
|
|
365
|
+
liveStream?: {
|
|
366
|
+
/**
|
|
367
|
+
* 序列号
|
|
368
|
+
*/
|
|
369
|
+
seq: number;
|
|
370
|
+
/**
|
|
371
|
+
* 直播详情
|
|
372
|
+
*/
|
|
373
|
+
liveStreams: liveStreams[];
|
|
374
|
+
};
|
|
362
375
|
/**
|
|
363
376
|
* 字幕
|
|
364
377
|
*/
|
|
@@ -404,10 +417,6 @@ export interface Barrage {
|
|
|
404
417
|
* 背景颜色,可选:红色(#F54849)、黄色(#FFA51E)、蓝色(#006CE6)、黑色(#1A1A1A)、透明(传空值)
|
|
405
418
|
*/
|
|
406
419
|
backgroundColor?: string;
|
|
407
|
-
/**
|
|
408
|
-
* 字幕类型
|
|
409
|
-
*/
|
|
410
|
-
type: string;
|
|
411
420
|
}
|
|
412
421
|
/**
|
|
413
422
|
* 媒体状态
|
|
@@ -429,6 +438,14 @@ export interface MediaStream {
|
|
|
429
438
|
* 操作者 1(other) 表示被别人操作;0(self) 或没有该字段 表示自己操作
|
|
430
439
|
*/
|
|
431
440
|
opBy?: number;
|
|
441
|
+
/**
|
|
442
|
+
* 是否开启虚拟辅流协作,若取true,需处理sourceID
|
|
443
|
+
*/
|
|
444
|
+
serverCoop?: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* 虚拟辅流协助终端ID
|
|
447
|
+
*/
|
|
448
|
+
sourceID?: number;
|
|
432
449
|
}
|
|
433
450
|
/**
|
|
434
451
|
* 用户实体信息
|
|
@@ -498,6 +515,12 @@ export interface User {
|
|
|
498
515
|
* 变更原因
|
|
499
516
|
*/
|
|
500
517
|
resultInfo?: Record<string, any>;
|
|
518
|
+
/**
|
|
519
|
+
* 本地录制
|
|
520
|
+
*/
|
|
521
|
+
localRecord?: {
|
|
522
|
+
status: RECORD_STATUS;
|
|
523
|
+
};
|
|
501
524
|
}
|
|
502
525
|
/**
|
|
503
526
|
* 自身实体信息
|
|
@@ -645,13 +668,13 @@ export interface UserState {
|
|
|
645
668
|
*/
|
|
646
669
|
perm?: number;
|
|
647
670
|
}
|
|
648
|
-
interface BasicLayout {
|
|
671
|
+
export interface BasicLayout {
|
|
649
672
|
/**
|
|
650
673
|
* 基础布局类型
|
|
651
674
|
*/
|
|
652
675
|
type: 'speaker' | 'gallery' | 'pip' | 'single';
|
|
653
676
|
}
|
|
654
|
-
interface CustomLayout {
|
|
677
|
+
export interface CustomLayout {
|
|
655
678
|
/**
|
|
656
679
|
* 布局名称
|
|
657
680
|
*/
|
|
@@ -689,4 +712,26 @@ interface CustomLayout {
|
|
|
689
712
|
*/
|
|
690
713
|
pollCount: number;
|
|
691
714
|
}
|
|
715
|
+
interface liveStreams {
|
|
716
|
+
/**
|
|
717
|
+
* 直播的平台
|
|
718
|
+
*/
|
|
719
|
+
platform: 'youtube' | 'aliyun' | 'thirdParty';
|
|
720
|
+
/**
|
|
721
|
+
* 直播状态
|
|
722
|
+
*/
|
|
723
|
+
status: 'stopped' | 'starting' | 'started' | 'paused';
|
|
724
|
+
/**
|
|
725
|
+
* 观看链接
|
|
726
|
+
*/
|
|
727
|
+
watchURL: string;
|
|
728
|
+
/**
|
|
729
|
+
* 最近一次开始时间
|
|
730
|
+
*/
|
|
731
|
+
lastStartTime: number;
|
|
732
|
+
/**
|
|
733
|
+
* 持续时间
|
|
734
|
+
*/
|
|
735
|
+
duration: number;
|
|
736
|
+
}
|
|
692
737
|
export {};
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function t(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{u(i.next(e))}catch(e){r(e)}}function o(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}u((i=i.apply(e,t||[])).next())}))}function n(e,t){var n,i,s,r,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){a.label=r[1];break}if(6===r[0]&&a.label<s[1]){a.label=s[1],s=r;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(r);break}s[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}}var i,s,r,a,o,u,l=function(){function e(e){this.defaultHeaders={},this.baseURL=e.baseURL,this.beforeRequest=e.beforeRequest}return e.prototype.setDefaultHeader=function(e,t){e in this.defaultHeaders&&(""===t||null===t)?delete this.defaultHeaders[e]:this.defaultHeaders[e]=t},e.prototype.request=function(e){var t=e.url,n=void 0===t?"":t,i=e.timeout,s=void 0===i?6e4:i,r=e.headers,a=void 0===r?{}:r;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+v(n.replace(/^\/+/,""),e.params),a=Object.assign(a,this.defaultHeaders),Object.keys(a).forEach((function(e){"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(a["Content-Type"]=a[e],delete a[e])})),h(e.data)&&(a&&!a["Content-Type"]&&(a["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=a,e.timeout=s,this.beforeRequest&&this.beforeRequest(e),"undefined"!=typeof wx?d(e):c(e)},e.prototype.get=function(e,t){return this.request(Object.assign(t||{},{url:e,method:"GET"}))},e.prototype.post=function(e,t,n){return this.request(Object.assign(n||{},{url:e,method:"POST",data:t}))},e}(),c=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=new XMLHttpRequest;c.open(o.toUpperCase(),r,!0),c.timeout=e.timeout;var d="",m=function(){if(c){if(c.status>=200&&c.status<300)try{t(JSON.parse(c.responseText))}catch(e){n(new Error("E_JSON_PARSE"+c.responseText))}else n(new Error("Request failed with status code "+c.status));c=null}};"onloadend"in c?c.onloadend=m:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(m)},c.onabort=function(){c&&(n(new Error("Request aborted "+d)),c=null)},c.onerror=function(){n(new Error("Network Error")),c=null},c.ontimeout=function(){n(new Error("timeout of "+e.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(u).forEach((function(e){null===s&&"content-type"===e.toLowerCase()?delete u[e]:c.setRequestHeader(e,u[e])})),l&&l.promise.then((function(e){c&&(d=e,c.abort(),n(e),c=null)})),c.send(s)}))},d=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=wx.request({url:r,data:s,method:o.toUpperCase(),timeout:e.timeout,header:u,success:function(e){e.statusCode>=200&&e.statusCode<300?t(e.data):n(new Error("Request failed with status code "+e.statusCode))},fail:function(e){"request:fail abort"===e.errMsg&&l?n(l.reason):n(e)}});l&&l.promise.then((function(){c&&c.abort()}))}))},m=function(){function e(e){var t,n=this;this.promise=new Promise((function(e){t=e})),e((function(e){n.reason||(n.reason=e,t(n.reason))}))}return e.source=function(){var t,n=new e((function(e){t=e}));return{cancel:t,token:n}},e}(),p=Object.prototype.toString,h=function(e){if("[object Object]"!==p.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},f=function(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")},v=function(e,t){if(!t)return e;var n=[];Object.keys(t).forEach((function(e){var i,s=t[e];null!=s&&(Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((function(t){null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),n.push(f(e)+"="+f(t))})))}));var i=n.join("&");if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e},g=function(){for(var e=[],t="0123456789abcdef",n=0;n<36;n++)e[n]=t.substr(Math.floor(16*Math.random()),1);return e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("").split("-").join("")},E=function(e){return null==e},S=g(),b=function(e,t){void 0===e&&(e=new Date);var n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("00"+n[i]).substr((""+n[i]).length)));return t},D=function(e,t){return e?(Object.entries(e).forEach((function(e){var n,i=[e[0],e[1]],s=i[0],r=i[1];if(null!==r)return"object"==typeof(n=r)&&null!==n?(t[s]||(t[s]={}),void(t[s]=D(r,t[s]))):void(t[s]=r)})),t):t},O=function(e){var t="/meeting-ctrl/api/v1",n=new l({baseURL:e,beforeRequest:function(e){e.headers["X-Y-Request-Id"]=g()}}),i=m.source(),s="",r="",a="",o="";return{cancelToken:function(e){i.cancel(e),i=m.source()},credential:function(e){return n.get(t+"/credential",{params:e})},join:function(e){return n.post(t+"/join?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":s}})},updateUserState:function(e){return n.post(t+"/meetings/"+r+"/updateUserState",e)},inbox:function(e){return n.post("/ypush/api/v1/meeting-control/inbox",e)},polling:function(e){return n.post("/ypush/api/v1/meeting-control/polling",e,{cancelToken:i.token})},subscribe:function(e){return n.post(t+"/meetings/"+r+"/subscribe",e)},keepalive:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/keepalive",{},{cancelToken:i.token})},leave:function(e){return n.post(t+"/meetings/"+r+"/leave",e)},end:function(){return n.post(t+"/meetings/"+r+"/end")},audio:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/audio",e)},video:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/video",e)},share:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/share",e)},handUp:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/handUp",e)},replyHandUp:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/replyHandUp",e)},shareInfo:function(e){return n.get(t+"/meetings/"+r+"/shareInfo",{params:e})},trying:function(e){return n.post(t+"/trying?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":s}})},rejectCall:function(e){return n.post(t+"/rejectCall?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":s}})},pauseAudio:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/pauseAudio")},resumeAudio:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/resumeAudio")},lobbyState:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/lobbyState",e)},displayName:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/displayName",e)},callStats:function(e){return n.get(t+"/meetings/"+r+"/users/"+e.userID+"/callStats")},user:function(e){return n.get(t+"/meetings/"+r+"/users/"+e.userID)},blockVideo:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/blockVideo")},unblockVideo:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/unblockVideo")},role:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/role",e)},remove:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/remove",e)},dtmf:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/dtmf",e)},fecc:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/fecc",e)},get baseURL(){return n.baseURL},setBaseURL:function(e){n.baseURL=e},get sessionID(){return s},setSessionID:function(e){void 0===e&&(e=""),s=e,n.setDefaultHeader("X-Y-Session-Id",s)},get meetingID(){return r},setMeetingID:function(e){void 0===e&&(e=""),r=e},get location(){return o},setLocation:function(e){void 0===e&&(e=""),o=e,n.setDefaultHeader("X-Y-Location",o)},get ctrlID(){return a},setCtrlID:function(e){void 0===e&&(e=""),a=e,n.setDefaultHeader("X-Y-Ctrl-Id",a)}}},I=function(){function e(){this.events=new Map}return e.prototype.emit=function(e,t){var n=this.events.get(e);n&&n.slice().map((function(e){e(t)}))},e.prototype.off=function(e,t){var n=this.events.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):this.events.set(e,[]))},e.prototype.on=function(e,t){var n=this.events.get(e);n?n.push(t):this.events.set(e,[t])},e}();!function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision"}(i||(i={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(s||(s={})),function(e){e.CONNECTION_STATE="CONNECTION_STATE",e.MEETING_CHANGE="MEETING_CHANGE",e.ME_CHANGE="ME_CHANGE",e.UPDATE_USER_STATE="UPDATE_USER_STATE"}(r||(r={})),function(e){e.CONNECTED="connected",e.SUBSCRIBED="subscribed",e.CLOSED="closed"}(a||(a={})),function(e){e.ROLECHANGE="roleChange",e.AUDIOCHANGE="audioChange",e.HANDUPCHANGE="handupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="videoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="shareChange",e.DISPLAYNAMECHANGE="displayNameChange",e.SPOTLIGHTVIDEOCHANGE="spotlightVideoChange",e.LOBBYCHANGE="lobbyChange",e.BARRAGECHANGE="barrageChange",e.LEAVE="leave"}(o||(o={})),function(e){e.MEETINGINFO="meetingInfo",e.MEETINGSTATE="meetingState",e.MEETINGSETTING="meetingSetting",e.MEETINGVIEW="meetingView",e.MEETINGBARRAGE="meetingBarrage",e.RECORDING="recording",e.LIVESTREAM="liveStream",e.INTERACTIVEUSERS="interactiveUsers",e.BROADCASTUSERS="broadcastUsers",e.LOBBYUSERS="lobbyUsers",e.VIRTUALUSERS="virtualUsers",e.CHATMSG="chatMsg",e.INVITESTATE="inviteState",e.CALLRECORD="callRecord",e.ME="me"}(u||(u={}));var C=function(){function l(e){this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}},this.pollingStatus={attempts:0,errorTimes:0,errors:[]},this.keepaliveStatus={attempts:0,errorTimes:0,errors:[]},this.connectionState=a.CLOSED,this.isClosedStateEmited=!1,this.barrageTimer=null,this.ctrl=O(e.baseURL),this.emitter=new I}return l.createInstance=function(e){return null===this.instance||void 0===this.instance?this.instance=new l(e):(this.instance.emitter&&(this.instance.emitter=new I),this.instance.ctrl&&(this.instance.ctrl=O(e.baseURL))),l.instance},l.prototype.join=function(i){return t(this,void 0,void 0,(function(){var t,s,a,u,l,c,d,m,p,h,f,v,g,E=this;return n(this,(function(n){switch(n.label){case 0:return this.isClosedStateEmited=!1,[4,this.ctrl.credential({meetingNum:i.meetingNum,pwd:i.pwd,url:i.url}).catch((function(e){E.emitClosedState({cause:"credential",data:e.message})}))];case 1:return(t=n.sent())&&t.data&&t.data.credential?(this.ctrl.setLocation(t.data.location),delete i.pwd,delete i.url,[4,this.ctrl.join(e(e({},i),{credential:t.data.credential})).catch((function(e){E.emitClosedState({cause:"join",data:e.message})}))]):[3,3];case 2:return(s=n.sent())&&s.data?(a=s.data,u=a.meetingID,l=void 0===u?"":u,c=a.ctrlID,d=void 0===c?"":c,m=a.user,p=void 0===m?{}:m,h=a.mediaContent,f=void 0===h?{}:h,v=a.initialMediaState,g=void 0===v?{}:v,this.ctrl.setMeetingID(l),this.ctrl.setCtrlID(d),this.mtgData.me=e(e({},p),{mediaContent:f,initialMediaState:g}),this.mtgData.me.isInLobby?this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:!0,oldVal:null}}):this.emitter.emit(r.UPDATE_USER_STATE),[2,!0]):(this.emitClosedState({cause:"join",data:s}),[2,!1]);case 3:return this.emitClosedState({cause:"credential",data:t}),[2,!1];case 4:return[2]}}))}))},l.prototype.startPolling=function(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this.pollingStatus.attempts=0,this.pollingStatus.errorTimes=0,this.pollingStatus.errors=[],[4,this.inbox()];case 1:return e=t.sent(),[4,this.subscribe()];case 2:return t.sent()&&(this.pollingStatus.running=!0,this.polling(e)),[2]}}))}))},l.prototype.stopPolling=function(){this.pollingStatus.running=!1,this.pollingStatus.timer&&clearTimeout(this.pollingStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.startKeepalive=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this.keepaliveStatus.attempts=0,this.keepaliveStatus.errorTimes=0,this.keepaliveStatus.errors=[],this.keepaliveStatus.running=!0,this.keepalive(),[2]}))}))},l.prototype.stopKeepalive=function(){this.keepaliveStatus.running=!1,this.keepaliveStatus.timer&&clearTimeout(this.keepaliveStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.clean=function(){this.ctrl.setCtrlID(""),this.ctrl.setLocation(""),this.ctrl.setMeetingID(""),this.ctrl.setSessionID(""),this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}}},l.prototype.handleBarrage=function(e,t){var n=this;if(void 0===t&&(t=!1),e||t){var i=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{})),a=this.mtgData.me.role,u=void 0===a?"":a,l=this.mtgData.meetingBarrage;e||(e=l),u===s.COHOST&&(u=s.HOST),(null==e?void 0:e.receiver[u])?this.mtgData.me.barrage={position:e.position,contentType:e.contentType,content:e.content}:delete this.mtgData.me.barrage;var c={newVal:this.mtgData.me.barrage||null,oldVal:"{}"===JSON.stringify(i)?null:i};(c.newVal||c.oldVal)&&this.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:c})}if(e&&this.barrageTimer&&(clearTimeout(this.barrageTimer),this.barrageTimer=null),e&&-1!==e.duration){var d=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));this.barrageTimer=setTimeout((function(){delete n.mtgData.me.barrage,n.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:{newVal:null,oldVal:"{}"===JSON.stringify(d)?null:d}})}),1e3*e.duration)}},l.prototype.emitClosedState=function(e){this.isClosedStateEmited||(this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:e}),this.isClosedStateEmited=!0,this.clean())},l.prototype.subscribe=function(){return t(this,void 0,void 0,(function(){var e,t,i=this;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.subscribe({topics:e}).catch((function(e){i.emitClosedState({cause:"subscribe",data:e.message})}))];case 1:return(t=n.sent())&&t.data?(t.data.eventMsgs.forEach((function(e){i.mtgData[e.event]=e.body,e.event.indexOf("Users")>-1&&e.body.users.forEach((function(e){e.userID===i.mtgData.me.userID&&(delete e.audio,delete e.video,delete e.share,D(e,i.mtgData.me))})),e.event===u.MEETINGBARRAGE&&i.handleBarrage(e.body)})),this.mtgData.me.reSub?delete this.mtgData.me.reSub:(this.connectionState=a.SUBSCRIBED,this.emitter.emit(r.CONNECTION_STATE,{state:a.SUBSCRIBED})),[2,!0]):(this.emitClosedState({cause:"subscribe",data:t}),[2,!1])}}))}))},l.prototype.inbox=function(){return t(this,void 0,void 0,(function(){var e,t,i;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.inbox({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e})];case 1:return(t=n.sent())?(i=[],t.data&&Object.keys(t.data).forEach((function(e){i.push({name:e,seqId:t.data[e].maxSeqId,limit:200})})),[2,i]):[2,[]]}}))}))},l.prototype.polling=function(e){return t(this,void 0,void 0,(function(){var i,u,l=this;return n(this,(function(c){switch(c.label){case 0:return i=function(){return t(l,void 0,void 0,(function(){var i,u,l,c,d,m=this;return n(this,(function(p){switch(p.label){case 0:return this.pollingStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.polling({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e}).catch((function(e){m.pollingStatus.attempts++,m.pollingStatus.errorTimes++,m.pollingStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(i=p.sent())&&i.data?(u=i.data,l=void 0===u?{}:u,c=function(e){return t(m,void 0,void 0,(function(){var t,i,u,l,c,d,m,p,h,f,v,g,S,b,O,I,C,y,N,T,A,U,H,L,R,w;return n(this,(function(n){switch(n.label){case 0:return e.userID!==this.mtgData.me.userID?[3,6]:(t=JSON.parse(JSON.stringify(this.mtgData.me)),e.role&&e.role!==t.role?(i=t.role,e.role!==s.AUDIENCE&&t.role!==s.AUDIENCE?[3,2]:(this.mtgData.me.role=e.role,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()])):[3,3]);case 1:n.sent(),this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE),n.label=2;case 2:e.role===s.AUDIENCE&&(e.audio={deviceOn:!0,sendOn:!1,recvOn:!1},e.video={deviceOn:!0,sendOn:!1,recvOn:!1},e.share={deviceOn:!0,sendOn:!1,recvOn:!1}),D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.ROLECHANGE,body:{newVal:e.role,oldVal:i}}),this.handleBarrage(null,!0),n.label=3;case 3:return e.displayName&&e.displayName!==t.displayName&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.DISPLAYNAMECHANGE,body:{newVal:e.displayName,oldVal:t.displayName}})),e.audio&&(u=e.audio,d=u.deviceOn,m=u.sendOn,p=u.opBy,(!E(d)&&d!==(null===(h=t.audio)||void 0===h?void 0:h.deviceOn)||!E(m)&&m!==(null===(f=t.audio)||void 0===f?void 0:f.sendOn))&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:{deviceOn:E(d)?null===(v=this.mtgData.me.audio)||void 0===v?void 0:v.deviceOn:d,sendOn:E(m)?null===(g=this.mtgData.me.audio)||void 0===g?void 0:g.sendOn:m,opBy:p},oldVal:{deviceOn:null===(S=t.audio)||void 0===S?void 0:S.deviceOn,sendOn:null===(b=t.audio)||void 0===b?void 0:b.sendOn}}}))),"isHandUp"in e&&(D(e,this.mtgData.me),e.isHandUp!==t.isHandUp&&"isHandUp"in t&&this.emitter.emit(r.ME_CHANGE,{event:o.HANDUPCHANGE,body:{newVal:e.isHandUp,oldVal:t.isHandUp}})),e.video&&(l=e.video,d=l.deviceOn,m=l.sendOn,p=l.opBy,(!E(d)&&d!==(null===(O=t.video)||void 0===O?void 0:O.deviceOn)||!E(m)&&m!==(null===(I=t.video)||void 0===I?void 0:I.sendOn))&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:{deviceOn:E(d)?null===(C=this.mtgData.me.video)||void 0===C?void 0:C.deviceOn:d,sendOn:E(m)?null===(y=this.mtgData.me.video)||void 0===y?void 0:y.sendOn:m,opBy:p},oldVal:{deviceOn:null===(N=t.video)||void 0===N?void 0:N.deviceOn,sendOn:null===(T=t.video)||void 0===T?void 0:T.sendOn}}}))),e.share&&(c=e.share,d=c.deviceOn,m=c.sendOn,p=c.opBy,(!E(d)&&d!==(null===(A=t.share)||void 0===A?void 0:A.deviceOn)||!E(m)&&m!==(null===(U=t.share)||void 0===U?void 0:U.sendOn))&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.SHARECHANGE,body:{newVal:{deviceOn:E(d)?null===(H=this.mtgData.me.share)||void 0===H?void 0:H.deviceOn:d,sendOn:E(m)?null===(L=this.mtgData.me.share)||void 0===L?void 0:L.sendOn:m,opBy:p},oldVal:{deviceOn:null===(R=t.share)||void 0===R?void 0:R.deviceOn,sendOn:null===(w=t.share)||void 0===w?void 0:w.sendOn}}}))),"isSpotlightVideo"in e&&(e.isSpotlightVideo?(this.mtgData.me.isSpotlightVideo=!0,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!0,oldVal:null}})):(this.mtgData.me.isSpotlightVideo=!1,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!1,oldVal:!0}}))),!("isInLobby"in e)||E(t.isInLobby)?[3,5]:t.isInLobby===e.isInLobby?[3,5]:(this.mtgData.me.isInLobby=e.isInLobby,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()]);case 4:n.sent(),D(e,this.mtgData.me),!1===e.isInLobby&&(this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE)),this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:e.isInLobby,oldVal:!e.isInLobby}}),n.label=5;case 5:"isLeave"in e&&(this.stopKeepalive(),this.stopPolling(),this.clean(),this.connectionState=a.CLOSED,this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:e.resultInfo}),this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),e={}),delete e.reSub,delete e.resultInfo,D(e,this.mtgData.me),n.label=6;case 6:return[2]}}))}))},d=function(t){var n=e.find((function(e){return e.name===t}));if(n){if(n.seqId=l[t].maxSeqId,!l[t].items)return;l[t].items.forEach((function(e){var t=JSON.parse(e.content),n=t.event,i=t.state,a=t.body;if("full"===i)m.mtgData[n]=a;else if("update"===i)if(m.mtgData[n]||(m.mtgData[n]=a),n.indexOf("Users")>-1)a.users&&a.users.forEach((function(e){var t=m.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));-1===t?m.mtgData[n].users.push(e):D(e,m.mtgData[n].users[t]),e.userID===m.mtgData.me.userID&&m.mtgData.me.role!==s.AUDIENCE&&c(e)}));else if("me"===n)a.users&&a.users.forEach((function(e){"userID"in e||(e.userID=m.mtgData.me.userID),c(e)}));else if("spotlightVideo"===n){(a.userIDs&&a.userIDs.findIndex((function(e){return e===m.mtgData.me.userID})))>-1?c({userID:m.mtgData.me.userID,isSpotlightVideo:!0}):m.mtgData.me.isSpotlightVideo&&c({userID:m.mtgData.me.userID,isSpotlightVideo:!1})}else"meetingState"===n&&"ended"===a.state?c({userID:m.mtgData.me.userID,resultInfo:a.resultInfo,isLeave:!0}):n.indexOf("Layout")>-1?m.mtgData[n]=a:D(a,m.mtgData[n]);else"delete"===i?n.indexOf("Users")>-1?a.users&&a.users.forEach((function(e){if(m.mtgData[n]){var t=m.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));if(t>-1&&m.mtgData[n].users.splice(t,1),e.userID===m.mtgData.me.userID){var i=Object.keys(e).length;e.role?c(e):e.resultInfo&&2===i&&(e.isLeave=!0,c(e))}}})):"me"===n&&c({userID:m.mtgData.me.userID,isLeave:!0,resultInfo:a.users&&a.users[0]&&a.users[0].resultInfo}):("meetingBarrage"===n&&m.handleBarrage(a),"setUserAudio"===n?m.emitter.emit(r.ME_CHANGE,{event:o.SETAUDIO,body:a}):"setUserVideo"===n?m.emitter.emit(r.ME_CHANGE,{event:o.SETVIDEO,body:a}):m.mtgData[n]?D(a,m.mtgData[n]):m.mtgData[n]=a);m.emitter.emit(r.MEETING_CHANGE,{event:n,body:JSON.parse(JSON.stringify(a)),state:i,stime:null})}))}},Object.keys(l).forEach(d),this.pollingStatus.attempts=0,[2]):[2]}}))}))},this.pollingStatus.timer&&(clearTimeout(this.pollingStatus.timer),this.pollingStatus.timer=null),5!==this.pollingStatus.errorTimes?[3,2]:(this.stopKeepalive(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"polling.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"polling",data:this.pollingStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return c.sent(),[2];case 2:return[4,i()];case 3:return c.sent(),this.pollingStatus.running?(u=this.pollingStatus.attempts?200*this.pollingStatus.attempts:0,this.pollingStatus.timer=setTimeout((function(){l.pollingStatus.running&&l.polling(e)}),u),[2]):[2]}}))}))},l.prototype.keepalive=function(){return t(this,void 0,void 0,(function(){var e,i=this;return n(this,(function(s){switch(s.label){case 0:return e=function(){return t(i,void 0,void 0,(function(){var e,t,i,s=this;return n(this,(function(n){switch(n.label){case 0:return this.keepaliveStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.keepalive({userID:this.mtgData.me.userID||-1}).catch((function(e){s.keepaliveStatus.attempts++,s.keepaliveStatus.errorTimes++,s.keepaliveStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(e=n.sent())&&e.data?(t=e.data,(i=(void 0===t?{}:t).interval||"")?(this.keepaliveStatus.interval=i,this.keepaliveStatus.attempts=0,[2]):(this.keepaliveStatus.attempts++,[2])):(this.keepaliveStatus.attempts++,[2])}}))}))},this.keepaliveStatus.timer&&(clearTimeout(this.keepaliveStatus.timer),this.keepaliveStatus.timer=null),5!==this.keepaliveStatus.errorTimes?[3,2]:(this.stopPolling(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"keepalive.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"polling",data:this.keepaliveStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return s.sent(),[2];case 2:return[4,e()];case 3:return s.sent(),this.keepaliveStatus.running?(this.keepaliveStatus.timer=setTimeout((function(){i.keepaliveStatus.running&&i.keepalive()}),1e3*(this.keepaliveStatus.interval||0)),[2]):[2]}}))}))},l.prototype.getTopics=function(e){var t=[];switch(e.endpointType){case i.WEBCTRL:t=["meeting","interactive","broadcast","lobby","hostAttendee","audience","advCtrl"];break;case i.WEBAPP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive","chat","audience"]:["meeting","interactive","broadcast","lobby","chat","hostAttendee"];break;case i.WECHATMP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive"]:["meeting","interactive","broadcast","lobby"];break;case i.SUPERVISION:t=["meeting","interactive","broadcast"]}return t},l}(),y=function(){return C.instance},N=function(){function e(e){!function(e){C.createInstance(e)}(e)}return Object.defineProperty(e.prototype,"ctrl",{get:function(){return y().ctrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return y().mtgData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){return y().connectionState},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return y().emitter.on(e,t)},e.prototype.off=function(e,t){return y().emitter.off(e,t)},e.prototype.getBaseURL=function(){return y().ctrl.baseURL},e.prototype.setBaseURL=function(e){y().ctrl.setBaseURL(e)},e.prototype.getJobStatus=function(){return{polling:y().pollingStatus,keepalive:y().keepaliveStatus}},e.prototype.join=function(e){return t(this,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return(t=y()).ctrl.setSessionID((i=e.endpointType,s=e.meetingNum,""+(null==i?void 0:i.toLocaleUpperCase())+S+"_"+b(new Date,"MMddHHmmss")+"_"+s)),[4,t.join(e)];case 1:return n.sent()?(t.connectionState=a.CONNECTED,t.emitter.emit(r.CONNECTION_STATE,{state:a.CONNECTED,data:t.mtgData.me.mediaContent}),[4,Promise.all([t.startPolling(),t.startKeepalive()])]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}var i,s}))}))},e.prototype.updateUserState=function(e){return t(this,void 0,void 0,(function(){var t,i,a,u,l,c,d;return n(this,(function(n){switch(n.label){case 0:return t=y(),i={audio:{deviceOn:!0,sendOn:!0,recvOn:!1},video:{deviceOn:!0,sendOn:!0,recvOn:!1},share:{deviceOn:!0,sendOn:!1,recvOn:!1}},i=e?D(e,i):i,a=JSON.parse(JSON.stringify(i)),D(a,y().mtgData.me),u=t.mtgData.me,l=u.role,c=u.initialMediaState,d=void 0===c?{audio:{sendOn:!0},video:{sendOn:!0}}:c,i.audio.sendOn=i.audio.sendOn&&d.audio.sendOn,i.video.sendOn=i.video.sendOn&&d.video.sendOn,l===s.AUDIENCE&&(i.audio.sendOn=!1,i.video.sendOn=!1),t.mtgData.me.isUpdatedUserState=!0,[4,t.ctrl.updateUserState(i)];case 1:return n.sent(),l===s.AUDIENCE&&(D(i,y().mtgData.me),!1!==a.audio.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:i.audio,oldVal:a.audio}}),!1!==a.video.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:i.video,oldVal:a.video}})),[2]}}))}))},e.prototype.leave=function(e){return t(this,void 0,void 0,(function(){var t,i;return n(this,(function(n){switch(n.label){case 0:return t=y(),e||(e={bizCode:901359}),[4,t.ctrl.leave({resultInfo:e})];case 1:return i=n.sent().error,[4,Promise.all([t.stopPolling(),t.stopKeepalive()])];case 2:return n.sent(),t.clean(),t.connectionState=a.CLOSED,i?(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"leave",data:i}}),[2,!1]):(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.prototype.end=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,(e=y()).ctrl.end()];case 1:return t=n.sent().error,[4,Promise.all([e.stopPolling(),e.stopKeepalive()])];case 2:return n.sent(),e.clean(),e.connectionState=a.CLOSED,t?(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"end",data:t}}),[2,!1]):(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.ENDPOINT_TYPE=i,e.EVENT=r,e.CONNECTION_STATE=a,e.ROLE=s,e.ME_CHANGE=o,e.MEETING_CHANGE=u,e}();export default N;
|
|
1
|
+
var e=function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function t(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{u(i.next(e))}catch(e){r(e)}}function o(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}u((i=i.apply(e,t||[])).next())}))}function n(e,t){var n,i,s,r,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){a.label=r[1];break}if(6===r[0]&&a.label<s[1]){a.label=s[1],s=r;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(r);break}s[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}}var i,s,r,a,o,u,l,c=function(){function e(e){this.defaultHeaders={},this.baseURL=e.baseURL,this.beforeRequest=e.beforeRequest}return e.prototype.setDefaultHeader=function(e,t){e in this.defaultHeaders&&(""===t||null===t)?delete this.defaultHeaders[e]:this.defaultHeaders[e]=t},e.prototype.request=function(e){var t=e.url,n=void 0===t?"":t,i=e.timeout,s=void 0===i?6e4:i,r=e.headers,a=void 0===r?{}:r;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+v(n.replace(/^\/+/,""),e.params),a=Object.assign(a,this.defaultHeaders),Object.keys(a).forEach((function(e){"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(a["Content-Type"]=a[e],delete a[e])})),g(e.data)&&(a&&!a["Content-Type"]&&(a["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=a,e.timeout=s,this.beforeRequest&&this.beforeRequest(e),"undefined"!=typeof wx?m(e):d(e)},e.prototype.get=function(e,t){return this.request(Object.assign(t||{},{url:e,method:"GET"}))},e.prototype.post=function(e,t,n){return this.request(Object.assign(n||{},{url:e,method:"POST",data:t}))},e}(),d=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=new XMLHttpRequest;c.open(o.toUpperCase(),r,!0),c.timeout=e.timeout;var d="",m=function(){if(c){if(c.status>=200&&c.status<300)try{t(JSON.parse(c.responseText))}catch(e){n(new Error("E_JSON_PARSE"+c.responseText))}else n(new Error("Request failed with status code "+c.status));c=null}};"onloadend"in c?c.onloadend=m:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(m)},c.onabort=function(){c&&(n(new Error("Request aborted "+d)),c=null)},c.onerror=function(){n(new Error("Network Error")),c=null},c.ontimeout=function(){n(new Error("timeout of "+e.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(u).forEach((function(e){null===s&&"content-type"===e.toLowerCase()?delete u[e]:c.setRequestHeader(e,u[e])})),l&&l.promise.then((function(e){c&&(d=e,c.abort(),n(e),c=null)})),c.send(s)}))},m=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=wx.request({url:r,data:s,method:o.toUpperCase(),timeout:e.timeout,header:u,success:function(e){e.statusCode>=200&&e.statusCode<300?t(e.data):n(new Error("Request failed with status code "+e.statusCode))},fail:function(e){"request:fail abort"===e.errMsg&&l?n(l.reason):n(e)}});l&&l.promise.then((function(){c&&c.abort()}))}))},p=function(){function e(e){var t,n=this;this.promise=new Promise((function(e){t=e})),e((function(e){n.reason||(n.reason=e,t(n.reason))}))}return e.source=function(){var t,n=new e((function(e){t=e}));return{cancel:t,token:n}},e}(),h=Object.prototype.toString,g=function(e){if("[object Object]"!==h.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},f=function(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")},v=function(e,t){if(!t)return e;var n=[];Object.keys(t).forEach((function(e){var i,s=t[e];null!=s&&(Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((function(t){null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),n.push(f(e)+"="+f(t))})))}));var i=n.join("&");if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e},E=function(){for(var e=[],t="0123456789abcdef",n=0;n<36;n++)e[n]=t.substr(Math.floor(16*Math.random()),1);return e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("").split("-").join("")},b=function(e){return null==e},S=E(),D=function(e,t){void 0===e&&(e=new Date);var n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("00"+n[i]).substr((""+n[i]).length)));return t},O=function(e,t){return e?(Object.entries(e).forEach((function(e){var n,i=[e[0],e[1]],s=i[0],r=i[1];if(null!==r)return"object"==typeof(n=r)&&null!==n?(t[s]||(t[s]={}),void(t[s]=O(r,t[s]))):void(t[s]=r)})),t):t},y=function(e){var t="/meeting-ctrl/api/v1",n=new c({baseURL:e,beforeRequest:function(e){e.headers["X-Y-Request-Id"]=E()}}),i=p.source(),s="",r="",a="",o="",u="",l="";return{cancelToken:function(e){i.cancel(e),i=p.source()},developerToken:function(e){return n.post("/developer-manager/api/v1/token",{grant_type:"client_credentials"},{headers:{"x-yl-terminal-type":"web","x-yl-terminal-version":e.version,Authorization:e.Authorization,timestamp:e.timestamp,nonce:e.nonce}})},credential:function(e){return n.get(t+"/credential",{params:e})},join:function(e){return n.post(t+"/join?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":a}})},updateUserState:function(e){return n.post(t+"/meetings/"+o+"/updateUserState",e)},inbox:function(e){return n.post("/ypush/api/v1/meeting-control/inbox",e)},polling:function(e){return n.post("/ypush/api/v1/meeting-control/polling",e,{cancelToken:i.token})},subscribe:function(e){return n.post(t+"/meetings/"+o+"/subscribe",e)},keepalive:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/keepalive",{},{cancelToken:i.token})},leave:function(e){return n.post(t+"/meetings/"+o+"/leave",e)},end:function(){return n.post(t+"/meetings/"+o+"/end")},audio:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/audio",e)},video:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/video",e)},share:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/share",e)},handUp:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/handUp",e)},replyHandUp:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/replyHandUp",e)},shareInfo:function(e){return n.get(t+"/meetings/"+o+"/shareInfo",{params:e})},trying:function(e){return n.post(t+"/trying?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":a}})},rejectCall:function(e){return n.post(t+"/rejectCall?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":a}})},pauseAudio:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/pauseAudio")},resumeAudio:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/resumeAudio")},lobbyState:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/lobbyState",e)},displayName:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/displayName",e)},callStats:function(e){return n.get(t+"/meetings/"+o+"/users/"+e.userID+"/callStats")},user:function(e){return n.get(t+"/meetings/"+o+"/users/"+e.userID)},blockVideo:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/blockVideo")},unblockVideo:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/unblockVideo")},role:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/role",e)},remove:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/remove",e)},dtmf:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/dtmf",e)},fecc:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/fecc",e)},hostLayout:function(e){return n.post(t+"/meetings/"+o+"/view/hostLayout",e)},attendeeLayout:function(e){return n.post(t+"/meetings/"+o+"/view/attendeeLayout",e)},audienceLayout:function(e){return n.post(t+"/meetings/"+o+"/view/audienceLayout",e)},personalLayout:function(e){return n.post(t+"/meetings/"+o+"/view/personalLayout",e)},personalLayoutDelete:function(e){return n.post(t+"/meetings/"+o+"/view/personalLayout/delete",e)},virtualClassLayout:function(e){return n.post(t+"/meetings/"+o+"/view/virtualClass/layout",e)},virtualClassClose:function(){return n.post(t+"/meetings/"+o+"/view/virtualClass/close")},spotlight:function(e){return n.post(t+"/meetings/"+o+"/view/spotlight",e)},lobbyRefuseAll:function(){return n.post(t+"/meetings/"+o+"/lobby/refuseAll")},lobbyAdmitAll:function(){return n.post(t+"/meetings/"+o+"/lobby/admitAll")},barrage:function(e){return n.post(t+"/meetings/"+o+"/barrage",e)},deleteBarrage:function(){return n.post(t+"/meetings/"+o+"/deleteBarrage")},operationRecord:function(e){return n.post(t+"/meetings/"+o+"/operationRecord",e)},practiceSession:function(){return n.post(t+"/meetings/"+o+"/info/practiceSession")},replyAllHandUp:function(){return n.post(t+"/meetings/"+o+"/replyAllHandUp")},unmuteAll:function(){return n.post(t+"/meetings/"+o+"/unmuteAll")},muteAll:function(){return n.post(t+"/meetings/"+o+"/muteAll")},audioDump:function(){return n.post(t+"/meetings/"+o+"/audioDump")},endMeeting:function(e){return n.post(t+"/meetingNum/"+e.meetingNum+"/end")},msg:function(e){return n.post(t+"/meetings/"+o+"/chat/msg",e)},historyMsg:function(e){return n.post(t+"/meetings/"+o+"/chat/historyMsg",e)},callStatsReport:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/callStats/report",e)},remoteDesktop:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/remoteDesktop",{action:e.action})},meetings:function(e){return n.get(t+"/meetings",{params:e})},mailTemplate:function(e){return n.get(t+"/mailTemplate",{params:{meetingID:o},headers:{language:e.language}})},get baseURL(){return n.baseURL},setBaseURL:function(e){n.baseURL=e},get accessToken(){return s},setAccessToken:function(e){void 0===e&&(e=""),s=e,n.setDefaultHeader("x-yl-access-token",s),n.setDefaultHeader("x-yl-terminal-type","web")},get version(){return s},setVersion:function(e){void 0===e&&(e=""),r=e,n.setDefaultHeader("x-yl-terminal-version",r)},get sessionID(){return a},setSessionID:function(e){void 0===e&&(e=""),a=e,n.setDefaultHeader("X-Y-Session-Id",a)},get meetingID(){return o},setMeetingID:function(e){void 0===e&&(e=""),o=e},get location(){return l},setLocation:function(e){void 0===e&&(e=""),l=e,n.setDefaultHeader("X-Y-Location",l)},get ctrlID(){return u},setCtrlID:function(e){void 0===e&&(e=""),u=e,n.setDefaultHeader("X-Y-Ctrl-Id",u)}}},C=function(){function e(){this.events=new Map}return e.prototype.emit=function(e,t){var n=this.events.get(e);n&&n.slice().map((function(e){e(t)}))},e.prototype.off=function(e,t){var n=this.events.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):this.events.set(e,[]))},e.prototype.on=function(e,t){var n=this.events.get(e);n?n.push(t):this.events.set(e,[t])},e}();!function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision"}(i||(i={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(s||(s={})),function(e){e.CONNECTION_STATE="CONNECTION_STATE",e.MEETING_CHANGE="MEETING_CHANGE",e.ME_CHANGE="ME_CHANGE",e.UPDATE_USER_STATE="UPDATE_USER_STATE"}(r||(r={})),function(e){e.CONNECTED="connected",e.SUBSCRIBED="subscribed",e.CLOSED="closed"}(a||(a={})),function(e){e.ROLECHANGE="roleChange",e.AUDIOCHANGE="audioChange",e.HANDUPCHANGE="handupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="videoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="shareChange",e.DISPLAYNAMECHANGE="displayNameChange",e.SPOTLIGHTVIDEOCHANGE="spotlightVideoChange",e.LOBBYCHANGE="lobbyChange",e.BARRAGECHANGE="barrageChange",e.LEAVE="leave"}(o||(o={})),function(e){e.MEETINGINFO="meetingInfo",e.MEETINGSTATE="meetingState",e.MEETINGSETTING="meetingSetting",e.MEETINGVIEW="meetingView",e.MEETINGBARRAGE="meetingBarrage",e.RECORDING="recording",e.LIVESTREAM="liveStream",e.INTERACTIVEUSERS="interactiveUsers",e.BROADCASTUSERS="broadcastUsers",e.LOBBYUSERS="lobbyUsers",e.VIRTUALUSERS="virtualUsers",e.CHATMSG="chatMsg",e.INVITESTATE="inviteState",e.CALLRECORD="callRecord",e.ME="me"}(u||(u={})),function(e){e.STARTED="started",e.PAUSED="paused",e.STARTING="starting",e.STOPPED="stopped"}(l||(l={}));var I=function(){function l(e){this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}},this.pollingStatus={attempts:0,errorTimes:0,errors:[]},this.keepaliveStatus={attempts:0,errorTimes:0,errors:[]},this.connectionState=a.CLOSED,this.isClosedStateEmited=!1,this.barrageTimer=null,this.ctrl=y(e.baseURL),this.emitter=new C}return l.createInstance=function(e){return null===this.instance||void 0===this.instance?this.instance=new l(e):(this.instance.emitter&&(this.instance.emitter=new C),this.instance.ctrl&&(this.instance.ctrl=y(e.baseURL))),l.instance},l.prototype.join=function(i){return t(this,void 0,void 0,(function(){var t,s,a,u,l,c,d,m,p,h,g,f,v,E=this;return n(this,(function(n){switch(n.label){case 0:return this.isClosedStateEmited=!1,[4,this.ctrl.credential({meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName}).catch((function(e){E.emitClosedState({cause:"credential",data:e.message})}))];case 1:return(t=n.sent())&&t.data&&t.data.credential?(this.ctrl.setLocation(t.data.location),delete i.pwd,delete i.url,[4,this.ctrl.join(e(e({},i),{credential:t.data.credential})).catch((function(e){E.emitClosedState({cause:"join",data:e.message})}))]):[3,3];case 2:return(s=n.sent())&&s.data&&s.ret>-1?(a=s.data,u=a.meetingID,l=void 0===u?"":u,c=a.ctrlID,d=void 0===c?"":c,m=a.user,p=void 0===m?{}:m,h=a.mediaContent,g=void 0===h?{}:h,f=a.initialMediaState,v=void 0===f?{}:f,this.ctrl.setMeetingID(l),this.ctrl.setCtrlID(d),this.mtgData.me=e(e({},p),{mediaContent:g,initialMediaState:v}),this.mtgData.me.isInLobby?this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:!0,oldVal:null}}):this.emitter.emit(r.UPDATE_USER_STATE),[2,!0]):(this.emitClosedState({cause:"join",data:s}),[2,!1]);case 3:return this.emitClosedState({cause:"credential",data:t}),[2,!1];case 4:return[2]}}))}))},l.prototype.startPolling=function(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this.pollingStatus.attempts=0,this.pollingStatus.errorTimes=0,this.pollingStatus.errors=[],[4,this.inbox()];case 1:return e=t.sent(),[4,this.subscribe()];case 2:return t.sent()&&(this.pollingStatus.running=!0,this.polling(e)),[2]}}))}))},l.prototype.stopPolling=function(){this.pollingStatus.running=!1,this.pollingStatus.timer&&clearTimeout(this.pollingStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.startKeepalive=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this.keepaliveStatus.attempts=0,this.keepaliveStatus.errorTimes=0,this.keepaliveStatus.errors=[],this.keepaliveStatus.running=!0,this.keepalive(),[2]}))}))},l.prototype.stopKeepalive=function(){this.keepaliveStatus.running=!1,this.keepaliveStatus.timer&&clearTimeout(this.keepaliveStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.clean=function(){this.ctrl.setCtrlID(""),this.ctrl.setLocation(""),this.ctrl.setMeetingID(""),this.ctrl.setSessionID(""),this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}}},l.prototype.handleBarrage=function(e,t){var n=this;if(void 0===t&&(t=!1),!e){var i=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));delete this.mtgData.me.barrage,((a={newVal:null,oldVal:"{}"===JSON.stringify(i)?null:i}).newVal||a.oldVal)&&this.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:a}),this.barrageTimer&&clearTimeout(this.barrageTimer),this.barrageTimer=null}if(e||t){i=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));var a,u=this.mtgData.me.role,l=void 0===u?"":u,c=this.mtgData.meetingBarrage;e||(e=c),l===s.COHOST&&(l=s.HOST),e&&e.receiver[l]?this.mtgData.me.barrage={position:e.position,contentType:e.contentType,content:e.content}:delete this.mtgData.me.barrage,((a={newVal:this.mtgData.me.barrage||null,oldVal:"{}"===JSON.stringify(i)?null:i}).newVal||a.oldVal)&&this.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:a})}if(e&&this.barrageTimer&&(clearTimeout(this.barrageTimer),this.barrageTimer=null),e&&-1!==e.duration){var d=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));this.barrageTimer=setTimeout((function(){delete n.mtgData.me.barrage,n.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:{newVal:null,oldVal:"{}"===JSON.stringify(d)?null:d}})}),1e3*e.duration)}},l.prototype.emitClosedState=function(e){this.isClosedStateEmited||(this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:e}),this.isClosedStateEmited=!0,this.clean())},l.prototype.subscribe=function(){return t(this,void 0,void 0,(function(){var e,t,i=this;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.subscribe({topics:e}).catch((function(e){i.emitClosedState({cause:"subscribe",data:e.message})}))];case 1:return(t=n.sent())&&t.data?(t.data.eventMsgs.forEach((function(e){i.mtgData[e.event]=e.body,e.event.indexOf("Users")>-1&&e.body.users.forEach((function(e){if(e.userID===i.mtgData.me.userID){var t=Object.assign({},e);delete t.audio,delete t.video,delete t.share,O(t,i.mtgData.me)}})),e.event===u.MEETINGBARRAGE&&i.handleBarrage(e.body)})),this.mtgData.me.reSub?delete this.mtgData.me.reSub:(this.connectionState=a.SUBSCRIBED,this.emitter.emit(r.CONNECTION_STATE,{state:a.SUBSCRIBED})),[2,!0]):(this.emitClosedState({cause:"subscribe",data:t}),[2,!1])}}))}))},l.prototype.inbox=function(){return t(this,void 0,void 0,(function(){var e,t,i;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.inbox({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e})];case 1:return(t=n.sent())?(i=[],t.data&&Object.keys(t.data).forEach((function(e){i.push({name:e,seqId:t.data[e].maxSeqId,limit:200})})),[2,i]):[2,[]]}}))}))},l.prototype.polling=function(e){return t(this,void 0,void 0,(function(){var i,u,l=this;return n(this,(function(c){switch(c.label){case 0:return i=function(){return t(l,void 0,void 0,(function(){var i,u,l,c,d,m,p,h=this;return n(this,(function(g){switch(g.label){case 0:return this.pollingStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.polling({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e}).catch((function(e){h.pollingStatus.attempts++,h.pollingStatus.errorTimes++,h.pollingStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(i=g.sent())?(u=i.data,l=void 0===u?{}:u,c=i.error,(d=i.bizCode)&&900408!==d?(this.pollingStatus.errorTimes++,this.pollingStatus.errors.push({bizCode:d,msg:c&&c.msg,time:(new Date).valueOf()}),[2]):l?(m=function(e){return t(h,void 0,void 0,(function(){var t,i,u,l,c,d,m,p,h,g,f,v,E,S,D,y,C,I,T,N,A,H,U,w,L,R;return n(this,(function(n){switch(n.label){case 0:return e.userID!==this.mtgData.me.userID?[3,6]:(t=JSON.parse(JSON.stringify(this.mtgData.me)),e.role&&e.role!==t.role?(i=t.role,e.role!==s.AUDIENCE&&t.role!==s.AUDIENCE?[3,2]:(this.mtgData.me.role=e.role,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()])):[3,3]);case 1:n.sent(),this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE),n.label=2;case 2:e.role===s.AUDIENCE&&(e.audio={deviceOn:!0,sendOn:!1,recvOn:!1},e.video={deviceOn:!0,sendOn:!1,recvOn:!1},e.share={deviceOn:!0,sendOn:!1,recvOn:!1}),O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.ROLECHANGE,body:{newVal:e.role,oldVal:i}}),this.handleBarrage(null,!0),n.label=3;case 3:return e.displayName&&e.displayName!==t.displayName&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.DISPLAYNAMECHANGE,body:{newVal:e.displayName,oldVal:t.displayName}})),e.audio&&(u=e.audio,d=u.deviceOn,m=u.sendOn,p=u.opBy,(!b(d)&&d!==(null===(h=t.audio)||void 0===h?void 0:h.deviceOn)||!b(m)&&m!==(null===(g=t.audio)||void 0===g?void 0:g.sendOn))&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:{deviceOn:b(d)?null===(f=this.mtgData.me.audio)||void 0===f?void 0:f.deviceOn:d,sendOn:b(m)?null===(v=this.mtgData.me.audio)||void 0===v?void 0:v.sendOn:m,opBy:p},oldVal:{deviceOn:null===(E=t.audio)||void 0===E?void 0:E.deviceOn,sendOn:null===(S=t.audio)||void 0===S?void 0:S.sendOn}}}))),"isHandUp"in e&&(O(e,this.mtgData.me),e.isHandUp!==t.isHandUp&&"isHandUp"in t&&this.emitter.emit(r.ME_CHANGE,{event:o.HANDUPCHANGE,body:{newVal:e.isHandUp,oldVal:t.isHandUp}})),e.video&&(l=e.video,d=l.deviceOn,m=l.sendOn,p=l.opBy,(!b(d)&&d!==(null===(D=t.video)||void 0===D?void 0:D.deviceOn)||!b(m)&&m!==(null===(y=t.video)||void 0===y?void 0:y.sendOn))&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:{deviceOn:b(d)?null===(C=this.mtgData.me.video)||void 0===C?void 0:C.deviceOn:d,sendOn:b(m)?null===(I=this.mtgData.me.video)||void 0===I?void 0:I.sendOn:m,opBy:p},oldVal:{deviceOn:null===(T=t.video)||void 0===T?void 0:T.deviceOn,sendOn:null===(N=t.video)||void 0===N?void 0:N.sendOn}}}))),e.share&&(c=e.share,d=c.deviceOn,m=c.sendOn,p=c.opBy,(!b(d)&&d!==(null===(A=t.share)||void 0===A?void 0:A.deviceOn)||!b(m)&&m!==(null===(H=t.share)||void 0===H?void 0:H.sendOn))&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.SHARECHANGE,body:{newVal:{deviceOn:b(d)?null===(U=this.mtgData.me.share)||void 0===U?void 0:U.deviceOn:d,sendOn:b(m)?null===(w=this.mtgData.me.share)||void 0===w?void 0:w.sendOn:m,opBy:p},oldVal:{deviceOn:null===(L=t.share)||void 0===L?void 0:L.deviceOn,sendOn:null===(R=t.share)||void 0===R?void 0:R.sendOn}}}))),"isSpotlightVideo"in e&&(e.isSpotlightVideo?(this.mtgData.me.isSpotlightVideo=!0,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!0,oldVal:null}})):(this.mtgData.me.isSpotlightVideo=!1,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!1,oldVal:!0}}))),!("isInLobby"in e)||b(t.isInLobby)?[3,5]:t.isInLobby===e.isInLobby?[3,5]:(this.mtgData.me.isInLobby=e.isInLobby,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()]);case 4:n.sent(),O(e,this.mtgData.me),!1===e.isInLobby&&(this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE)),this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:e.isInLobby,oldVal:!e.isInLobby}}),n.label=5;case 5:"isLeave"in e&&(this.stopKeepalive(),this.stopPolling(),this.clean(),this.connectionState=a.CLOSED,this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:e.resultInfo}),this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),e={}),delete e.reSub,delete e.resultInfo,O(e,this.mtgData.me),n.label=6;case 6:return[2]}}))}))},p=function(t){var n=e.find((function(e){return e.name===t}));if(n){if(n.seqId=l[t].maxSeqId,!l[t].items)return;l[t].items.forEach((function(e){var t=JSON.parse(e.content),n=t.event,i=t.state,a=t.body;if("full"===i)h.mtgData[n]=a,"meetingBarrage"===n&&h.handleBarrage(a);else if("update"===i)if(h.mtgData[n]||(h.mtgData[n]=a),n.indexOf("Users")>-1)a.users&&a.users.forEach((function(e){var t=h.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));-1===t?h.mtgData[n].users.push(e):O(e,h.mtgData[n].users[t]),e.userID===h.mtgData.me.userID&&h.mtgData.me.role!==s.AUDIENCE&&m(e)}));else if("me"===n)a.users&&a.users.forEach((function(e){"userID"in e||(e.userID=h.mtgData.me.userID),m(e)}));else if("spotlightVideo"===n){(a.userIDs&&a.userIDs.findIndex((function(e){return e===h.mtgData.me.userID})))>-1?m({userID:h.mtgData.me.userID,isSpotlightVideo:!0}):h.mtgData.me.isSpotlightVideo&&m({userID:h.mtgData.me.userID,isSpotlightVideo:!1})}else"meetingState"===n&&"ended"===a.state?m({userID:h.mtgData.me.userID,resultInfo:a.resultInfo,isLeave:!0}):n.indexOf("Layout")>-1?h.mtgData[n]=a:O(a,h.mtgData[n]);else"delete"===i?(n.indexOf("Users")>-1?a.users&&a.users.forEach((function(e){if(h.mtgData[n]){var t=h.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));if(t>-1&&h.mtgData[n].users.splice(t,1),e.userID===h.mtgData.me.userID){var i=Object.keys(e).length;e.role?m(e):e.resultInfo&&2===i&&(e.isLeave=!0,m(e))}}})):"me"===n&&m({userID:h.mtgData.me.userID,isLeave:!0,resultInfo:a.users&&a.users[0]&&a.users[0].resultInfo}),"meetingBarrage"===n&&(h.mtgData[n]=a,h.handleBarrage(a))):("meetingBarrage"===n&&(O(a,h.mtgData[n]),h.handleBarrage(a)),"setUserAudio"===n?h.emitter.emit(r.ME_CHANGE,{event:o.SETAUDIO,body:a}):"setUserVideo"===n?h.emitter.emit(r.ME_CHANGE,{event:o.SETVIDEO,body:a}):h.mtgData[n]?O(a,h.mtgData[n]):h.mtgData[n]=a);h.emitter.emit(r.MEETING_CHANGE,{event:n,body:JSON.parse(JSON.stringify(a)),state:i,stime:null})}))}},Object.keys(l).forEach(p),this.pollingStatus.attempts=0,[2]):[2]):(this.pollingStatus.errorTimes++,this.pollingStatus.errors.push({msg:"error response",time:(new Date).valueOf()}),[2])}}))}))},this.pollingStatus.timer&&(clearTimeout(this.pollingStatus.timer),this.pollingStatus.timer=null),5!==this.pollingStatus.errorTimes?[3,2]:(this.stopKeepalive(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"polling.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"polling",data:this.pollingStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return c.sent(),[2];case 2:return[4,i()];case 3:return c.sent(),this.pollingStatus.running?(u=this.pollingStatus.attempts?200*this.pollingStatus.attempts:0,this.pollingStatus.timer=setTimeout((function(){l.pollingStatus.running&&l.polling(e)}),u),[2]):[2]}}))}))},l.prototype.keepalive=function(){return t(this,void 0,void 0,(function(){var e,i=this;return n(this,(function(s){switch(s.label){case 0:return e=function(){return t(i,void 0,void 0,(function(){var e,t,i,s,r,a=this;return n(this,(function(n){switch(n.label){case 0:return this.keepaliveStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.keepalive({userID:this.mtgData.me.userID||-1}).catch((function(e){a.keepaliveStatus.attempts++,a.keepaliveStatus.errorTimes++,a.keepaliveStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(e=n.sent())?(t=e.bizCode,i=e.data,s=e.error,900200!==t&&900408!==t&&901323!==t?(this.keepaliveStatus.errorTimes++,this.keepaliveStatus.errors.push({bizCode:t,msg:s&&s.msg||"error response",time:(new Date).valueOf()}),[2]):i?(r=i.interval||"")?(this.keepaliveStatus.interval=r,this.keepaliveStatus.attempts=0,[2]):(this.keepaliveStatus.attempts++,[2]):[2]):(this.keepaliveStatus.errorTimes++,this.keepaliveStatus.errors.push({msg:"error response",time:(new Date).valueOf()}),[2])}}))}))},this.keepaliveStatus.timer&&(clearTimeout(this.keepaliveStatus.timer),this.keepaliveStatus.timer=null),5!==this.keepaliveStatus.errorTimes?[3,2]:(this.stopPolling(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"keepalive.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"keepalive",data:this.keepaliveStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return s.sent(),[2];case 2:return[4,e()];case 3:return s.sent(),this.keepaliveStatus.running?(this.keepaliveStatus.timer=setTimeout((function(){i.keepaliveStatus.running&&i.keepalive()}),1e3*(this.keepaliveStatus.interval||0)),[2]):[2]}}))}))},l.prototype.getTopics=function(e){var t=[];switch(e.endpointType){case i.WEBCTRL:t=["meeting","interactive","broadcast","lobby","hostAttendee","audience","advCtrl"];break;case i.WEBAPP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive","chat","audience"]:["meeting","interactive","broadcast","lobby","chat","hostAttendee"];break;case i.WECHATMP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive"]:["meeting","interactive","broadcast","lobby"];break;case i.SUPERVISION:t=["meeting","interactive","broadcast"]}return t},l}(),T=function(){return I.instance},N=function(){function e(e){!function(e){I.createInstance(e)}(e)}return Object.defineProperty(e.prototype,"ctrl",{get:function(){return T().ctrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return T().mtgData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){return T().connectionState},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return T().emitter.on(e,t)},e.prototype.off=function(e,t){return T().emitter.off(e,t)},e.prototype.getBaseURL=function(){return T().ctrl.baseURL},e.prototype.setBaseURL=function(e){T().ctrl.setBaseURL(e)},e.prototype.getJobStatus=function(){return{polling:T().pollingStatus,keepalive:T().keepaliveStatus}},e.prototype.join=function(e){return t(this,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return(t=T()).ctrl.setSessionID((i=e.endpointType,s=e.meetingNum,""+(null==i?void 0:i.toLocaleUpperCase())+S+"_"+D(new Date,"MMddHHmmss")+"_"+s)),[4,t.join(e)];case 1:return n.sent()?(t.connectionState=a.CONNECTED,t.emitter.emit(r.CONNECTION_STATE,{state:a.CONNECTED,data:t.mtgData.me.mediaContent}),[4,Promise.all([t.startPolling(),t.startKeepalive()])]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}var i,s}))}))},e.prototype.updateUserState=function(e){return t(this,void 0,void 0,(function(){var t,i,a,u,l,c,d;return n(this,(function(n){switch(n.label){case 0:return t=T(),i={audio:{deviceOn:!0,sendOn:!0,recvOn:!1},video:{deviceOn:!0,sendOn:!0,recvOn:!1},share:{deviceOn:!0,sendOn:!1,recvOn:!1}},i=e?O(e,i):i,a=JSON.parse(JSON.stringify(i)),O(a,T().mtgData.me),u=t.mtgData.me,l=u.role,c=u.initialMediaState,d=void 0===c?{audio:{sendOn:!0},video:{sendOn:!0}}:c,i.audio.sendOn=i.audio.sendOn&&d.audio.sendOn,i.video.sendOn=i.video.sendOn&&d.video.sendOn,l===s.AUDIENCE&&(i.audio.sendOn=!1,i.video.sendOn=!1),t.mtgData.me.isUpdatedUserState=!0,[4,t.ctrl.updateUserState(i)];case 1:return n.sent(),l===s.AUDIENCE&&(O(i,T().mtgData.me),!1!==a.audio.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:i.audio,oldVal:a.audio}}),!1!==a.video.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:i.video,oldVal:a.video}})),[2]}}))}))},e.prototype.leave=function(e){return t(this,void 0,void 0,(function(){var t,i;return n(this,(function(n){switch(n.label){case 0:return t=T(),e||(e={bizCode:901359}),[4,t.ctrl.leave({resultInfo:e})];case 1:return i=n.sent().error,[4,Promise.all([t.stopPolling(),t.stopKeepalive()])];case 2:return n.sent(),t.clean(),t.connectionState=a.CLOSED,i?(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"leave",data:i}}),[2,!1]):(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.prototype.end=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,(e=T()).ctrl.end()];case 1:return t=n.sent().error,[4,Promise.all([e.stopPolling(),e.stopKeepalive()])];case 2:return n.sent(),e.clean(),e.connectionState=a.CLOSED,t?(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"end",data:t}}),[2,!1]):(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.ENDPOINT_TYPE=i,e.EVENT=r,e.CONNECTION_STATE=a,e.ROLE=s,e.ME_CHANGE=o,e.MEETING_CHANGE=u,e}();export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Meeting=t()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function t(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{u(i.next(e))}catch(e){r(e)}}function o(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}u((i=i.apply(e,t||[])).next())}))}function n(e,t){var n,i,s,r,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){a.label=r[1];break}if(6===r[0]&&a.label<s[1]){a.label=s[1],s=r;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(r);break}s[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}}var i,s,r,a,o,u,l=function(){function e(e){this.defaultHeaders={},this.baseURL=e.baseURL,this.beforeRequest=e.beforeRequest}return e.prototype.setDefaultHeader=function(e,t){e in this.defaultHeaders&&(""===t||null===t)?delete this.defaultHeaders[e]:this.defaultHeaders[e]=t},e.prototype.request=function(e){var t=e.url,n=void 0===t?"":t,i=e.timeout,s=void 0===i?6e4:i,r=e.headers,a=void 0===r?{}:r;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+v(n.replace(/^\/+/,""),e.params),a=Object.assign(a,this.defaultHeaders),Object.keys(a).forEach((function(e){"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(a["Content-Type"]=a[e],delete a[e])})),h(e.data)&&(a&&!a["Content-Type"]&&(a["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=a,e.timeout=s,this.beforeRequest&&this.beforeRequest(e),"undefined"!=typeof wx?d(e):c(e)},e.prototype.get=function(e,t){return this.request(Object.assign(t||{},{url:e,method:"GET"}))},e.prototype.post=function(e,t,n){return this.request(Object.assign(n||{},{url:e,method:"POST",data:t}))},e}(),c=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=new XMLHttpRequest;c.open(o.toUpperCase(),r,!0),c.timeout=e.timeout;var d="",m=function(){if(c){if(c.status>=200&&c.status<300)try{t(JSON.parse(c.responseText))}catch(e){n(new Error("E_JSON_PARSE"+c.responseText))}else n(new Error("Request failed with status code "+c.status));c=null}};"onloadend"in c?c.onloadend=m:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(m)},c.onabort=function(){c&&(n(new Error("Request aborted "+d)),c=null)},c.onerror=function(){n(new Error("Network Error")),c=null},c.ontimeout=function(){n(new Error("timeout of "+e.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(u).forEach((function(e){null===s&&"content-type"===e.toLowerCase()?delete u[e]:c.setRequestHeader(e,u[e])})),l&&l.promise.then((function(e){c&&(d=e,c.abort(),n(e),c=null)})),c.send(s)}))},d=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=wx.request({url:r,data:s,method:o.toUpperCase(),timeout:e.timeout,header:u,success:function(e){e.statusCode>=200&&e.statusCode<300?t(e.data):n(new Error("Request failed with status code "+e.statusCode))},fail:function(e){"request:fail abort"===e.errMsg&&l?n(l.reason):n(e)}});l&&l.promise.then((function(){c&&c.abort()}))}))},m=function(){function e(e){var t,n=this;this.promise=new Promise((function(e){t=e})),e((function(e){n.reason||(n.reason=e,t(n.reason))}))}return e.source=function(){var t,n=new e((function(e){t=e}));return{cancel:t,token:n}},e}(),p=Object.prototype.toString,h=function(e){if("[object Object]"!==p.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},f=function(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")},v=function(e,t){if(!t)return e;var n=[];Object.keys(t).forEach((function(e){var i,s=t[e];null!=s&&(Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((function(t){null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),n.push(f(e)+"="+f(t))})))}));var i=n.join("&");if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e},g=function(){for(var e=[],t="0123456789abcdef",n=0;n<36;n++)e[n]=t.substr(Math.floor(16*Math.random()),1);return e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("").split("-").join("")},E=function(e){return null==e},b=g(),S=function(e,t){void 0===e&&(e=new Date);var n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("00"+n[i]).substr((""+n[i]).length)));return t},D=function(e,t){return e?(Object.entries(e).forEach((function(e){var n,i=[e[0],e[1]],s=i[0],r=i[1];if(null!==r)return"object"==typeof(n=r)&&null!==n?(t[s]||(t[s]={}),void(t[s]=D(r,t[s]))):void(t[s]=r)})),t):t},O=function(e){var t="/meeting-ctrl/api/v1",n=new l({baseURL:e,beforeRequest:function(e){e.headers["X-Y-Request-Id"]=g()}}),i=m.source(),s="",r="",a="",o="";return{cancelToken:function(e){i.cancel(e),i=m.source()},credential:function(e){return n.get(t+"/credential",{params:e})},join:function(e){return n.post(t+"/join?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":s}})},updateUserState:function(e){return n.post(t+"/meetings/"+r+"/updateUserState",e)},inbox:function(e){return n.post("/ypush/api/v1/meeting-control/inbox",e)},polling:function(e){return n.post("/ypush/api/v1/meeting-control/polling",e,{cancelToken:i.token})},subscribe:function(e){return n.post(t+"/meetings/"+r+"/subscribe",e)},keepalive:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/keepalive",{},{cancelToken:i.token})},leave:function(e){return n.post(t+"/meetings/"+r+"/leave",e)},end:function(){return n.post(t+"/meetings/"+r+"/end")},audio:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/audio",e)},video:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/video",e)},share:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/share",e)},handUp:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/handUp",e)},replyHandUp:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/replyHandUp",e)},shareInfo:function(e){return n.get(t+"/meetings/"+r+"/shareInfo",{params:e})},trying:function(e){return n.post(t+"/trying?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":s}})},rejectCall:function(e){return n.post(t+"/rejectCall?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":s}})},pauseAudio:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/pauseAudio")},resumeAudio:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/resumeAudio")},lobbyState:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/lobbyState",e)},displayName:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/displayName",e)},callStats:function(e){return n.get(t+"/meetings/"+r+"/users/"+e.userID+"/callStats")},user:function(e){return n.get(t+"/meetings/"+r+"/users/"+e.userID)},blockVideo:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/blockVideo")},unblockVideo:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/unblockVideo")},role:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/role",e)},remove:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/remove",e)},dtmf:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/dtmf",e)},fecc:function(e){return n.post(t+"/meetings/"+r+"/users/"+e.userID+"/fecc",e)},get baseURL(){return n.baseURL},setBaseURL:function(e){n.baseURL=e},get sessionID(){return s},setSessionID:function(e){void 0===e&&(e=""),s=e,n.setDefaultHeader("X-Y-Session-Id",s)},get meetingID(){return r},setMeetingID:function(e){void 0===e&&(e=""),r=e},get location(){return o},setLocation:function(e){void 0===e&&(e=""),o=e,n.setDefaultHeader("X-Y-Location",o)},get ctrlID(){return a},setCtrlID:function(e){void 0===e&&(e=""),a=e,n.setDefaultHeader("X-Y-Ctrl-Id",a)}}},I=function(){function e(){this.events=new Map}return e.prototype.emit=function(e,t){var n=this.events.get(e);n&&n.slice().map((function(e){e(t)}))},e.prototype.off=function(e,t){var n=this.events.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):this.events.set(e,[]))},e.prototype.on=function(e,t){var n=this.events.get(e);n?n.push(t):this.events.set(e,[t])},e}();!function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision"}(i||(i={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(s||(s={})),function(e){e.CONNECTION_STATE="CONNECTION_STATE",e.MEETING_CHANGE="MEETING_CHANGE",e.ME_CHANGE="ME_CHANGE",e.UPDATE_USER_STATE="UPDATE_USER_STATE"}(r||(r={})),function(e){e.CONNECTED="connected",e.SUBSCRIBED="subscribed",e.CLOSED="closed"}(a||(a={})),function(e){e.ROLECHANGE="roleChange",e.AUDIOCHANGE="audioChange",e.HANDUPCHANGE="handupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="videoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="shareChange",e.DISPLAYNAMECHANGE="displayNameChange",e.SPOTLIGHTVIDEOCHANGE="spotlightVideoChange",e.LOBBYCHANGE="lobbyChange",e.BARRAGECHANGE="barrageChange",e.LEAVE="leave"}(o||(o={})),function(e){e.MEETINGINFO="meetingInfo",e.MEETINGSTATE="meetingState",e.MEETINGSETTING="meetingSetting",e.MEETINGVIEW="meetingView",e.MEETINGBARRAGE="meetingBarrage",e.RECORDING="recording",e.LIVESTREAM="liveStream",e.INTERACTIVEUSERS="interactiveUsers",e.BROADCASTUSERS="broadcastUsers",e.LOBBYUSERS="lobbyUsers",e.VIRTUALUSERS="virtualUsers",e.CHATMSG="chatMsg",e.INVITESTATE="inviteState",e.CALLRECORD="callRecord",e.ME="me"}(u||(u={}));var C=function(){function l(e){this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}},this.pollingStatus={attempts:0,errorTimes:0,errors:[]},this.keepaliveStatus={attempts:0,errorTimes:0,errors:[]},this.connectionState=a.CLOSED,this.isClosedStateEmited=!1,this.barrageTimer=null,this.ctrl=O(e.baseURL),this.emitter=new I}return l.createInstance=function(e){return null===this.instance||void 0===this.instance?this.instance=new l(e):(this.instance.emitter&&(this.instance.emitter=new I),this.instance.ctrl&&(this.instance.ctrl=O(e.baseURL))),l.instance},l.prototype.join=function(i){return t(this,void 0,void 0,(function(){var t,s,a,u,l,c,d,m,p,h,f,v,g,E=this;return n(this,(function(n){switch(n.label){case 0:return this.isClosedStateEmited=!1,[4,this.ctrl.credential({meetingNum:i.meetingNum,pwd:i.pwd,url:i.url}).catch((function(e){E.emitClosedState({cause:"credential",data:e.message})}))];case 1:return(t=n.sent())&&t.data&&t.data.credential?(this.ctrl.setLocation(t.data.location),delete i.pwd,delete i.url,[4,this.ctrl.join(e(e({},i),{credential:t.data.credential})).catch((function(e){E.emitClosedState({cause:"join",data:e.message})}))]):[3,3];case 2:return(s=n.sent())&&s.data?(a=s.data,u=a.meetingID,l=void 0===u?"":u,c=a.ctrlID,d=void 0===c?"":c,m=a.user,p=void 0===m?{}:m,h=a.mediaContent,f=void 0===h?{}:h,v=a.initialMediaState,g=void 0===v?{}:v,this.ctrl.setMeetingID(l),this.ctrl.setCtrlID(d),this.mtgData.me=e(e({},p),{mediaContent:f,initialMediaState:g}),this.mtgData.me.isInLobby?this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:!0,oldVal:null}}):this.emitter.emit(r.UPDATE_USER_STATE),[2,!0]):(this.emitClosedState({cause:"join",data:s}),[2,!1]);case 3:return this.emitClosedState({cause:"credential",data:t}),[2,!1];case 4:return[2]}}))}))},l.prototype.startPolling=function(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this.pollingStatus.attempts=0,this.pollingStatus.errorTimes=0,this.pollingStatus.errors=[],[4,this.inbox()];case 1:return e=t.sent(),[4,this.subscribe()];case 2:return t.sent()&&(this.pollingStatus.running=!0,this.polling(e)),[2]}}))}))},l.prototype.stopPolling=function(){this.pollingStatus.running=!1,this.pollingStatus.timer&&clearTimeout(this.pollingStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.startKeepalive=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this.keepaliveStatus.attempts=0,this.keepaliveStatus.errorTimes=0,this.keepaliveStatus.errors=[],this.keepaliveStatus.running=!0,this.keepalive(),[2]}))}))},l.prototype.stopKeepalive=function(){this.keepaliveStatus.running=!1,this.keepaliveStatus.timer&&clearTimeout(this.keepaliveStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.clean=function(){this.ctrl.setCtrlID(""),this.ctrl.setLocation(""),this.ctrl.setMeetingID(""),this.ctrl.setSessionID(""),this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}}},l.prototype.handleBarrage=function(e,t){var n=this;if(void 0===t&&(t=!1),e||t){var i=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{})),a=this.mtgData.me.role,u=void 0===a?"":a,l=this.mtgData.meetingBarrage;e||(e=l),u===s.COHOST&&(u=s.HOST),(null==e?void 0:e.receiver[u])?this.mtgData.me.barrage={position:e.position,contentType:e.contentType,content:e.content}:delete this.mtgData.me.barrage;var c={newVal:this.mtgData.me.barrage||null,oldVal:"{}"===JSON.stringify(i)?null:i};(c.newVal||c.oldVal)&&this.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:c})}if(e&&this.barrageTimer&&(clearTimeout(this.barrageTimer),this.barrageTimer=null),e&&-1!==e.duration){var d=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));this.barrageTimer=setTimeout((function(){delete n.mtgData.me.barrage,n.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:{newVal:null,oldVal:"{}"===JSON.stringify(d)?null:d}})}),1e3*e.duration)}},l.prototype.emitClosedState=function(e){this.isClosedStateEmited||(this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:e}),this.isClosedStateEmited=!0,this.clean())},l.prototype.subscribe=function(){return t(this,void 0,void 0,(function(){var e,t,i=this;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.subscribe({topics:e}).catch((function(e){i.emitClosedState({cause:"subscribe",data:e.message})}))];case 1:return(t=n.sent())&&t.data?(t.data.eventMsgs.forEach((function(e){i.mtgData[e.event]=e.body,e.event.indexOf("Users")>-1&&e.body.users.forEach((function(e){e.userID===i.mtgData.me.userID&&(delete e.audio,delete e.video,delete e.share,D(e,i.mtgData.me))})),e.event===u.MEETINGBARRAGE&&i.handleBarrage(e.body)})),this.mtgData.me.reSub?delete this.mtgData.me.reSub:(this.connectionState=a.SUBSCRIBED,this.emitter.emit(r.CONNECTION_STATE,{state:a.SUBSCRIBED})),[2,!0]):(this.emitClosedState({cause:"subscribe",data:t}),[2,!1])}}))}))},l.prototype.inbox=function(){return t(this,void 0,void 0,(function(){var e,t,i;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.inbox({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e})];case 1:return(t=n.sent())?(i=[],t.data&&Object.keys(t.data).forEach((function(e){i.push({name:e,seqId:t.data[e].maxSeqId,limit:200})})),[2,i]):[2,[]]}}))}))},l.prototype.polling=function(e){return t(this,void 0,void 0,(function(){var i,u,l=this;return n(this,(function(c){switch(c.label){case 0:return i=function(){return t(l,void 0,void 0,(function(){var i,u,l,c,d,m=this;return n(this,(function(p){switch(p.label){case 0:return this.pollingStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.polling({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e}).catch((function(e){m.pollingStatus.attempts++,m.pollingStatus.errorTimes++,m.pollingStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(i=p.sent())&&i.data?(u=i.data,l=void 0===u?{}:u,c=function(e){return t(m,void 0,void 0,(function(){var t,i,u,l,c,d,m,p,h,f,v,g,b,S,O,I,C,y,N,T,A,U,H,L,R,w;return n(this,(function(n){switch(n.label){case 0:return e.userID!==this.mtgData.me.userID?[3,6]:(t=JSON.parse(JSON.stringify(this.mtgData.me)),e.role&&e.role!==t.role?(i=t.role,e.role!==s.AUDIENCE&&t.role!==s.AUDIENCE?[3,2]:(this.mtgData.me.role=e.role,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()])):[3,3]);case 1:n.sent(),this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE),n.label=2;case 2:e.role===s.AUDIENCE&&(e.audio={deviceOn:!0,sendOn:!1,recvOn:!1},e.video={deviceOn:!0,sendOn:!1,recvOn:!1},e.share={deviceOn:!0,sendOn:!1,recvOn:!1}),D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.ROLECHANGE,body:{newVal:e.role,oldVal:i}}),this.handleBarrage(null,!0),n.label=3;case 3:return e.displayName&&e.displayName!==t.displayName&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.DISPLAYNAMECHANGE,body:{newVal:e.displayName,oldVal:t.displayName}})),e.audio&&(u=e.audio,d=u.deviceOn,m=u.sendOn,p=u.opBy,(!E(d)&&d!==(null===(h=t.audio)||void 0===h?void 0:h.deviceOn)||!E(m)&&m!==(null===(f=t.audio)||void 0===f?void 0:f.sendOn))&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:{deviceOn:E(d)?null===(v=this.mtgData.me.audio)||void 0===v?void 0:v.deviceOn:d,sendOn:E(m)?null===(g=this.mtgData.me.audio)||void 0===g?void 0:g.sendOn:m,opBy:p},oldVal:{deviceOn:null===(b=t.audio)||void 0===b?void 0:b.deviceOn,sendOn:null===(S=t.audio)||void 0===S?void 0:S.sendOn}}}))),"isHandUp"in e&&(D(e,this.mtgData.me),e.isHandUp!==t.isHandUp&&"isHandUp"in t&&this.emitter.emit(r.ME_CHANGE,{event:o.HANDUPCHANGE,body:{newVal:e.isHandUp,oldVal:t.isHandUp}})),e.video&&(l=e.video,d=l.deviceOn,m=l.sendOn,p=l.opBy,(!E(d)&&d!==(null===(O=t.video)||void 0===O?void 0:O.deviceOn)||!E(m)&&m!==(null===(I=t.video)||void 0===I?void 0:I.sendOn))&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:{deviceOn:E(d)?null===(C=this.mtgData.me.video)||void 0===C?void 0:C.deviceOn:d,sendOn:E(m)?null===(y=this.mtgData.me.video)||void 0===y?void 0:y.sendOn:m,opBy:p},oldVal:{deviceOn:null===(N=t.video)||void 0===N?void 0:N.deviceOn,sendOn:null===(T=t.video)||void 0===T?void 0:T.sendOn}}}))),e.share&&(c=e.share,d=c.deviceOn,m=c.sendOn,p=c.opBy,(!E(d)&&d!==(null===(A=t.share)||void 0===A?void 0:A.deviceOn)||!E(m)&&m!==(null===(U=t.share)||void 0===U?void 0:U.sendOn))&&(D(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.SHARECHANGE,body:{newVal:{deviceOn:E(d)?null===(H=this.mtgData.me.share)||void 0===H?void 0:H.deviceOn:d,sendOn:E(m)?null===(L=this.mtgData.me.share)||void 0===L?void 0:L.sendOn:m,opBy:p},oldVal:{deviceOn:null===(R=t.share)||void 0===R?void 0:R.deviceOn,sendOn:null===(w=t.share)||void 0===w?void 0:w.sendOn}}}))),"isSpotlightVideo"in e&&(e.isSpotlightVideo?(this.mtgData.me.isSpotlightVideo=!0,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!0,oldVal:null}})):(this.mtgData.me.isSpotlightVideo=!1,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!1,oldVal:!0}}))),!("isInLobby"in e)||E(t.isInLobby)?[3,5]:t.isInLobby===e.isInLobby?[3,5]:(this.mtgData.me.isInLobby=e.isInLobby,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()]);case 4:n.sent(),D(e,this.mtgData.me),!1===e.isInLobby&&(this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE)),this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:e.isInLobby,oldVal:!e.isInLobby}}),n.label=5;case 5:"isLeave"in e&&(this.stopKeepalive(),this.stopPolling(),this.clean(),this.connectionState=a.CLOSED,this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:e.resultInfo}),this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),e={}),delete e.reSub,delete e.resultInfo,D(e,this.mtgData.me),n.label=6;case 6:return[2]}}))}))},d=function(t){var n=e.find((function(e){return e.name===t}));if(n){if(n.seqId=l[t].maxSeqId,!l[t].items)return;l[t].items.forEach((function(e){var t=JSON.parse(e.content),n=t.event,i=t.state,a=t.body;if("full"===i)m.mtgData[n]=a;else if("update"===i)if(m.mtgData[n]||(m.mtgData[n]=a),n.indexOf("Users")>-1)a.users&&a.users.forEach((function(e){var t=m.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));-1===t?m.mtgData[n].users.push(e):D(e,m.mtgData[n].users[t]),e.userID===m.mtgData.me.userID&&m.mtgData.me.role!==s.AUDIENCE&&c(e)}));else if("me"===n)a.users&&a.users.forEach((function(e){"userID"in e||(e.userID=m.mtgData.me.userID),c(e)}));else if("spotlightVideo"===n){(a.userIDs&&a.userIDs.findIndex((function(e){return e===m.mtgData.me.userID})))>-1?c({userID:m.mtgData.me.userID,isSpotlightVideo:!0}):m.mtgData.me.isSpotlightVideo&&c({userID:m.mtgData.me.userID,isSpotlightVideo:!1})}else"meetingState"===n&&"ended"===a.state?c({userID:m.mtgData.me.userID,resultInfo:a.resultInfo,isLeave:!0}):n.indexOf("Layout")>-1?m.mtgData[n]=a:D(a,m.mtgData[n]);else"delete"===i?n.indexOf("Users")>-1?a.users&&a.users.forEach((function(e){if(m.mtgData[n]){var t=m.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));if(t>-1&&m.mtgData[n].users.splice(t,1),e.userID===m.mtgData.me.userID){var i=Object.keys(e).length;e.role?c(e):e.resultInfo&&2===i&&(e.isLeave=!0,c(e))}}})):"me"===n&&c({userID:m.mtgData.me.userID,isLeave:!0,resultInfo:a.users&&a.users[0]&&a.users[0].resultInfo}):("meetingBarrage"===n&&m.handleBarrage(a),"setUserAudio"===n?m.emitter.emit(r.ME_CHANGE,{event:o.SETAUDIO,body:a}):"setUserVideo"===n?m.emitter.emit(r.ME_CHANGE,{event:o.SETVIDEO,body:a}):m.mtgData[n]?D(a,m.mtgData[n]):m.mtgData[n]=a);m.emitter.emit(r.MEETING_CHANGE,{event:n,body:JSON.parse(JSON.stringify(a)),state:i,stime:null})}))}},Object.keys(l).forEach(d),this.pollingStatus.attempts=0,[2]):[2]}}))}))},this.pollingStatus.timer&&(clearTimeout(this.pollingStatus.timer),this.pollingStatus.timer=null),5!==this.pollingStatus.errorTimes?[3,2]:(this.stopKeepalive(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"polling.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"polling",data:this.pollingStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return c.sent(),[2];case 2:return[4,i()];case 3:return c.sent(),this.pollingStatus.running?(u=this.pollingStatus.attempts?200*this.pollingStatus.attempts:0,this.pollingStatus.timer=setTimeout((function(){l.pollingStatus.running&&l.polling(e)}),u),[2]):[2]}}))}))},l.prototype.keepalive=function(){return t(this,void 0,void 0,(function(){var e,i=this;return n(this,(function(s){switch(s.label){case 0:return e=function(){return t(i,void 0,void 0,(function(){var e,t,i,s=this;return n(this,(function(n){switch(n.label){case 0:return this.keepaliveStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.keepalive({userID:this.mtgData.me.userID||-1}).catch((function(e){s.keepaliveStatus.attempts++,s.keepaliveStatus.errorTimes++,s.keepaliveStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(e=n.sent())&&e.data?(t=e.data,(i=(void 0===t?{}:t).interval||"")?(this.keepaliveStatus.interval=i,this.keepaliveStatus.attempts=0,[2]):(this.keepaliveStatus.attempts++,[2])):(this.keepaliveStatus.attempts++,[2])}}))}))},this.keepaliveStatus.timer&&(clearTimeout(this.keepaliveStatus.timer),this.keepaliveStatus.timer=null),5!==this.keepaliveStatus.errorTimes?[3,2]:(this.stopPolling(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"keepalive.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"polling",data:this.keepaliveStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return s.sent(),[2];case 2:return[4,e()];case 3:return s.sent(),this.keepaliveStatus.running?(this.keepaliveStatus.timer=setTimeout((function(){i.keepaliveStatus.running&&i.keepalive()}),1e3*(this.keepaliveStatus.interval||0)),[2]):[2]}}))}))},l.prototype.getTopics=function(e){var t=[];switch(e.endpointType){case i.WEBCTRL:t=["meeting","interactive","broadcast","lobby","hostAttendee","audience","advCtrl"];break;case i.WEBAPP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive","chat","audience"]:["meeting","interactive","broadcast","lobby","chat","hostAttendee"];break;case i.WECHATMP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive"]:["meeting","interactive","broadcast","lobby"];break;case i.SUPERVISION:t=["meeting","interactive","broadcast"]}return t},l}(),y=function(){return C.instance};return function(){function e(e){!function(e){C.createInstance(e)}(e)}return Object.defineProperty(e.prototype,"ctrl",{get:function(){return y().ctrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return y().mtgData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){return y().connectionState},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return y().emitter.on(e,t)},e.prototype.off=function(e,t){return y().emitter.off(e,t)},e.prototype.getBaseURL=function(){return y().ctrl.baseURL},e.prototype.setBaseURL=function(e){y().ctrl.setBaseURL(e)},e.prototype.getJobStatus=function(){return{polling:y().pollingStatus,keepalive:y().keepaliveStatus}},e.prototype.join=function(e){return t(this,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return(t=y()).ctrl.setSessionID((i=e.endpointType,s=e.meetingNum,""+(null==i?void 0:i.toLocaleUpperCase())+b+"_"+S(new Date,"MMddHHmmss")+"_"+s)),[4,t.join(e)];case 1:return n.sent()?(t.connectionState=a.CONNECTED,t.emitter.emit(r.CONNECTION_STATE,{state:a.CONNECTED,data:t.mtgData.me.mediaContent}),[4,Promise.all([t.startPolling(),t.startKeepalive()])]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}var i,s}))}))},e.prototype.updateUserState=function(e){return t(this,void 0,void 0,(function(){var t,i,a,u,l,c,d;return n(this,(function(n){switch(n.label){case 0:return t=y(),i={audio:{deviceOn:!0,sendOn:!0,recvOn:!1},video:{deviceOn:!0,sendOn:!0,recvOn:!1},share:{deviceOn:!0,sendOn:!1,recvOn:!1}},i=e?D(e,i):i,a=JSON.parse(JSON.stringify(i)),D(a,y().mtgData.me),u=t.mtgData.me,l=u.role,c=u.initialMediaState,d=void 0===c?{audio:{sendOn:!0},video:{sendOn:!0}}:c,i.audio.sendOn=i.audio.sendOn&&d.audio.sendOn,i.video.sendOn=i.video.sendOn&&d.video.sendOn,l===s.AUDIENCE&&(i.audio.sendOn=!1,i.video.sendOn=!1),t.mtgData.me.isUpdatedUserState=!0,[4,t.ctrl.updateUserState(i)];case 1:return n.sent(),l===s.AUDIENCE&&(D(i,y().mtgData.me),!1!==a.audio.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:i.audio,oldVal:a.audio}}),!1!==a.video.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:i.video,oldVal:a.video}})),[2]}}))}))},e.prototype.leave=function(e){return t(this,void 0,void 0,(function(){var t,i;return n(this,(function(n){switch(n.label){case 0:return t=y(),e||(e={bizCode:901359}),[4,t.ctrl.leave({resultInfo:e})];case 1:return i=n.sent().error,[4,Promise.all([t.stopPolling(),t.stopKeepalive()])];case 2:return n.sent(),t.clean(),t.connectionState=a.CLOSED,i?(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"leave",data:i}}),[2,!1]):(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.prototype.end=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,(e=y()).ctrl.end()];case 1:return t=n.sent().error,[4,Promise.all([e.stopPolling(),e.stopKeepalive()])];case 2:return n.sent(),e.clean(),e.connectionState=a.CLOSED,t?(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"end",data:t}}),[2,!1]):(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.ENDPOINT_TYPE=i,e.EVENT=r,e.CONNECTION_STATE=a,e.ROLE=s,e.ME_CHANGE=o,e.MEETING_CHANGE=u,e}()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Meeting=t()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function t(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{u(i.next(e))}catch(e){r(e)}}function o(e){try{u(i.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}u((i=i.apply(e,t||[])).next())}))}function n(e,t){var n,i,s,r,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(r){return function(o){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){a.label=r[1];break}if(6===r[0]&&a.label<s[1]){a.label=s[1],s=r;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(r);break}s[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,o])}}}var i,s,r,a,o,u,l,c=function(){function e(e){this.defaultHeaders={},this.baseURL=e.baseURL,this.beforeRequest=e.beforeRequest}return e.prototype.setDefaultHeader=function(e,t){e in this.defaultHeaders&&(""===t||null===t)?delete this.defaultHeaders[e]:this.defaultHeaders[e]=t},e.prototype.request=function(e){var t=e.url,n=void 0===t?"":t,i=e.timeout,s=void 0===i?6e4:i,r=e.headers,a=void 0===r?{}:r;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+v(n.replace(/^\/+/,""),e.params),a=Object.assign(a,this.defaultHeaders),Object.keys(a).forEach((function(e){"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(a["Content-Type"]=a[e],delete a[e])})),g(e.data)&&(a&&!a["Content-Type"]&&(a["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=a,e.timeout=s,this.beforeRequest&&this.beforeRequest(e),"undefined"!=typeof wx?m(e):d(e)},e.prototype.get=function(e,t){return this.request(Object.assign(t||{},{url:e,method:"GET"}))},e.prototype.post=function(e,t,n){return this.request(Object.assign(n||{},{url:e,method:"POST",data:t}))},e}(),d=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=new XMLHttpRequest;c.open(o.toUpperCase(),r,!0),c.timeout=e.timeout;var d="",m=function(){if(c){if(c.status>=200&&c.status<300)try{t(JSON.parse(c.responseText))}catch(e){n(new Error("E_JSON_PARSE"+c.responseText))}else n(new Error("Request failed with status code "+c.status));c=null}};"onloadend"in c?c.onloadend=m:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(m)},c.onabort=function(){c&&(n(new Error("Request aborted "+d)),c=null)},c.onerror=function(){n(new Error("Network Error")),c=null},c.ontimeout=function(){n(new Error("timeout of "+e.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(u).forEach((function(e){null===s&&"content-type"===e.toLowerCase()?delete u[e]:c.setRequestHeader(e,u[e])})),l&&l.promise.then((function(e){c&&(d=e,c.abort(),n(e),c=null)})),c.send(s)}))},m=function(e){return new Promise((function(t,n){var i=e.data,s=void 0===i?null:i,r=e.url,a=e.method,o=void 0===a?"GET":a,u=e.headers,l=e.cancelToken,c=wx.request({url:r,data:s,method:o.toUpperCase(),timeout:e.timeout,header:u,success:function(e){e.statusCode>=200&&e.statusCode<300?t(e.data):n(new Error("Request failed with status code "+e.statusCode))},fail:function(e){"request:fail abort"===e.errMsg&&l?n(l.reason):n(e)}});l&&l.promise.then((function(){c&&c.abort()}))}))},p=function(){function e(e){var t,n=this;this.promise=new Promise((function(e){t=e})),e((function(e){n.reason||(n.reason=e,t(n.reason))}))}return e.source=function(){var t,n=new e((function(e){t=e}));return{cancel:t,token:n}},e}(),h=Object.prototype.toString,g=function(e){if("[object Object]"!==h.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},f=function(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")},v=function(e,t){if(!t)return e;var n=[];Object.keys(t).forEach((function(e){var i,s=t[e];null!=s&&(Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((function(t){null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),n.push(f(e)+"="+f(t))})))}));var i=n.join("&");if(i){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e},E=function(){for(var e=[],t="0123456789abcdef",n=0;n<36;n++)e[n]=t.substr(Math.floor(16*Math.random()),1);return e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("").split("-").join("")},b=function(e){return null==e},S=E(),D=function(e,t){void 0===e&&(e=new Date);var n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("00"+n[i]).substr((""+n[i]).length)));return t},O=function(e,t){return e?(Object.entries(e).forEach((function(e){var n,i=[e[0],e[1]],s=i[0],r=i[1];if(null!==r)return"object"==typeof(n=r)&&null!==n?(t[s]||(t[s]={}),void(t[s]=O(r,t[s]))):void(t[s]=r)})),t):t},y=function(e){var t="/meeting-ctrl/api/v1",n=new c({baseURL:e,beforeRequest:function(e){e.headers["X-Y-Request-Id"]=E()}}),i=p.source(),s="",r="",a="",o="",u="",l="";return{cancelToken:function(e){i.cancel(e),i=p.source()},developerToken:function(e){return n.post("/developer-manager/api/v1/token",{grant_type:"client_credentials"},{headers:{"x-yl-terminal-type":"web","x-yl-terminal-version":e.version,Authorization:e.Authorization,timestamp:e.timestamp,nonce:e.nonce}})},credential:function(e){return n.get(t+"/credential",{params:e})},join:function(e){return n.post(t+"/join?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":a}})},updateUserState:function(e){return n.post(t+"/meetings/"+o+"/updateUserState",e)},inbox:function(e){return n.post("/ypush/api/v1/meeting-control/inbox",e)},polling:function(e){return n.post("/ypush/api/v1/meeting-control/polling",e,{cancelToken:i.token})},subscribe:function(e){return n.post(t+"/meetings/"+o+"/subscribe",e)},keepalive:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/keepalive",{},{cancelToken:i.token})},leave:function(e){return n.post(t+"/meetings/"+o+"/leave",e)},end:function(){return n.post(t+"/meetings/"+o+"/end")},audio:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/audio",e)},video:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/video",e)},share:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/share",e)},handUp:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/handUp",e)},replyHandUp:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/replyHandUp",e)},shareInfo:function(e){return n.get(t+"/meetings/"+o+"/shareInfo",{params:e})},trying:function(e){return n.post(t+"/trying?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":a}})},rejectCall:function(e){return n.post(t+"/rejectCall?meetingNum="+e.meetingNum+"&credential="+e.credential,e,{headers:{token:e.token,"X-Y-Endpoint-Type":e.endpointType,"X-Y-Endpoint-Id":a}})},pauseAudio:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/pauseAudio")},resumeAudio:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/resumeAudio")},lobbyState:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/lobbyState",e)},displayName:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/displayName",e)},callStats:function(e){return n.get(t+"/meetings/"+o+"/users/"+e.userID+"/callStats")},user:function(e){return n.get(t+"/meetings/"+o+"/users/"+e.userID)},blockVideo:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/blockVideo")},unblockVideo:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/unblockVideo")},role:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/role",e)},remove:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/remove",e)},dtmf:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/dtmf",e)},fecc:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/fecc",e)},hostLayout:function(e){return n.post(t+"/meetings/"+o+"/view/hostLayout",e)},attendeeLayout:function(e){return n.post(t+"/meetings/"+o+"/view/attendeeLayout",e)},audienceLayout:function(e){return n.post(t+"/meetings/"+o+"/view/audienceLayout",e)},personalLayout:function(e){return n.post(t+"/meetings/"+o+"/view/personalLayout",e)},personalLayoutDelete:function(e){return n.post(t+"/meetings/"+o+"/view/personalLayout/delete",e)},virtualClassLayout:function(e){return n.post(t+"/meetings/"+o+"/view/virtualClass/layout",e)},virtualClassClose:function(){return n.post(t+"/meetings/"+o+"/view/virtualClass/close")},spotlight:function(e){return n.post(t+"/meetings/"+o+"/view/spotlight",e)},lobbyRefuseAll:function(){return n.post(t+"/meetings/"+o+"/lobby/refuseAll")},lobbyAdmitAll:function(){return n.post(t+"/meetings/"+o+"/lobby/admitAll")},barrage:function(e){return n.post(t+"/meetings/"+o+"/barrage",e)},deleteBarrage:function(){return n.post(t+"/meetings/"+o+"/deleteBarrage")},operationRecord:function(e){return n.post(t+"/meetings/"+o+"/operationRecord",e)},practiceSession:function(){return n.post(t+"/meetings/"+o+"/info/practiceSession")},replyAllHandUp:function(){return n.post(t+"/meetings/"+o+"/replyAllHandUp")},unmuteAll:function(){return n.post(t+"/meetings/"+o+"/unmuteAll")},muteAll:function(){return n.post(t+"/meetings/"+o+"/muteAll")},audioDump:function(){return n.post(t+"/meetings/"+o+"/audioDump")},endMeeting:function(e){return n.post(t+"/meetingNum/"+e.meetingNum+"/end")},msg:function(e){return n.post(t+"/meetings/"+o+"/chat/msg",e)},historyMsg:function(e){return n.post(t+"/meetings/"+o+"/chat/historyMsg",e)},callStatsReport:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/callStats/report",e)},remoteDesktop:function(e){return n.post(t+"/meetings/"+o+"/users/"+e.userID+"/remoteDesktop",{action:e.action})},meetings:function(e){return n.get(t+"/meetings",{params:e})},mailTemplate:function(e){return n.get(t+"/mailTemplate",{params:{meetingID:o},headers:{language:e.language}})},get baseURL(){return n.baseURL},setBaseURL:function(e){n.baseURL=e},get accessToken(){return s},setAccessToken:function(e){void 0===e&&(e=""),s=e,n.setDefaultHeader("x-yl-access-token",s),n.setDefaultHeader("x-yl-terminal-type","web")},get version(){return s},setVersion:function(e){void 0===e&&(e=""),r=e,n.setDefaultHeader("x-yl-terminal-version",r)},get sessionID(){return a},setSessionID:function(e){void 0===e&&(e=""),a=e,n.setDefaultHeader("X-Y-Session-Id",a)},get meetingID(){return o},setMeetingID:function(e){void 0===e&&(e=""),o=e},get location(){return l},setLocation:function(e){void 0===e&&(e=""),l=e,n.setDefaultHeader("X-Y-Location",l)},get ctrlID(){return u},setCtrlID:function(e){void 0===e&&(e=""),u=e,n.setDefaultHeader("X-Y-Ctrl-Id",u)}}},C=function(){function e(){this.events=new Map}return e.prototype.emit=function(e,t){var n=this.events.get(e);n&&n.slice().map((function(e){e(t)}))},e.prototype.off=function(e,t){var n=this.events.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):this.events.set(e,[]))},e.prototype.on=function(e,t){var n=this.events.get(e);n?n.push(t):this.events.set(e,[t])},e}();!function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision"}(i||(i={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(s||(s={})),function(e){e.CONNECTION_STATE="CONNECTION_STATE",e.MEETING_CHANGE="MEETING_CHANGE",e.ME_CHANGE="ME_CHANGE",e.UPDATE_USER_STATE="UPDATE_USER_STATE"}(r||(r={})),function(e){e.CONNECTED="connected",e.SUBSCRIBED="subscribed",e.CLOSED="closed"}(a||(a={})),function(e){e.ROLECHANGE="roleChange",e.AUDIOCHANGE="audioChange",e.HANDUPCHANGE="handupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="videoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="shareChange",e.DISPLAYNAMECHANGE="displayNameChange",e.SPOTLIGHTVIDEOCHANGE="spotlightVideoChange",e.LOBBYCHANGE="lobbyChange",e.BARRAGECHANGE="barrageChange",e.LEAVE="leave"}(o||(o={})),function(e){e.MEETINGINFO="meetingInfo",e.MEETINGSTATE="meetingState",e.MEETINGSETTING="meetingSetting",e.MEETINGVIEW="meetingView",e.MEETINGBARRAGE="meetingBarrage",e.RECORDING="recording",e.LIVESTREAM="liveStream",e.INTERACTIVEUSERS="interactiveUsers",e.BROADCASTUSERS="broadcastUsers",e.LOBBYUSERS="lobbyUsers",e.VIRTUALUSERS="virtualUsers",e.CHATMSG="chatMsg",e.INVITESTATE="inviteState",e.CALLRECORD="callRecord",e.ME="me"}(u||(u={})),function(e){e.STARTED="started",e.PAUSED="paused",e.STARTING="starting",e.STOPPED="stopped"}(l||(l={}));var I=function(){function l(e){this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}},this.pollingStatus={attempts:0,errorTimes:0,errors:[]},this.keepaliveStatus={attempts:0,errorTimes:0,errors:[]},this.connectionState=a.CLOSED,this.isClosedStateEmited=!1,this.barrageTimer=null,this.ctrl=y(e.baseURL),this.emitter=new C}return l.createInstance=function(e){return null===this.instance||void 0===this.instance?this.instance=new l(e):(this.instance.emitter&&(this.instance.emitter=new C),this.instance.ctrl&&(this.instance.ctrl=y(e.baseURL))),l.instance},l.prototype.join=function(i){return t(this,void 0,void 0,(function(){var t,s,a,u,l,c,d,m,p,h,g,f,v,E=this;return n(this,(function(n){switch(n.label){case 0:return this.isClosedStateEmited=!1,[4,this.ctrl.credential({meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName}).catch((function(e){E.emitClosedState({cause:"credential",data:e.message})}))];case 1:return(t=n.sent())&&t.data&&t.data.credential?(this.ctrl.setLocation(t.data.location),delete i.pwd,delete i.url,[4,this.ctrl.join(e(e({},i),{credential:t.data.credential})).catch((function(e){E.emitClosedState({cause:"join",data:e.message})}))]):[3,3];case 2:return(s=n.sent())&&s.data&&s.ret>-1?(a=s.data,u=a.meetingID,l=void 0===u?"":u,c=a.ctrlID,d=void 0===c?"":c,m=a.user,p=void 0===m?{}:m,h=a.mediaContent,g=void 0===h?{}:h,f=a.initialMediaState,v=void 0===f?{}:f,this.ctrl.setMeetingID(l),this.ctrl.setCtrlID(d),this.mtgData.me=e(e({},p),{mediaContent:g,initialMediaState:v}),this.mtgData.me.isInLobby?this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:!0,oldVal:null}}):this.emitter.emit(r.UPDATE_USER_STATE),[2,!0]):(this.emitClosedState({cause:"join",data:s}),[2,!1]);case 3:return this.emitClosedState({cause:"credential",data:t}),[2,!1];case 4:return[2]}}))}))},l.prototype.startPolling=function(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this.pollingStatus.attempts=0,this.pollingStatus.errorTimes=0,this.pollingStatus.errors=[],[4,this.inbox()];case 1:return e=t.sent(),[4,this.subscribe()];case 2:return t.sent()&&(this.pollingStatus.running=!0,this.polling(e)),[2]}}))}))},l.prototype.stopPolling=function(){this.pollingStatus.running=!1,this.pollingStatus.timer&&clearTimeout(this.pollingStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.startKeepalive=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this.keepaliveStatus.attempts=0,this.keepaliveStatus.errorTimes=0,this.keepaliveStatus.errors=[],this.keepaliveStatus.running=!0,this.keepalive(),[2]}))}))},l.prototype.stopKeepalive=function(){this.keepaliveStatus.running=!1,this.keepaliveStatus.timer&&clearTimeout(this.keepaliveStatus.timer),this.ctrl.cancelToken("cancel")},l.prototype.clean=function(){this.ctrl.setCtrlID(""),this.ctrl.setLocation(""),this.ctrl.setMeetingID(""),this.ctrl.setSessionID(""),this.mtgData={me:{isHandUp:!1,isUpdatedUserState:!1}}},l.prototype.handleBarrage=function(e,t){var n=this;if(void 0===t&&(t=!1),!e){var i=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));delete this.mtgData.me.barrage,((a={newVal:null,oldVal:"{}"===JSON.stringify(i)?null:i}).newVal||a.oldVal)&&this.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:a}),this.barrageTimer&&clearTimeout(this.barrageTimer),this.barrageTimer=null}if(e||t){i=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));var a,u=this.mtgData.me.role,l=void 0===u?"":u,c=this.mtgData.meetingBarrage;e||(e=c),l===s.COHOST&&(l=s.HOST),e&&e.receiver[l]?this.mtgData.me.barrage={position:e.position,contentType:e.contentType,content:e.content}:delete this.mtgData.me.barrage,((a={newVal:this.mtgData.me.barrage||null,oldVal:"{}"===JSON.stringify(i)?null:i}).newVal||a.oldVal)&&this.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:a})}if(e&&this.barrageTimer&&(clearTimeout(this.barrageTimer),this.barrageTimer=null),e&&-1!==e.duration){var d=JSON.parse(JSON.stringify(this.mtgData.me.barrage||{}));this.barrageTimer=setTimeout((function(){delete n.mtgData.me.barrage,n.emitter.emit(r.ME_CHANGE,{event:o.BARRAGECHANGE,body:{newVal:null,oldVal:"{}"===JSON.stringify(d)?null:d}})}),1e3*e.duration)}},l.prototype.emitClosedState=function(e){this.isClosedStateEmited||(this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:e}),this.isClosedStateEmited=!0,this.clean())},l.prototype.subscribe=function(){return t(this,void 0,void 0,(function(){var e,t,i=this;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.subscribe({topics:e}).catch((function(e){i.emitClosedState({cause:"subscribe",data:e.message})}))];case 1:return(t=n.sent())&&t.data?(t.data.eventMsgs.forEach((function(e){i.mtgData[e.event]=e.body,e.event.indexOf("Users")>-1&&e.body.users.forEach((function(e){if(e.userID===i.mtgData.me.userID){var t=Object.assign({},e);delete t.audio,delete t.video,delete t.share,O(t,i.mtgData.me)}})),e.event===u.MEETINGBARRAGE&&i.handleBarrage(e.body)})),this.mtgData.me.reSub?delete this.mtgData.me.reSub:(this.connectionState=a.SUBSCRIBED,this.emitter.emit(r.CONNECTION_STATE,{state:a.SUBSCRIBED})),[2,!0]):(this.emitClosedState({cause:"subscribe",data:t}),[2,!1])}}))}))},l.prototype.inbox=function(){return t(this,void 0,void 0,(function(){var e,t,i;return n(this,(function(n){switch(n.label){case 0:return e=this.getTopics(this.mtgData.me),[4,this.ctrl.inbox({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e})];case 1:return(t=n.sent())?(i=[],t.data&&Object.keys(t.data).forEach((function(e){i.push({name:e,seqId:t.data[e].maxSeqId,limit:200})})),[2,i]):[2,[]]}}))}))},l.prototype.polling=function(e){return t(this,void 0,void 0,(function(){var i,u,l=this;return n(this,(function(c){switch(c.label){case 0:return i=function(){return t(l,void 0,void 0,(function(){var i,u,l,c,d,m,p,h=this;return n(this,(function(g){switch(g.label){case 0:return this.pollingStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.polling({basic:{tenantId:100,clientId:this.ctrl.sessionID,meetingId:this.ctrl.meetingID},inboxes:e}).catch((function(e){h.pollingStatus.attempts++,h.pollingStatus.errorTimes++,h.pollingStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(i=g.sent())?(u=i.data,l=void 0===u?{}:u,c=i.error,(d=i.bizCode)&&900408!==d?(this.pollingStatus.errorTimes++,this.pollingStatus.errors.push({bizCode:d,msg:c&&c.msg,time:(new Date).valueOf()}),[2]):l?(m=function(e){return t(h,void 0,void 0,(function(){var t,i,u,l,c,d,m,p,h,g,f,v,E,S,D,y,C,I,T,N,A,H,U,w,L,R;return n(this,(function(n){switch(n.label){case 0:return e.userID!==this.mtgData.me.userID?[3,6]:(t=JSON.parse(JSON.stringify(this.mtgData.me)),e.role&&e.role!==t.role?(i=t.role,e.role!==s.AUDIENCE&&t.role!==s.AUDIENCE?[3,2]:(this.mtgData.me.role=e.role,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()])):[3,3]);case 1:n.sent(),this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE),n.label=2;case 2:e.role===s.AUDIENCE&&(e.audio={deviceOn:!0,sendOn:!1,recvOn:!1},e.video={deviceOn:!0,sendOn:!1,recvOn:!1},e.share={deviceOn:!0,sendOn:!1,recvOn:!1}),O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.ROLECHANGE,body:{newVal:e.role,oldVal:i}}),this.handleBarrage(null,!0),n.label=3;case 3:return e.displayName&&e.displayName!==t.displayName&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.DISPLAYNAMECHANGE,body:{newVal:e.displayName,oldVal:t.displayName}})),e.audio&&(u=e.audio,d=u.deviceOn,m=u.sendOn,p=u.opBy,(!b(d)&&d!==(null===(h=t.audio)||void 0===h?void 0:h.deviceOn)||!b(m)&&m!==(null===(g=t.audio)||void 0===g?void 0:g.sendOn))&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:{deviceOn:b(d)?null===(f=this.mtgData.me.audio)||void 0===f?void 0:f.deviceOn:d,sendOn:b(m)?null===(v=this.mtgData.me.audio)||void 0===v?void 0:v.sendOn:m,opBy:p},oldVal:{deviceOn:null===(E=t.audio)||void 0===E?void 0:E.deviceOn,sendOn:null===(S=t.audio)||void 0===S?void 0:S.sendOn}}}))),"isHandUp"in e&&(O(e,this.mtgData.me),e.isHandUp!==t.isHandUp&&"isHandUp"in t&&this.emitter.emit(r.ME_CHANGE,{event:o.HANDUPCHANGE,body:{newVal:e.isHandUp,oldVal:t.isHandUp}})),e.video&&(l=e.video,d=l.deviceOn,m=l.sendOn,p=l.opBy,(!b(d)&&d!==(null===(D=t.video)||void 0===D?void 0:D.deviceOn)||!b(m)&&m!==(null===(y=t.video)||void 0===y?void 0:y.sendOn))&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:{deviceOn:b(d)?null===(C=this.mtgData.me.video)||void 0===C?void 0:C.deviceOn:d,sendOn:b(m)?null===(I=this.mtgData.me.video)||void 0===I?void 0:I.sendOn:m,opBy:p},oldVal:{deviceOn:null===(T=t.video)||void 0===T?void 0:T.deviceOn,sendOn:null===(N=t.video)||void 0===N?void 0:N.sendOn}}}))),e.share&&(c=e.share,d=c.deviceOn,m=c.sendOn,p=c.opBy,(!b(d)&&d!==(null===(A=t.share)||void 0===A?void 0:A.deviceOn)||!b(m)&&m!==(null===(H=t.share)||void 0===H?void 0:H.sendOn))&&(O(e,this.mtgData.me),this.emitter.emit(r.ME_CHANGE,{event:o.SHARECHANGE,body:{newVal:{deviceOn:b(d)?null===(U=this.mtgData.me.share)||void 0===U?void 0:U.deviceOn:d,sendOn:b(m)?null===(w=this.mtgData.me.share)||void 0===w?void 0:w.sendOn:m,opBy:p},oldVal:{deviceOn:null===(L=t.share)||void 0===L?void 0:L.deviceOn,sendOn:null===(R=t.share)||void 0===R?void 0:R.sendOn}}}))),"isSpotlightVideo"in e&&(e.isSpotlightVideo?(this.mtgData.me.isSpotlightVideo=!0,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!0,oldVal:null}})):(this.mtgData.me.isSpotlightVideo=!1,this.emitter.emit(r.ME_CHANGE,{event:o.SPOTLIGHTVIDEOCHANGE,body:{newVal:!1,oldVal:!0}}))),!("isInLobby"in e)||b(t.isInLobby)?[3,5]:t.isInLobby===e.isInLobby?[3,5]:(this.mtgData.me.isInLobby=e.isInLobby,this.mtgData.me.reSub=!0,this.stopPolling(),[4,this.startPolling()]);case 4:n.sent(),O(e,this.mtgData.me),!1===e.isInLobby&&(this.mtgData.me.isUpdatedUserState=!1,this.emitter.emit(r.UPDATE_USER_STATE)),this.emitter.emit(r.ME_CHANGE,{event:o.LOBBYCHANGE,body:{newVal:e.isInLobby,oldVal:!e.isInLobby}}),n.label=5;case 5:"isLeave"in e&&(this.stopKeepalive(),this.stopPolling(),this.clean(),this.connectionState=a.CLOSED,this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:e.resultInfo}),this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),e={}),delete e.reSub,delete e.resultInfo,O(e,this.mtgData.me),n.label=6;case 6:return[2]}}))}))},p=function(t){var n=e.find((function(e){return e.name===t}));if(n){if(n.seqId=l[t].maxSeqId,!l[t].items)return;l[t].items.forEach((function(e){var t=JSON.parse(e.content),n=t.event,i=t.state,a=t.body;if("full"===i)h.mtgData[n]=a,"meetingBarrage"===n&&h.handleBarrage(a);else if("update"===i)if(h.mtgData[n]||(h.mtgData[n]=a),n.indexOf("Users")>-1)a.users&&a.users.forEach((function(e){var t=h.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));-1===t?h.mtgData[n].users.push(e):O(e,h.mtgData[n].users[t]),e.userID===h.mtgData.me.userID&&h.mtgData.me.role!==s.AUDIENCE&&m(e)}));else if("me"===n)a.users&&a.users.forEach((function(e){"userID"in e||(e.userID=h.mtgData.me.userID),m(e)}));else if("spotlightVideo"===n){(a.userIDs&&a.userIDs.findIndex((function(e){return e===h.mtgData.me.userID})))>-1?m({userID:h.mtgData.me.userID,isSpotlightVideo:!0}):h.mtgData.me.isSpotlightVideo&&m({userID:h.mtgData.me.userID,isSpotlightVideo:!1})}else"meetingState"===n&&"ended"===a.state?m({userID:h.mtgData.me.userID,resultInfo:a.resultInfo,isLeave:!0}):n.indexOf("Layout")>-1?h.mtgData[n]=a:O(a,h.mtgData[n]);else"delete"===i?(n.indexOf("Users")>-1?a.users&&a.users.forEach((function(e){if(h.mtgData[n]){var t=h.mtgData[n].users.findIndex((function(t){return t.userID===e.userID}));if(t>-1&&h.mtgData[n].users.splice(t,1),e.userID===h.mtgData.me.userID){var i=Object.keys(e).length;e.role?m(e):e.resultInfo&&2===i&&(e.isLeave=!0,m(e))}}})):"me"===n&&m({userID:h.mtgData.me.userID,isLeave:!0,resultInfo:a.users&&a.users[0]&&a.users[0].resultInfo}),"meetingBarrage"===n&&(h.mtgData[n]=a,h.handleBarrage(a))):("meetingBarrage"===n&&(O(a,h.mtgData[n]),h.handleBarrage(a)),"setUserAudio"===n?h.emitter.emit(r.ME_CHANGE,{event:o.SETAUDIO,body:a}):"setUserVideo"===n?h.emitter.emit(r.ME_CHANGE,{event:o.SETVIDEO,body:a}):h.mtgData[n]?O(a,h.mtgData[n]):h.mtgData[n]=a);h.emitter.emit(r.MEETING_CHANGE,{event:n,body:JSON.parse(JSON.stringify(a)),state:i,stime:null})}))}},Object.keys(l).forEach(p),this.pollingStatus.attempts=0,[2]):[2]):(this.pollingStatus.errorTimes++,this.pollingStatus.errors.push({msg:"error response",time:(new Date).valueOf()}),[2])}}))}))},this.pollingStatus.timer&&(clearTimeout(this.pollingStatus.timer),this.pollingStatus.timer=null),5!==this.pollingStatus.errorTimes?[3,2]:(this.stopKeepalive(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"polling.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"polling",data:this.pollingStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return c.sent(),[2];case 2:return[4,i()];case 3:return c.sent(),this.pollingStatus.running?(u=this.pollingStatus.attempts?200*this.pollingStatus.attempts:0,this.pollingStatus.timer=setTimeout((function(){l.pollingStatus.running&&l.polling(e)}),u),[2]):[2]}}))}))},l.prototype.keepalive=function(){return t(this,void 0,void 0,(function(){var e,i=this;return n(this,(function(s){switch(s.label){case 0:return e=function(){return t(i,void 0,void 0,(function(){var e,t,i,s,r,a=this;return n(this,(function(n){switch(n.label){case 0:return this.keepaliveStatus.lastReqTime=(new Date).valueOf(),[4,this.ctrl.keepalive({userID:this.mtgData.me.userID||-1}).catch((function(e){a.keepaliveStatus.attempts++,a.keepaliveStatus.errorTimes++,a.keepaliveStatus.errors.push({msg:e.message,time:(new Date).valueOf()})}))];case 1:return(e=n.sent())?(t=e.bizCode,i=e.data,s=e.error,900200!==t&&900408!==t&&901323!==t?(this.keepaliveStatus.errorTimes++,this.keepaliveStatus.errors.push({bizCode:t,msg:s&&s.msg||"error response",time:(new Date).valueOf()}),[2]):i?(r=i.interval||"")?(this.keepaliveStatus.interval=r,this.keepaliveStatus.attempts=0,[2]):(this.keepaliveStatus.attempts++,[2]):[2]):(this.keepaliveStatus.errorTimes++,this.keepaliveStatus.errors.push({msg:"error response",time:(new Date).valueOf()}),[2])}}))}))},this.keepaliveStatus.timer&&(clearTimeout(this.keepaliveStatus.timer),this.keepaliveStatus.timer=null),5!==this.keepaliveStatus.errorTimes?[3,2]:(this.stopPolling(),this.clean(),this.emitter.emit(r.ME_CHANGE,{event:o.LEAVE,body:"keepalive.error"}),this.connectionState=a.CLOSED,this.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"keepalive",data:this.keepaliveStatus.errors}}),[4,this.ctrl.leave({resultInfo:{bizCode:901359}})]);case 1:return s.sent(),[2];case 2:return[4,e()];case 3:return s.sent(),this.keepaliveStatus.running?(this.keepaliveStatus.timer=setTimeout((function(){i.keepaliveStatus.running&&i.keepalive()}),1e3*(this.keepaliveStatus.interval||0)),[2]):[2]}}))}))},l.prototype.getTopics=function(e){var t=[];switch(e.endpointType){case i.WEBCTRL:t=["meeting","interactive","broadcast","lobby","hostAttendee","audience","advCtrl"];break;case i.WEBAPP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive","chat","audience"]:["meeting","interactive","broadcast","lobby","chat","hostAttendee"];break;case i.WECHATMP:t=e.isInLobby?["lobbyMember"]:"audience"===e.role?["meeting","interactive"]:["meeting","interactive","broadcast","lobby"];break;case i.SUPERVISION:t=["meeting","interactive","broadcast"]}return t},l}(),T=function(){return I.instance};return function(){function e(e){!function(e){I.createInstance(e)}(e)}return Object.defineProperty(e.prototype,"ctrl",{get:function(){return T().ctrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return T().mtgData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connectionState",{get:function(){return T().connectionState},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return T().emitter.on(e,t)},e.prototype.off=function(e,t){return T().emitter.off(e,t)},e.prototype.getBaseURL=function(){return T().ctrl.baseURL},e.prototype.setBaseURL=function(e){T().ctrl.setBaseURL(e)},e.prototype.getJobStatus=function(){return{polling:T().pollingStatus,keepalive:T().keepaliveStatus}},e.prototype.join=function(e){return t(this,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return(t=T()).ctrl.setSessionID((i=e.endpointType,s=e.meetingNum,""+(null==i?void 0:i.toLocaleUpperCase())+S+"_"+D(new Date,"MMddHHmmss")+"_"+s)),[4,t.join(e)];case 1:return n.sent()?(t.connectionState=a.CONNECTED,t.emitter.emit(r.CONNECTION_STATE,{state:a.CONNECTED,data:t.mtgData.me.mediaContent}),[4,Promise.all([t.startPolling(),t.startKeepalive()])]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}var i,s}))}))},e.prototype.updateUserState=function(e){return t(this,void 0,void 0,(function(){var t,i,a,u,l,c,d;return n(this,(function(n){switch(n.label){case 0:return t=T(),i={audio:{deviceOn:!0,sendOn:!0,recvOn:!1},video:{deviceOn:!0,sendOn:!0,recvOn:!1},share:{deviceOn:!0,sendOn:!1,recvOn:!1}},i=e?O(e,i):i,a=JSON.parse(JSON.stringify(i)),O(a,T().mtgData.me),u=t.mtgData.me,l=u.role,c=u.initialMediaState,d=void 0===c?{audio:{sendOn:!0},video:{sendOn:!0}}:c,i.audio.sendOn=i.audio.sendOn&&d.audio.sendOn,i.video.sendOn=i.video.sendOn&&d.video.sendOn,l===s.AUDIENCE&&(i.audio.sendOn=!1,i.video.sendOn=!1),t.mtgData.me.isUpdatedUserState=!0,[4,t.ctrl.updateUserState(i)];case 1:return n.sent(),l===s.AUDIENCE&&(O(i,T().mtgData.me),!1!==a.audio.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.AUDIOCHANGE,body:{newVal:i.audio,oldVal:a.audio}}),!1!==a.video.sendOn&&t.emitter.emit(r.ME_CHANGE,{event:o.VIDEOCHANGE,body:{newVal:i.video,oldVal:a.video}})),[2]}}))}))},e.prototype.leave=function(e){return t(this,void 0,void 0,(function(){var t,i;return n(this,(function(n){switch(n.label){case 0:return t=T(),e||(e={bizCode:901359}),[4,t.ctrl.leave({resultInfo:e})];case 1:return i=n.sent().error,[4,Promise.all([t.stopPolling(),t.stopKeepalive()])];case 2:return n.sent(),t.clean(),t.connectionState=a.CLOSED,i?(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"leave",data:i}}),[2,!1]):(t.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.prototype.end=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,(e=T()).ctrl.end()];case 1:return t=n.sent().error,[4,Promise.all([e.stopPolling(),e.stopKeepalive()])];case 2:return n.sent(),e.clean(),e.connectionState=a.CLOSED,t?(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED,reason:{cause:"end",data:t}}),[2,!1]):(e.emitter.emit(r.CONNECTION_STATE,{state:a.CLOSED}),[2,!0])}}))}))},e.ENDPOINT_TYPE=i,e.EVENT=r,e.CONNECTION_STATE=a,e.ROLE=s,e.ME_CHANGE=o,e.MEETING_CHANGE=u,e}()}));
|
package/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ylink-sdk/meeting",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "dist/ylink-sdk-meeting.umd.js",
|
|
5
|
-
"module": "dist/ylink-sdk-meeting.es.js",
|
|
6
|
-
"typings": "dist/index.d.ts",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"author": "ylink",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
15
|
-
},
|
|
16
|
-
"prettier": {
|
|
17
|
-
"trailingComma": "none",
|
|
18
|
-
"printWidth": 100,
|
|
19
|
-
"semi": true,
|
|
20
|
-
"singleQuote": true,
|
|
21
|
-
"useTabs": true
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"dev": "rollup -wc",
|
|
25
|
-
"build": "npm-run-all --silent clean -p bundle -p clean-dts",
|
|
26
|
-
"bundle": "rollup -c",
|
|
27
|
-
"clean": "rimraf dist",
|
|
28
|
-
"clean-dts": "rimraf dist/utils dist/core.d.ts dist/ctrl.d.ts",
|
|
29
|
-
"lint": "eslint src --fix --ext .ts",
|
|
30
|
-
"prepare": "husky install",
|
|
31
|
-
"doc": "gulp typedoc"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@rollup/plugin-commonjs": "^19.0.1",
|
|
35
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
36
|
-
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
37
|
-
"@rollup/plugin-typescript": "^8.2.5",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^4.28.5",
|
|
39
|
-
"@typescript-eslint/parser": "^4.28.5",
|
|
40
|
-
"eslint": "^7.31.0",
|
|
41
|
-
"eslint-config-prettier": "^8.3.0",
|
|
42
|
-
"eslint-plugin-import": "^2.23.4",
|
|
43
|
-
"eslint-plugin-prettier": "^3.4.0",
|
|
44
|
-
"gulp": "^4.0.2",
|
|
45
|
-
"gulp-typedoc": "^3.0.1",
|
|
46
|
-
"husky": "^7.0.0",
|
|
47
|
-
"npm-run-all": "^4.1.5",
|
|
48
|
-
"prettier": "^2.3.2",
|
|
49
|
-
"rimraf": "^3.0.2",
|
|
50
|
-
"rollup": "^2.54.0",
|
|
51
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
52
|
-
"tslib": "^2.3.0",
|
|
53
|
-
"typedoc": "^0.21.4",
|
|
54
|
-
"typedoc-plugin-merge-modules": "^3.0.0",
|
|
55
|
-
"typescript": "^4.3.5"
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {}
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@ylink-sdk/meeting",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"main": "dist/ylink-sdk-meeting.umd.js",
|
|
5
|
+
"module": "dist/ylink-sdk-meeting.es.js",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"author": "ylink",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"prettier": {
|
|
17
|
+
"trailingComma": "none",
|
|
18
|
+
"printWidth": 100,
|
|
19
|
+
"semi": true,
|
|
20
|
+
"singleQuote": true,
|
|
21
|
+
"useTabs": true
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "rollup -wc",
|
|
25
|
+
"build": "npm-run-all --silent clean -p bundle -p clean-dts",
|
|
26
|
+
"bundle": "rollup -c",
|
|
27
|
+
"clean": "rimraf dist",
|
|
28
|
+
"clean-dts": "rimraf dist/utils dist/core.d.ts dist/ctrl.d.ts",
|
|
29
|
+
"lint": "eslint src --fix --ext .ts",
|
|
30
|
+
"prepare": "husky install",
|
|
31
|
+
"doc": "gulp typedoc"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@rollup/plugin-commonjs": "^19.0.1",
|
|
35
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
36
|
+
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
37
|
+
"@rollup/plugin-typescript": "^8.2.5",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^4.28.5",
|
|
39
|
+
"@typescript-eslint/parser": "^4.28.5",
|
|
40
|
+
"eslint": "^7.31.0",
|
|
41
|
+
"eslint-config-prettier": "^8.3.0",
|
|
42
|
+
"eslint-plugin-import": "^2.23.4",
|
|
43
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
44
|
+
"gulp": "^4.0.2",
|
|
45
|
+
"gulp-typedoc": "^3.0.1",
|
|
46
|
+
"husky": "^7.0.0",
|
|
47
|
+
"npm-run-all": "^4.1.5",
|
|
48
|
+
"prettier": "^2.3.2",
|
|
49
|
+
"rimraf": "^3.0.2",
|
|
50
|
+
"rollup": "^2.54.0",
|
|
51
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
52
|
+
"tslib": "^2.3.0",
|
|
53
|
+
"typedoc": "^0.21.4",
|
|
54
|
+
"typedoc-plugin-merge-modules": "^3.0.0",
|
|
55
|
+
"typescript": "^4.3.5"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {}
|
|
58
|
+
}
|