aliyun-rtc-sdk 7.1.9 → 7.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -702,15 +702,6 @@ var grammarExports = grammar$1.exports;
702
702
  };
703
703
  } (parser));
704
704
 
705
- interface ISubDeleteResult {
706
- url: string;
707
- stream?: any;
708
- aStream?: any;
709
- vStream?: any;
710
- aMsid?: string;
711
- vMsid?: string;
712
- }
713
-
714
705
  interface IListenerMap {
715
706
  [s: string]: any;
716
707
  }
@@ -853,34 +844,6 @@ declare class LocalStream extends Stream {
853
844
  protected handleAudioTrackEnded(): void;
854
845
  }
855
846
 
856
- declare class RemoteStream extends Stream {
857
- protected recvCanPlay: boolean;
858
- protected autoplay: boolean;
859
- constructor();
860
- set muted(muted: boolean);
861
- get muted(): boolean;
862
- get audioTrack(): MediaStreamTrack | undefined;
863
- get videoTrack(): MediaStreamTrack | undefined;
864
- get hasVideo(): boolean;
865
- get hasAudio(): boolean;
866
- get mediaStream(): MediaStream | undefined;
867
- updateMediaStream(value: MediaStream): void;
868
- getMediaStream(): MediaStream | undefined;
869
- mergeStream(newStream: MediaStream): void;
870
- play(element: HTMLMediaElement, config?: {
871
- autoplay?: boolean;
872
- }): void;
873
- disableVideo(): void;
874
- enableVideo(): void;
875
- disableAudio(): void;
876
- enableAudio(): void;
877
- stop(): void;
878
- onCanPlay(): void;
879
- protected release(): void;
880
- protected bindMediaStream(mediastream: MediaStream): void;
881
- protected tryToPlay(): void;
882
- }
883
-
884
847
  interface IStreamConfig {
885
848
  audio?: MediaTrackConstraints | boolean;
886
849
  video?: MediaTrackConstraints | boolean;
@@ -938,4428 +901,35 @@ declare global {
938
901
  }
939
902
  }
940
903
 
941
- declare enum AliRtcErrorCode {
942
- /****************************************************
943
- * 入会错误码
944
- ****************************************************/
945
- /** 已经加入频道 */
946
- ERR_JOIN_ALREADY_JOINED = 16843521,
947
- /** AppId不存在,请在控制台创建应用 */
948
- ERR_JOIN_BAD_APPID = 33620481,
949
- /** AppId已失效,请在控制台重新启用应用 */
950
- ERR_JOIN_INVALID_APPID = 33620482,
951
- /**
952
- * 频道不存在,请尝试重新加入频道
953
- * 如会议发起者入会后又很快离会,第二个人随后入会,发现会议已经不存在了。
954
- */
955
- ERR_JOIN_BAD_CHANNEL = 33620484,
956
- /** 频道已经失效(目前频道有效期为48小时),请重新生成频道鉴权令牌(Token) */
957
- ERR_JOIN_INVALID_CHANNEL = 33620483,
958
- /** Token无效。 请重新生成频道鉴权令牌(Token) */
959
- ERR_JOIN_BAD_TOKEN = 33620485,
960
- /** 加入频道超时,请检查网络连接是否正常 */
961
- ERR_JOIN_TIMEOUT = 16908804,
962
- /** 参数错误,{@link AliRtcAuthInfo}中的字段为空或者timestamp<=0,请检查字段是否完整 */
963
- ERR_JOIN_ERR_JOIN_BAD_PARAMBAD = 16974081,
964
- /** 加入频道失败 */
965
- ERR_JOIN_CHANNEL_FAILED = 16974338,
966
- /****************************************************
967
- * 日志模块错误码
968
- ****************************************************/
969
- /** 日志模块已经初始化 */
970
- ERR_LOG_ALREADY_INIT = 16974085,
971
- /** 日志模块根路径错误,请检查路径是否存在或路径是否具有写入权限 */
972
- ERR_LOG_ROOT_PATH_ERROR = 16974086,
973
- /****************************************************
974
- * 音频设备错误码
975
- ****************************************************/
976
- /**
977
- * 采集设备初始化失败、采集设备媒体服务异常、音频设备被占用。
978
- * - Mac端和Windows端查看系统设置中音频设备是否有能量条
979
- * - iOS端和Android端确认是否被其他应用占用
980
- * - 如果都正常,请重启设备
981
- */
982
- ERR_MIC_OPEN_FAIL = 17040388,
983
- /**
984
- * 播放设备初始化失败、播放设备媒体服务异常、音频设备被占用。
985
- * - Mac端和Windows端查看系统设置中音频设备是否有能量条
986
- * - iOS端和Android端确认是否被其他应用占用
987
- * - 如果都正常,请重启设备
988
- */
989
- ERR_SPEAKER_OPEN_FAIL = 17040389,
990
- /** 系统性能不足、采集设备媒体服务异常、音频设备被占用。建议重启应用或重启设备 */
991
- ERR_MIC_INTERRUPT = 17040390,
992
- /** 系统性能不足,播放设备媒体服务异常,音频设备被占用。建议重启应用或重启设备 */
993
- ERR_SPEAKER_INTERRUPT = 17040391,
994
- /** 麦克风设备未授权,建议去系统设置中,打开麦克风授权,并且重新加入频道 */
995
- ERR_MIC_AUTH_FAIL = 17040392,
996
- /** 无可用的音频采集设备,检查是否接入了可用的麦克风,并检查系统设置中,该设备是否被禁用 */
997
- ERR_MIC_NOT_AVAILABLE = 17040393,
998
- /** 无可用的音频播放设备,检查是否接入了可用的扬声器或耳机,并检查系统设置中,该设备是否被禁用 */
999
- ERR_SPEAKER_NOT_AVAILABLE = 17040400,
1000
- /****************************************************
1001
- * 视频设备错误码
1002
- ****************************************************/
1003
- /** 采集设备初始化失败,检查系统相机是否可用,移动端App是否占用了相机 */
1004
- ERR_CAMERA_OPEN_FAIL = 17039620,
1005
- /** 采集设备未授权,建议去系统设置中,打开摄像头授权,并且重新加入频道 */
1006
- ERR_CAMERA_AUTH_FAIL = 17039621,
1007
- /** 采集过程中出现异常,Mac、Winodows电脑相机采集灯熄灭,设备被强制中断。建议重新加入频道或者重启App */
1008
- ERR_CAMERA_INTERRUPT = 17039622,
1009
- /** 无可用的视频采集设备,检查是否接入了可用的摄像头,并检查系统设置中,该设备是否被禁用 */
1010
- ERR_CAMERA_NOT_AVAILABLE = 17039623,
1011
- /** 渲染设备初始化失败,检查Windows端显卡驱动是否需要升级,移动端手机型号或者Android平板盒子等外设是否支持OpenGL */
1012
- ERR_VIDEO_DISPLAY_OPEN_FAIL = 17039873,
1013
- /** 渲染过程中出现异常,系统异常错误导致渲染引擎报错,重新加入频道或者重启App */
1014
- ERR_VIDEO_DISPLAY_INTERRUPT = 1064992,
1015
- /****************************************************
1016
- * 网络错误码
1017
- ****************************************************/
1018
- /** 媒体通道建立失败,检查网络连接是否正常 */
1019
- ERR_ICE_CONNECTION_CONNECT_FAIL = 17105409,
1020
- /** 媒体通道重连失败,检查网络连接是否正常 */
1021
- ERR_ICE_CONNECTION_RECONNECT_FAI = 17105410,
1022
- /** 媒体通道mobility失败,应用层需要重走入会流程 */
1023
- ERR_ICE_CONNECTION_MOBILITY_FAIL = 17105411,
1024
- /** 信令心跳超时,检查网络连接是否正常 */
1025
- ERR_ICE_CONNECTION_HEARTBEAT_TIMEOUT = 16908812,
1026
- /**
1027
- * 低延时互动直播模式相关错误码
1028
- */
1029
- /** 低延时互动直播信令失败 */
1030
- ERR_LATENCY_LIVE_COMMUNICATION_FAILED = 17235971,
1031
- /** 低延时互动直播媒体设置错误 */
1032
- ERR_LATENCY_LIVE_MEIDASETTING_FAILED = 17235972,
1033
- /** 低延时互动直播当前房间没有主播推流 */
1034
- ERR_LATENCY_LIVE_NONE_BROADCASTER = 17235973,
1035
- /** 低延时互动直播错误,应用层需要重新创建新的SDK实例 */
1036
- ERR_LATENCY_LIVE_NEED_RESTART = 17235974,
1037
- /** 低延时互动直播错误,应用层需要稍等一定时间(自定义间隔)重新创建新的SDK实例 */
1038
- ERR_LATENCY_LIVE_NEED_RESTART_AGAIN_LATER = 17235975,
1039
- /** 低延迟互动直播服务不可用或者服务降级,客户端应该选择其它方式拉超大方会流,即不从cdn sfu拉流 */
1040
- ERR_LATENCY_LIVE_SERVICE_UNAVAILABLE = 17235976,
1041
- /** 低延迟互动直播网络中断错误,销毁当前sdk实例重新创建sdk后重新走订阅流程 */
1042
- ERR_LATENCY_LIVE_MEDIACONNECTION_INTERRUPTION = 17235977,
1043
- /****************************************************
1044
- * 推流相关错误码
1045
- ****************************************************/
1046
- /** 推流无效 */
1047
- ERR_SDK_PUBLISH_INVAILD = 16974597,
1048
- /** 未进入频道推流失败 */
1049
- ERR_SDK_PUBLISH_NOT_JOIN_CHANNEL = 16843782,
1050
- /** 推送音频流失败 */
1051
- ERR_SDK_PUBLISH_AUDIO_STREAM_FAILED = 16843856,
1052
- /** 推送视频流失败 */
1053
- ERR_SDK_PUBLISH_VIDEO_STREAM_FAILED = 16843857,
1054
- /** 推送小流失败 */
1055
- ERR_SDK_PUBLISH_DUAL_STREAM_FAILED = 16843858,
1056
- /** 推送屏幕共享失败 */
1057
- ERR_SDK_PUBLISH_SCEEN_SHARE_FAILED = 16843859,
1058
- /** 屏幕共享配置错误 */
1059
- ERR_SDK_PUBLISH_SCREEN_SHARE_CONFIG_ERROR = 16843860,
1060
- /****************************************************
1061
- * 订阅相关错误码
1062
- ****************************************************/
1063
- /** 订阅无效 */
1064
- ERR_SDK_SUBSCRIBE_INVAILD = 16974852,
1065
- /** 未进入频道订阅错误 */
1066
- ERR_SDK_SUBSCRIBE_NOT_JOIN_CHANNEL = 16844112,
1067
- /** 订阅音频流失败 */
1068
- ERR_SDK_SUBSCRIBE_AUDIO_STREAM_FAILED = 16844113,
1069
- /** 订阅视频流失败 */
1070
- ERR_SDK_SUBSCRIBE_VIDEO_STREAM_FAILED = 16844114,
1071
- /** 订阅小流失败 */
1072
- ERR_SDK_SUBSCRIBE_DUAL_STREAM_FAILED = 16844115,
1073
- /** 订阅屏幕共享失败 */
1074
- ERR_SDK_SUBSCRIBE_SCREEN_SHARE_FAILED = 16844116,
1075
- /** 订阅 DataChannel 失败 */
1076
- ERR_SDK_SUBSCRIBE_DATA_FAILED = 16844117,
1077
- /** 订阅 DataChannel 过程中报错 */
1078
- ERR_SDK_SUBSCRIBE_DATA_ERROR = 16844118,
1079
- /****************************************************
1080
- * 其他错误码
1081
- ****************************************************/
1082
- /** SDK状态错误,建议销毁SDK重新创建实例。 */
1083
- ERR_SDK_INVALID_STATE = 16974340,
1084
- /** 参数不匹配 */
1085
- ERR_INVALID_ARGUMENTS = 16974083,
1086
- /** Session已经被移除,建议销毁实例之后重新创建实例并加入频道。 */
1087
- ERR_SESSION_REMOVED = 33620229,
1088
- /** 互动模式下设置角色错误 */
1089
- ERR_SDK_UPDATE_ROLE_CHANNEL = 16908801,
1090
- /** SDK内部错误 */
1091
- ERR_INNER = -1,
1092
- /************************************************************************************/
1093
- /******************************** 旁路直播错误码 start ********************************/
1094
- /************************************************************************************/
1095
- /**
1096
- * MPU任务发布成功
1097
- */
1098
- ERR_SDK_MPU_TASK_PUBLISH_OK = 0,
1099
- /**
1100
- * MPU任务流未找到
1101
- */
1102
- ERR_SDK_MPU_TASK_STREAM_NOT_FOUND = 17825793,
1103
- /**
1104
- * MPU任务流已存在
1105
- */
1106
- ERR_SDK_MPU_TASK_STREAM_ALREADY_EXIST = 17825794,
1107
- /**
1108
- * MPU任务无效参数
1109
- */
1110
- ERR_SDK_MPU_TASK_INVALID_PARAM = 17825795,
1111
- /**
1112
- * MPU任务内部错误
1113
- */
1114
- ERR_SDK_MPU_TASK_INTERNAL_ERROR = 17825796,
1115
- /**
1116
- * MPU任务rtmp服务错误
1117
- */
1118
- ERR_SDK_MPU_TASK_RTMP_SERVER_ERROR = 17825797,
1119
- /**
1120
- * MPU任务rtmp流地址错误
1121
- */
1122
- ERR_SDK_MPU_TASK_RTMP_STREAM_URL_ERROR = 17825798,
1123
- /**
1124
- * MPU任务发布超时
1125
- */
1126
- ERR_SDK_MPU_TASK_PUBLISH_TIMEOUT = 17825799,
1127
- /**
1128
- * MPU任务发布成功
1129
- */
1130
- ERR_SDK_MPU_TASK_NOT_AUTHORIZED = 17825800,
1131
- /************************************************************************************/
1132
- /******************************** 旁路直播错误码 end ********************************/
1133
- /************************************************************************************/
1134
- /************************************************************************************/
1135
- /******************************** 跨频道转推错误码 start ******************************/
1136
- /************************************************************************************/
1137
- /**
1138
- * 检测到本地状态不对,没入会,角色错误,频道模式错误
1139
- */
1140
- ERR_SDK_CHANNEL_RELAY_STATE_ERROR = 18874369,
1141
- /**
1142
- * 服务端返回436,源通道模式不匹配
1143
- */
1144
- ERR_SDK_CHANNEL_RELAY_SRC_NOT_ALLOW = 18874370,
1145
- /**
1146
- * 服务端返回437,目标通道不存在或者模式不匹配
1147
- */
1148
- ERR_SDK_CHANNEL_RELAY_JOIN_DEST_FAILED = 18874371,
1149
- /**
1150
- * 服务端返回438,token无效
1151
- */
1152
- ERR_SDK_CHANNEL_RELAY_TOKEN_INVALID = 18874372,
1153
- /**
1154
- * 服务端返651,session不是主播
1155
- */
1156
- ERR_SDK_CHANNEL_RELAY_ROLE_ERROR = 18874373,
1157
- /**
1158
- * 服务端400,参数错误
1159
- */
1160
- ERR_SDK_CHANNEL_RELAY_INVALID_PARAM = 18874374,
1161
- /**
1162
- * 服务端返回440,不能转推到本频道
1163
- */
1164
- ERR_SDK_CHANNEL_RELAY_TO_SELF_ERROR = 18874375
1165
- }
1166
-
1167
- declare class AliRtcError extends Error {
1168
- _code: number;
1169
- _extra?: any;
1170
- static fromRtsError(error: any): AliRtcError;
1171
- static fromError(error: any, code?: number, fallbackMessage?: string): AliRtcError;
1172
- constructor(code: number, message: string, extra?: any);
1173
- get code(): number;
1174
- set code(code: number);
1175
- get reason(): string;
1176
- get extra(): any;
1177
- }
1178
-
1179
- type DeviceStatusChangeType = ClientEventType.MuteAudio | ClientEventType.UnmuteAudio | ClientEventType.MuteScreen | ClientEventType.UnmuteScreen | ClientEventType.MuteVideo | ClientEventType.UnmuteVideo;
1180
- declare enum CmdType {
1181
- Add = 0,
1182
- Del = 1,
1183
- Update = 2,
1184
- None = 100
1185
- }
1186
- declare enum CodecType {
1187
- OPUS = "opus",
1188
- H264 = "H264",
1189
- H265 = "H265",
1190
- AV1 = "AV1",
1191
- UNKNOWN = ""
1192
- }
1193
- interface MediaTrackInfo {
1194
- ssrc: string;
1195
- msid: string;
1196
- red: number;
1197
- codec: CodecType;
1198
- sample?: number;
1199
- pt: number;
1200
- type?: CmdType;
1201
- }
1202
- declare enum RemoteTrackSubscribeState {
1203
- NotSubscribe = 0,
1204
- Subscribing = 1,
1205
- Subscribed = 2
1206
- }
1207
- interface RemoteMediaTrackInfo extends MediaTrackInfo {
1208
- subscribeState?: RemoteTrackSubscribeState;
1209
- }
1210
- interface StreamListener {
1211
- [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType) => void;
1212
- error: (err: AliRtcError) => void;
1213
- }
1214
- declare enum TrackEvent {
1215
- VideoTrackEnded = "videoTrackEnded",
1216
- AudioTrackEnded = "audioTrackEnded",
1217
- ScreenTrackEnded = "screenTrackEnded"
1218
- }
1219
-
1220
- /** 角色鉴权 主播pub|观众sub|转推流鉴权(跨房间转推中使用)relay */
1221
- type AliRtcSdkTokenRole = 'pub' | 'sub' | 'relay';
1222
- interface AliRtcAuthInfo {
1223
- /** 频道ID */
1224
- channelId: string;
1225
- /** 用户ID */
1226
- userId: string;
1227
- /** 应用ID */
1228
- appId: string;
1229
- /** 随机串 */
1230
- nonce?: string;
1231
- /** 时间戳 */
1232
- timestamp: number;
1233
- /** 令牌 */
1234
- token: string;
1235
- /** 会议id */
1236
- sessionId?: string;
1237
- /** 角色鉴权值 */
1238
- role?: AliRtcSdkTokenRole;
1239
- }
1240
- type AliRtcRefreshAuthInfo = Pick<AliRtcAuthInfo, 'userId' | 'nonce' | 'token' | 'timestamp' | 'role'>;
1241
-
1242
- declare enum AliRtcEnv {
1243
- pre = "pre",
1244
- prod = "prod"
1245
- }
1246
- declare enum AliRtcSdkChannelProfile {
1247
- /** 普通通信模式 */
1248
- AliRtcSdkCommunication = "communication",
1249
- /** 直播模式(大方会模式) */
1250
- AliRtcSdkInteractiveLive = "interactive_live",
1251
- /** 低延迟互动直播模式 */
1252
- AliRtcSdkInteractiveWithLowLatencyLive = "cdn_live"
1253
- }
1254
- declare enum AliRtcSdkClientRole {
1255
- /** 互动角色 */
1256
- AliRtcSdkInteractive = "interactive",
1257
- /** 观众角色 */
1258
- AliRtcSdkLive = "live"
1259
- }
1260
- declare enum AliRtcEngineLocalDeviceType {
1261
- /** 未知设备类型 */
1262
- AliEngineLocalDeviceTypeUnknown = 0,
1263
- /** 麦克风设备 */
1264
- AliEngineLocalDeviceTypeMic = 1,
1265
- /** 扬声器设备 */
1266
- AliEngineLocalDeviceTypeSpeaker = 2,
1267
- /** 音频设备 */
1268
- AliEngineLocalDeviceTypeAudioDevice = 3,
1269
- /** 摄像头设备 */
1270
- AliEngineLocalDeviceTypeCamera = 4,
1271
- /** 显示设备 */
1272
- AliEngineLocalDeviceTypeDisplay = 5,
1273
- /** 视频设备 */
1274
- AliEngineLocalDeviceTypeVideoDevice = 6
1275
- }
1276
- declare enum AliRtcEngineLocalDeviceExceptionType {
1277
- /** 未知异常类型 */
1278
- AliEngineLocalDeviceExceptionTypeUnknown = 0,
1279
- /** 麦克风打开失败 */
1280
- AliEngineLocalDeviceExceptionTypeMicOpenFail = 1,
1281
- /** 麦克风被打断 */
1282
- AliEngineLocalDeviceExceptionTypeMicInterrupt = 2,
1283
- /** 麦克风无权限 */
1284
- AliEngineLocalDeviceExceptionTypeMicAuthFail = 3,
1285
- /** 无可用麦克风 */
1286
- AliEngineLocalDeviceExceptionTypeMicNotAvailable = 4,
1287
- /** 扬声器打开失败 */
1288
- AliEngineLocalDeviceExceptionTypeSpeakerOpenFail = 5,
1289
- /** 扬声器被打断 */
1290
- AliEngineLocalDeviceExceptionTypeSpeakerInterrupt = 6,
1291
- /** 无可用扬声器 */
1292
- AliEngineLocalDeviceExceptionTypeSpeakerNotAvailable = 7,
1293
- /** 音频设备异常 */
1294
- AliEngineLocalDeviceExceptionTypeAudioDeviceException = 8,
1295
- /** 摄像头打开失败 */
1296
- AliEngineLocalDeviceExceptionTypeCameraOpenFail = 9,
1297
- /** 摄像头被打断 */
1298
- AliEngineLocalDeviceExceptionTypeCameraInterrupt = 10,
1299
- /** 摄像头无权限 */
1300
- AliEngineLocalDeviceExceptionTypeCameraAuthFail = 11,
1301
- /** 显示设备异常 */
1302
- AliEngineLocalDeviceExceptionTypeDisplayException = 12,
1303
- /** 视频设备异常 */
1304
- AliEngineLocalDeviceExceptionTypeVideoDeviceException = 13
1305
- }
1306
- declare enum AliRtcConnectionStatus {
1307
- /** 初始化完成 */
1308
- AliRtcConnectionStatusInit = 0,
1309
- /** 网络连接断开 */
1310
- AliRtcConnectionStatusDisconnected = 1,
1311
- /** 建立网络连接中 */
1312
- AliRtcConnectionStatusConnecting = 2,
1313
- /** 网络已连接 */
1314
- AliRtcConnectionStatusConnected = 3,
1315
- /** 重新建立网络连接中 */
1316
- AliRtcConnectionStatusReconnecting = 4,
1317
- /** 网络连接失败 */
1318
- AliRtcConnectionStatusFailed = 5
1319
- }
1320
- declare enum AliRtcConnectionStatusChangeReason {
1321
- /** 未知原因 */
1322
- AliRtcConnectionChangedDummyReason = 0,
1323
- /** 媒体通道变更 */
1324
- AliRtcConnectionMediaPathChanged = 1,
1325
- /** 心跳超时 */
1326
- AliRtcConnectionSignalingHeartbeatTimeout = 2,
1327
- /** 心跳恢复 */
1328
- AliRtcConnectionSignalingHeartbeatAlive = 3,
1329
- /** DNS解析成功 */
1330
- AliRtcConnectionSignalingHttpDnsResolved = 4,
1331
- /** DNS解析失败 */
1332
- AliRtcConnectionSignalingHttpDnsFailure = 5,
1333
- /** GSLB请求失败 */
1334
- AliRtcConnectionSignalingGslbFailure = 6,
1335
- /** GSLB请求成功 */
1336
- AliRtcConnectionSignalingGslbSuccess = 7,
1337
- /** 加入频道失败 */
1338
- AliRtcConnectionSignalingJoinRoomFailure = 8,
1339
- /** 加入频道成功 */
1340
- AliRtcConnectionSignalingJoinRoomSuccess = 9,
1341
- /** 离开频道 */
1342
- AliRtcConnectionSignalingLeaveRoom = 10,
1343
- /** 信令建立连接 */
1344
- AliRtcConnectionSignalingConnecting = 11,
1345
- /** 网络连接中断 */
1346
- AliRtcConnectionChangedNetworkInterrupted = 12
1347
- }
1348
- declare enum AliRtcUserOfflineReason {
1349
- /** 用户主动离开 */
1350
- AliRtcUserOfflineQuit = 0,
1351
- /** 因过长时间收不到对方数据包,超时掉线 */
1352
- AliRtcUserOfflineDropped = 1,
1353
- /** 用户身份从主播切换为观众时触发 */
1354
- AliRtcUserOfflineBecomeAudience = 2
1355
- }
1356
- declare enum AliRtcAudioTrack {
1357
- /** 无麦克风 */
1358
- AliRtcAudioTrackNo = 0,
1359
- /** 麦克风 */
1360
- AliRtcAudioTrackMic = 1,
1361
- /** 第二音频流 */
1362
- AliRtcAudioTrackDual = 2
1363
- }
1364
- declare enum AliRtcVideoTrack {
1365
- /** 无视频流 **/
1366
- AliRtcVideoTrackNo = 0,
1367
- /** 相机流 **/
1368
- AliRtcVideoTrackCamera = 1,
1369
- /** 屏幕共享流 **/
1370
- AliRtcVideoTrackScreen = 2,
1371
- /** 相机流和屏幕共享流 **/
1372
- AliRtcVideoTrackBoth = 3
1373
- }
1374
- declare enum AliRtcPublishState {
1375
- /** 0: SDK初始推流状态 */
1376
- AliRtcStatePublishIdle = 0,
1377
- /** 1: 未推流状态,可能是因为:
1378
- * - 已设置停止推送媒体流
1379
- * - 推送媒体流失败
1380
- */
1381
- AliRtcStateNoPublish = 1,
1382
- /** 2: 推流链接建立过程中 */
1383
- AliRtcStatePublishing = 2,
1384
- /** 3: 推流成功 */
1385
- AliRtcStatePublished = 3
1386
- }
1387
- declare enum AliRtcSubscribeState {
1388
- /** 初始状态 */
1389
- AliRtcStateSubscribeIdle = 0,
1390
- /** 未订阅 */
1391
- AliRtcStateNoSubscribe = 1,
1392
- /** 订阅中 */
1393
- AliRtcStateSubscribing = 2,
1394
- /** 已订阅 */
1395
- AliRtcStateSubscribed = 3
1396
- }
1397
- declare enum AliRtcVideoStreamType {
1398
- /** 无,在OnSubscribeStreamTypeChanged回调表示当前未订阅 */
1399
- AliRtcVideoStreamTypeNone = 0,
1400
- /** 高码率,高分辨率流(大流) */
1401
- AliRtcVideoStreamTypeHigh = 1,
1402
- /** 低码率,低分辨率流(小流) */
1403
- AliRtcVideoStreamTypeLow = 2
1404
- }
1405
- /**
1406
- * @brief OnBye类型枚举
1407
- */
1408
- declare enum AliRtcOnByeType {
1409
- /** 当前user被踢出channel */
1410
- AliRtcOnByeBeKickedOut = 1,
1411
- /** channel已结束,需要离开会议 */
1412
- AliRtcOnByeChannelTerminated = 2,
1413
- /** 相同userID在其他设备joinChannel,当前设备被下线 */
1414
- AliRtcOnByeUserReplaced = 3
1415
- }
1416
- declare enum AliRtcCameraDirection {
1417
- /** 无效 */
1418
- CAMERA_INVALID = -1,
1419
- /** 后置 */
1420
- CAMERA_REAR = 0,
1421
- /** 前置 */
1422
- CAMERA_FRONT = 1
1423
- }
1424
-
1425
- interface SendPackageAuthInfo {
1426
- timestamp: number;
1427
- nonce?: string;
1428
- token: string;
1429
- tokenrole: AliRtcSdkTokenRole;
1430
- }
1431
- interface PackageAdaptInfo {
1432
- os_name: string;
1433
- device_name: string;
1434
- brand_name: string;
1435
- device_key: string;
1436
- os_version: string;
1437
- sdk_version: string;
1438
- version: string;
1439
- }
1440
- interface JoinResult {
1441
- l1ip?: string;
1442
- l1subip?: string;
1443
- pushstreamurl: string;
1444
- tid: string;
1445
- users: JoinInfo[];
1446
- timestamp: number;
1447
- config: any;
1448
- }
1449
- interface RefreshUrlResult extends SignalingResult {
1450
- pushstreamurl?: string;
1451
- users?: RefreshUser[];
1452
- }
1453
- interface SignalingResult {
1454
- tid: string;
1455
- code?: number;
1456
- message?: string;
1457
- }
1458
- interface RoleForReconnectData {
1459
- channelprofile?: AliRtcSdkChannelProfile;
1460
- clientrole?: AliRtcSdkClientRole;
1461
- }
1462
- interface ReconnectData {
1463
- role?: RoleForReconnectData;
1464
- auth?: SendPackageAuthInfo;
1465
- publish?: {
1466
- users: [PublishInfo];
1467
- };
1468
- }
1469
-
1470
- declare enum MessageType {
1471
- KEEPALIVE = "keepalive",
1472
- JOINCHANNEL = "joinchannel",
1473
- NOTIFYJOIN = "notifyjoin",
1474
- NOTIFYSTATUS = "notifystatus",
1475
- STATUSREPORT = "statusreport",
1476
- LEAVECHANNEL = "leavechannel",
1477
- NOTIFYLEAVE = "notifyleave",
1478
- NOTIFYPUBLISH = "notifypublish",
1479
- BYE = "bye",
1480
- RECONNECT = "reconnect",
1481
- PUBLISH = "publish",
1482
- REFRESHURL = "refreshurl",
1483
- UNSUBSCRIBE = "unsubscribe",
1484
- ROLEUPDATE = "roleupdate"
1485
- }
1486
- interface ISendPackage {
1487
- version: number;
1488
- msgtype: MessageType;
1489
- tid: string;
1490
- header: {
1491
- appid: string;
1492
- channelid: string;
1493
- sessionid: string;
1494
- userid: string;
1495
- displayName?: string;
1496
- clientversion?: string;
1497
- platform?: string;
1498
- };
1499
- data: {
1500
- seq: number;
1501
- l1ip?: string;
1502
- status?: string;
1503
- clientrole?: string;
1504
- configure?: {
1505
- clientrole?: AliRtcSdkClientRole;
1506
- channelprofile: AliRtcSdkChannelProfile;
1507
- };
1508
- auth?: SendPackageAuthInfo;
1509
- adapt?: PackageAdaptInfo;
1510
- sessionid?: string;
1511
- pushstreamurl?: string;
1512
- users?: any[];
1513
- };
1514
- }
1515
- interface IResponse {
1516
- version: number;
1517
- code: number;
1518
- msgtype: MessageType;
1519
- tid: string;
1520
- isproxy?: boolean;
1521
- }
1522
- declare class PackageCreater {
1523
- protected authInfo: AliRtcAuthInfo;
1524
- protected userName: string;
1525
- protected seqIndex: number;
1526
- constructor(authInfo: AliRtcAuthInfo, userName: string);
1527
- get roleAuth(): SendPackageAuthInfo | undefined;
1528
- get adaptInfo(): PackageAdaptInfo | undefined;
1529
- refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
1530
- getSeqIndex(): number;
1531
- /**
1532
- * 创建一个心跳包
1533
- * @returns
1534
- */
1535
- createKeepAlivePackage(): ISendPackage;
1536
- /**
1537
- * 创建一个用于发送入会消息的Package
1538
- * @returns
1539
- */
1540
- createJoinPackage(extraData?: any): ISendPackage;
1541
- /**
1542
- * 创建一个用于发送离会消息的Package
1543
- * @returns
1544
- */
1545
- crateLeavePackage(): ISendPackage;
1546
- createStatusPackage(status: string): ISendPackage;
1547
- /**
1548
- * 创建一个用于发送推流消息的Package
1549
- * @returns
1550
- */
1551
- createPublishPackage(): ISendPackage;
1552
- createRoleUpdatePackage(): ISendPackage;
1553
- createReconnectPackage(data?: ReconnectData): ISendPackage;
1554
- createRefreshUrlPackage(): ISendPackage;
1555
- /**
1556
- * 创建一个Response包
1557
- * @param {string} tid Notify消息的tid
1558
- * @param {MessageType} msgType 消息类型
1559
- * @returns {IResponse}
1560
- */
1561
- createResponsePackage(tid: string, msgType: MessageType): IResponse;
1562
- /**
1563
- *
1564
- * @param messageType
1565
- * @returns
1566
- */
1567
- protected createBaseSendPackage(messageType: MessageType): ISendPackage;
1568
- }
1569
-
1570
- /**
1571
- * websocket链接状态
1572
- */
1573
- declare enum CONNECTSTATUS {
1574
- DISCONNECTED = 0,
1575
- CONNECTING = 1,
1576
- CONNECTED = 2
1577
- }
1578
- /**
1579
- * Socket的支持的事件
1580
- */
1581
- interface SocketListener {
1582
- onOpen: (event: Event) => void;
1583
- onMessage: (event: MessageEvent) => void;
1584
- onError: (event: Event) => void;
1585
- onClose: (event: CloseEvent) => void;
1586
- onConnectFail: () => void;
1587
- onAuthInvalid: () => void;
1588
- onNetworkError: () => void;
1589
- onReconnectStart: () => void;
1590
- onReconnectFail: (event: Event) => void;
1591
- }
1592
- /**
1593
- * Websocket类
1594
- */
1595
- declare class Socket extends EventEmitter$1<SocketListener> {
1596
- /**
1597
- * @ignore
1598
- */
1599
- static logName: string;
1600
- protected ws?: WebSocket;
1601
- protected socketStatus: CONNECTSTATUS;
1602
- protected wsUrl: string;
1603
- protected lastConnectStartTime: number;
1604
- protected maxConnectRetryCount: number;
1605
- connectRetryCount: number;
1606
- protected gotErr: boolean;
1607
- protected closedByInvoke: boolean;
1608
- protected isReconnecting: boolean;
1609
- protected networkAvailableChecked: boolean;
1610
- private reconnectTimeoutId;
1611
- constructor(maxConnectRetryCount?: number);
1612
- get connectUrl(): string;
1613
- /**
1614
- * 返回websocket连接的状态
1615
- */
1616
- get connectStatus(): CONNECTSTATUS;
1617
- /**
1618
- * 开始连接
1619
- * @param wsUrl
1620
- */
1621
- start(wsUrl: string): void;
1622
- /**
1623
- * 发送消息
1624
- * @param pkg
1625
- */
1626
- send(pkg: ISendPackage | IResponse): boolean;
1627
- /**
1628
- * 主动断开连接
1629
- */
1630
- close(): void;
1631
- reconnect(): void;
1632
- /**
1633
- * 连接成功
1634
- * @param event
1635
- */
1636
- protected onOpen(event: Event): void;
1637
- /**
1638
- * 收到消息
1639
- * @param event
1640
- */
1641
- protected onMessage(event: MessageEvent): void;
1642
- /**
1643
- * 收到错误
1644
- * @param event
1645
- */
1646
- protected onError(event: Event): void;
1647
- /**
1648
- * 连接断开
1649
- * @param event
1650
- */
1651
- protected onClose(event: CloseEvent): Promise<void>;
1652
- /**
1653
- * 初始化websocket
1654
- */
1655
- protected initWebSocket(): void;
1656
- /**
1657
- * 反初始化websocket
1658
- */
1659
- protected uninitWebsocket(): void;
1660
- }
1661
-
1662
- interface WebTrackerOptions {
1663
- host: string;
1664
- project: string;
1665
- logstore: string;
1666
- /**
1667
- * 发送时间阈值, default 10s
1668
- */
1669
- time?: number;
1670
- /**
1671
- * 发送条数阈值, default 10
1672
- */
1673
- count?: number;
1674
- /**
1675
- * 日志主题
1676
- */
1677
- topic?: string;
1678
- /**
1679
- * 日志来源
1680
- */
1681
- source?: string;
1682
- /**
1683
- * 日志标签
1684
- */
1685
- tags?: Record<string, any>;
1686
- installUnloadHook?: (hook: () => void) => void;
1687
- sendPayload: (url: string, payload: string) => void;
1688
- }
1689
- type WebTrackerBrowserOptions = Omit<WebTrackerOptions, 'installUnloadHook' | 'sendPayload'>;
1690
- interface StsPlugin {
1691
- transString: (obj: Record<string, any>) => Record<string, any>;
1692
- process: (url: string, payload: string) => Promise<{
1693
- data: any;
1694
- header: {
1695
- [k: string]: string;
1696
- };
1697
- }>;
1698
- }
1699
-
1700
- declare class WebTracker {
1701
- private timer;
1702
- private time;
1703
- private count;
1704
- private arr;
1705
- private url;
1706
- private opt;
1707
- constructor(opt: WebTrackerOptions);
1708
- private assemblePayload;
1709
- private platformSend;
1710
- private transString;
1711
- private sendImmediateInner;
1712
- private sendInner;
1713
- send(originLog: Record<string, any>): void;
1714
- sendImmediate(originLog: Record<string, any>): void;
1715
- sendBatchLogs(originLogs: Array<Record<string, any>>): void;
1716
- sendBatchLogsImmediate(originLogs: Array<Record<string, any>>): void;
1717
- overwriteTransString(stsPlugin: StsPlugin): void;
1718
- getOpt(): WebTrackerOptions;
1719
- }
1720
-
1721
- declare class WebTrackerBrowser extends WebTracker {
1722
- constructor(opt: WebTrackerBrowserOptions);
1723
- useStsPlugin(stsPlugin: StsPlugin): void;
1724
- }
1725
-
1726
- declare class NTPClient {
1727
- private static instance;
1728
- private ntpClock;
1729
- private constructor();
1730
- static getInstance(): NTPClient;
1731
- now(): number;
904
+ declare enum AliRtcRawDataStreamType {
905
+ /** 相机流 */
906
+ AliRtcSdkStreamTypeCapture = 0,
907
+ /** 屏幕共享流 */
908
+ AliRtcSdkStreamTypeScreen = 1
1732
909
  }
1733
910
 
1734
- interface SLSSTSToken {
1735
- access_key_id: string;
1736
- access_key_secret: string;
1737
- expiration: number;
1738
- log_store_debug: string;
1739
- log_store_stats: string;
1740
- project: string;
1741
- region_endpoint: string;
1742
- security_token: string;
911
+ declare enum VideoStreamSource {
912
+ Camera = 0,
913
+ Screen = 1,
914
+ Image = 2
1743
915
  }
1744
- interface OSSSTSToken {
1745
- access_key_id: string;
1746
- access_key_secret: string;
1747
- security_token: string;
1748
- region_endpoint: string;
1749
- bucket_name: string;
1750
- expiration: number;
916
+ declare enum AudioStreamSource {
917
+ Microphone = 0,
918
+ Screen = 1,
919
+ Mixed = 2
1751
920
  }
1752
921
  /**
1753
- * 日志埋点类,调用LogReporter进行日志埋点
1754
- * 在入会之前,会将埋点缓存,入会后以每200ms一条的速度将缓存的埋点按顺序上报
1755
- */
1756
- declare class LogClient {
1757
- protected tracker?: WebTrackerBrowser;
1758
- protected param?: any;
1759
- protected msgCacheArr: any[];
1760
- protected index: number;
1761
- protected stsOpt?: any;
1762
- protected slsToken?: SLSSTSToken;
1763
- protected ossToken?: OSSSTSToken;
1764
- protected ntpClock: NTPClient;
1765
- constructor();
1766
- private createTracker;
1767
- start(info: AliRtcAuthInfo): void;
1768
- updateToken(slsToken: SLSSTSToken, ossToken?: OSSSTSToken): void;
1769
- /**
1770
- * 断开连接
1771
- */
1772
- stop(): void;
1773
- /**
1774
- * 发送一条日志
1775
- * @param {any} log
1776
- */
1777
- sendReport(log: any): void;
1778
- /**
1779
- * 初始化公共参数
1780
- */
1781
- protected initParam(info: AliRtcAuthInfo): void;
1782
- }
1783
-
1784
- interface TimeRecorder {
1785
- start: number;
1786
- [key: string]: number;
1787
- }
1788
- interface LogInfo {
1789
- [key: string]: string | number;
1790
- }
1791
-
1792
- interface VideoScalerOptions {
1793
- width: number;
1794
- height: number;
1795
- frameRate: number;
1796
- }
1797
- interface VideoScaler {
1798
- getVideoTrack: () => MediaStreamTrack;
1799
- updateOptions: (options: VideoScalerOptions) => void;
1800
- dispose: () => void;
1801
- }
1802
-
1803
- declare class VideoScalerFactory {
1804
- static isSupport(): boolean;
1805
- /**
1806
- * 获取实例
1807
- * @param {MediaStreamTrack} videoTrack
1808
- * @param {IProfile} profile
1809
- * @return {VideoScaler}
1810
- */
1811
- static getInstance(videoTrack: MediaStreamTrack, options: VideoScalerOptions): VideoScaler;
1812
- }
1813
-
1814
- interface AudioLevelMonitorListener {
1815
- audioLevel: (level: number) => void;
1816
- }
1817
- declare class AudioLevelMonitor extends EventEmitter$1<AudioLevelMonitorListener> {
1818
- private audioContext;
1819
- private stream;
1820
- private sourceNode?;
1821
- private analyser?;
1822
- constructor();
1823
- getLevel(): number;
1824
- /**
1825
- * 开启监听 audio level 的变化
1826
- *
1827
- * @param {MediaStreamTrack} track 音频轨
1828
- * @param {number} [interval=1000] 检测间隔,单位毫秒,默认 1000ms
1829
- */
1830
- start(track: MediaStreamTrack, interval?: number): void;
1831
- stop(): void;
1832
- dispose(): void;
1833
- }
1834
-
1835
- declare class LocalProfileManager {
1836
- private defaultProfile;
1837
- profile?: string;
1838
- profileMap: Map<string, IProfile>;
1839
- audioProfile?: AudioProfileKey;
1840
- contentHint?: string;
1841
- constructor(defaultProfile?: IProfile);
1842
- updateProfile(profileKey: string, profileValue?: Partial<IProfile>): void;
1843
- get videoProfile(): string | undefined;
1844
- updateAudioProfile(profileKey: AudioProfileKey): void;
1845
- setContentHint(videoTrack: MediaStreamTrack | undefined, contentHint?: string): void;
1846
- /**
1847
- * 更新源流 Constraints
1848
- * 更新 PeerConnectiong Sender 相关配置
1849
- * @param stream
1850
- */
1851
- setVideoProfile(originVideoTrack: MediaStreamTrack | undefined, target: LocalStream | undefined, skipConstraints?: boolean): Promise<void>;
1852
- }
1853
-
1854
- interface PublishStreamInfo {
1855
- audio?: LocalStream;
1856
- video?: LocalStream;
1857
- videoSmall?: LocalStream;
1858
- screen?: LocalStream;
1859
- videoProfile?: LocalProfileManager;
1860
- screenProfile?: LocalProfileManager;
1861
- }
1862
-
1863
- interface PluginManagerListener {
1864
- added: (plugin: AliRtcPlugin) => void;
1865
- removed: (plugin: AliRtcPlugin) => void;
1866
- updated: (plugin: AliRtcPlugin) => void;
1867
- }
1868
- declare class PluginManager extends EventEmitter$1<PluginManagerListener> {
1869
- private plugins;
1870
- add(plugin: AliRtcPlugin, options?: any): void;
1871
- remove(name: string): void;
1872
- removeAll(): void;
1873
- get(name: string): AliRtcPlugin | undefined;
1874
- has(name: string): boolean;
1875
- getAll(): AliRtcPlugin[];
1876
- }
1877
-
1878
- interface LocalStreamManagerListener {
1879
- trackended: (type: TrackEvent) => {};
1880
- publishupdate: () => {};
1881
- }
1882
- declare class LocalStreamManager extends EventEmitter$1<LocalStreamManagerListener> {
1883
- /**
1884
- * @ignore
1885
- */
1886
- static logName: string;
1887
- private pluginManager;
1888
- private slsReporter;
1889
- private publishingCameraVideoStream;
1890
- private publishingScreenVideoStream;
1891
- cameraStreamInfo: AliRtcLocalStreamInfo;
1892
- screenStreamInfo: AliRtcLocalStreamInfo;
1893
- private streamInfos;
1894
- private _audioCaptureDisabled;
1895
- private _cameraCaptureDisabled;
1896
- private _publishLocalAudioStreamEnabled;
1897
- private _publishLocalVideoStreamEnabled;
1898
- private _publishLocalScreenStreamEnabled;
1899
- constructor(pluginManager: PluginManager, slsReporter: SLSReporter);
1900
- get hasCamera(): boolean;
1901
- get audioCaptureDisabled(): boolean;
1902
- set audioCaptureDisabled(closed: boolean);
1903
- get cameraCaptureDisabled(): boolean;
1904
- set cameraCaptureDisabled(closed: boolean);
1905
- setAudioMuted(muted: boolean): void;
1906
- get isAudioMuted(): boolean;
1907
- setCameraMuted(muted: boolean): void;
1908
- get isCameraMuted(): boolean;
1909
- setScreenMuted(muted: boolean): void;
1910
- get isScreenMuted(): boolean;
1911
- get publishLocalAudioStreamEnabled(): boolean;
1912
- set publishLocalAudioStreamEnabled(enable: boolean);
1913
- get publishLocalVideoStreamEnabled(): boolean;
1914
- set publishLocalVideoStreamEnabled(enable: boolean);
1915
- get publishLocalScreenStreamEnabled(): boolean;
1916
- set publishLocalScreenStreamEnabled(enable: boolean);
1917
- updateStreams(): Promise<void>;
1918
- private setAvailableCameraDeviceId;
1919
- private setAvailableMicrophoneDeviceId;
1920
- /**
1921
- * 创建 LocalStream
1922
- * @param {LocalStreamConfig} params 创建 LocalStream 的配置
1923
- * @returns {LocalStream} 当前创建的 LocalStream
1924
- */
1925
- createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
1926
- /**
1927
- * 停止推流,底层调用 rts publishStop,不会导致 DC 马上关闭。适合暂时停推的场景
1928
- * @param {StopPublishOptions} options
1929
- * @returns {Promise<PublishStreamInfo>} 如果返回了 audio,则表示需要更新音频流
1930
- */
1931
- stopLocalStream(options: StopPublishOptions): Promise<void>;
1932
- get publishStreams(): PublishStreamInfo;
1933
- createHTTPPublishStream(): Promise<{
1934
- publishStream: LocalStream | undefined;
1935
- videoSmallStream: LocalStream | undefined;
1936
- screenStream: LocalStream | undefined;
1937
- vMsid: string | undefined;
1938
- }>;
1939
- /**
1940
- * 停止所有流
1941
- */
1942
- stop(): void;
1943
- /**
1944
- * 设置摄像头流 profile
1945
- * @param {LocalStream | null} stream
1946
- * @param {string} profileKey
1947
- * @param {IProfile} profile
1948
- */
1949
- setVideoProfile(profileKey?: string, profile?: Partial<IProfile>, skipConstraints?: boolean): Promise<void>;
1950
- /**
1951
- * 设置摄像头流 content hint
1952
- * @param {string} hint
1953
- * @note 不传则尝试复用之前的 hint
1954
- */
1955
- setVideoContentHint(hint?: string): void;
1956
- /**
1957
- * 设置音频流 profile
1958
- * @param {string} profileKey
1959
- */
1960
- setAudioProfile(profileKey: AudioProfileKey): Promise<void>;
1961
- /**
1962
- * 设置屏幕共享流 profile
1963
- * @param {LocalStream} stream
1964
- * @param {string} profileKey
1965
- * @param {IProfile} profile
1966
- */
1967
- setScreenProfile(profileKey?: string, profile?: Partial<IProfile>): Promise<void>;
1968
- setScreenContentHint(hint?: string): void;
1969
- /**
1970
- * 设置 cameraVideoConstraints
1971
- * @param {IVideoConstraints} cameraVideoConstraints
1972
- */
1973
- setCameraVideoConstraints(cameraVideoConstraints: MediaTrackConstraints): void;
1974
- /**
1975
- * 设置 micAudioConstraints
1976
- * @param {IAudioConstraints} micAudioConstraints
1977
- */
1978
- setMicAudioConstraints(micAudioConstraints: MediaTrackConstraints): void;
1979
- }
1980
-
1981
- interface DeviceStatus {
1982
- micOpen: boolean;
1983
- micInterrupted: boolean;
1984
- audioDisable: boolean;
1985
- cameraOpen: boolean;
1986
- videoDisable: boolean;
1987
- screenShare: boolean;
1988
- screenDisable: boolean;
1989
- backgroundMode: boolean;
1990
- accompanyPlaying: boolean;
1991
- }
1992
-
1993
- interface UpdateTracksResult {
1994
- restoreSub?: boolean;
1995
- }
1996
- declare class RemoteStreamInfo extends EventEmitter$1<StreamListener> {
1997
- /**
1998
- * @ignore
1999
- */
2000
- static logName: string;
2001
- protected audioInfo: RemoteMediaTrackInfo;
2002
- protected videoLargeInfo: RemoteMediaTrackInfo;
2003
- protected videoSmallInfo: RemoteMediaTrackInfo;
2004
- protected screenInfo: RemoteMediaTrackInfo;
2005
- protected dataInfo: RemoteMediaTrackInfo;
2006
- protected audioVolume: number;
2007
- protected audioMuted: boolean;
2008
- protected userStatus?: DeviceStatus;
2009
- constructor();
2010
- /**
2011
- * 远端流音频轨道信息
2012
- * @returns
2013
- */
2014
- getAudioInfo(): RemoteMediaTrackInfo;
2015
- /**
2016
- * 远端流视频轨道信息
2017
- * @returns
2018
- */
2019
- getVideoSmallInfo(): RemoteMediaTrackInfo;
2020
- /**
2021
- * 远端流视频轨道信息
2022
- * @returns
2023
- */
2024
- getVideoLargeInfo(): RemoteMediaTrackInfo;
2025
- /**
2026
- * 远端流屏幕共享轨道信息
2027
- * @returns
2028
- */
2029
- getScreenInfo(): RemoteMediaTrackInfo;
2030
- getDataInfo(): RemoteMediaTrackInfo;
2031
- get subscribingInfos(): RemoteMediaTrackInfo[];
2032
- get hasTrack(): boolean;
2033
- /**
2034
- * 远端流是否包含音频轨道
2035
- * @returns
2036
- */
2037
- get hasAudio(): boolean;
2038
- /**
2039
- * 远端流是否包含视频轨道
2040
- * @returns
2041
- */
2042
- get hasVideo(): boolean;
2043
- /**
2044
- * 远端流是否包含视频大流轨道
2045
- * @returns
2046
- */
2047
- get hasVideoLarge(): boolean;
2048
- /**
2049
- * 远端流是否包含视频小流轨道
2050
- * @returns
2051
- */
2052
- get hasVideoSmall(): boolean;
2053
- /**
2054
- * 远端流是否包含屏幕共享轨道
2055
- * @returns
2056
- */
2057
- get hasScreen(): boolean;
2058
- get hasData(): boolean;
2059
- /**
2060
- * 是否订阅远端流音频轨道
2061
- * @returns
2062
- */
2063
- get isAudioSubscribed(): boolean;
2064
- get isAudioSubscribing(): boolean;
2065
- /**
2066
- * 是否订阅远端流视频轨道
2067
- * @returns
2068
- */
2069
- get isVideoSubscribed(): boolean;
2070
- get isVideoSubscribing(): boolean;
2071
- /**
2072
- * 是否订阅远端流视频大流轨道
2073
- * @returns
2074
- */
2075
- get isVideoLargeSubscribed(): boolean;
2076
- get isVideoLargeSubscribing(): boolean;
2077
- /**
2078
- * 是否订阅远端流视频小流轨道
2079
- * @returns
2080
- */
2081
- get isVideoSmallSubscribed(): boolean;
2082
- get isVideoSmallSubscribing(): boolean;
2083
- /**
2084
- * 是否订阅远端流屏幕共享轨道
2085
- * @returns
2086
- */
2087
- get isScreenSubscribed(): boolean;
2088
- get isScreenSubscribing(): boolean;
2089
- get isDataSubscribed(): boolean;
2090
- get isDataSubscribing(): boolean;
2091
- get audioCodec(): CodecType;
2092
- get videoCodec(): CodecType;
2093
- get audioTrackInfo(): AliRtcAudioTrack;
2094
- get videoTrackInfo(): AliRtcVideoTrack;
2095
- updateTracks(tracks?: TrackInfo[]): UpdateTracksResult;
2096
- protected updateRemoteTrackSsrc(audioSsrc: string, videoLargeSsrc: string, videoSmallSsrc: string, screenSsrc: string, dataSsrc: string): void;
2097
- markRemoteTrackSubscribing(option: SubscribeOptions): any;
2098
- updateRemoteTrackSubState(option: SubscribeOptions): any;
2099
- /**
2100
- * 更新远端用户设备状态
2101
- * @param status
2102
- * @returns {boolean} 状态改变返回true,否则返回false
2103
- */
2104
- updateRemoteUserDeviceStatus(status: string): boolean;
2105
- }
2106
-
2107
- type AliRtcLocalView = string | HTMLVideoElement | string[] | HTMLVideoElement[] | null;
2108
-
2109
- interface AliRtcRemoteAudioStats {
2110
- uid: string;
2111
- track: AliRtcAudioTrack;
2112
- stats: any;
2113
- }
2114
-
2115
- interface AliRtcRemoteVideoStats {
2116
- uid: string;
2117
- track: AliRtcVideoTrack;
2118
- streamType?: AliRtcVideoStreamType;
2119
- stats: any;
2120
- }
2121
-
2122
- declare class AliRtcRemoteUserInfo {
2123
- private remoteUser;
2124
- constructor(remoteUser: RemoteUser);
2125
- get userId(): string;
2126
- get displayName(): string;
2127
- get isMuteAudioPlaying(): boolean;
2128
- get hasAudio(): boolean;
2129
- get hasCamera(): boolean;
2130
- get hasCameraLarge(): boolean;
2131
- get hasCameraSmall(): boolean;
2132
- get hasScreenShare(): boolean;
2133
- get isAudioSubscribing(): boolean;
2134
- get isVideoSubscribing(): boolean;
2135
- get isVideoLargeSubscribing(): boolean;
2136
- get isVideoSmallSubscribing(): boolean;
2137
- get isScreenSubscribing(): boolean;
2138
- get audioElement(): HTMLAudioElement | undefined;
2139
- }
2140
-
2141
- interface RemoteUserViewMap {
2142
- cameraViews: HTMLVideoElement[];
2143
- screenViews: HTMLVideoElement[];
2144
- }
2145
- declare class RemoteUser extends User {
2146
- /**
2147
- * @ignore
2148
- */
2149
- static logName: string;
2150
- remoteCallid: string;
2151
- remoteUserInfo: AliRtcRemoteUserInfo;
2152
- protected localUser?: LocalUser;
2153
- protected lastPubId: string;
2154
- protected stream?: RemoteStream;
2155
- protected screenStream?: RemoteStream;
2156
- private viewMap;
2157
- private audioTrack?;
2158
- private audioElement?;
2159
- protected subscribed: boolean;
2160
- protected mediaStream?: MediaStream;
2161
- protected secondaryMediaStream?: MediaStream;
2162
- protected prevSubConfig?: SubConfig;
2163
- protected signalingManager: SignalingManager;
2164
- protected slsReporter: SLSReporter;
2165
- private wantSubAudio;
2166
- private wantSubVideo;
2167
- private wantSubScreen;
2168
- private defaultVideoStreamType;
2169
- private audioMuted;
2170
- private playoutVolume;
2171
- private playoutGainNode?;
2172
- private audioSubState;
2173
- private videoSubState;
2174
- private videoLargeSubState;
2175
- private videoSmallSubState;
2176
- private screenSubState;
2177
- private dataSubState;
2178
- private dc;
2179
- private dcMsgWaitingPieces;
2180
- streamInfo: RemoteStreamInfo;
2181
- private _streamUrl;
2182
- private parameter;
2183
- private monitorTimerId?;
2184
- private monitorDataCache;
2185
- private trackTraceIdMap;
2186
- constructor(config: RemoteUserConfig);
2187
- get streamUrl(): string;
2188
- set streamUrl(value: string);
2189
- isWantSubAudio(): boolean;
2190
- setWantSubAudio(value: boolean): void;
2191
- isWantSubVideo(): boolean;
2192
- setWantSubVideo(value: boolean): void;
2193
- isWantSubScreen(): boolean;
2194
- setWantSubScreen(value: boolean): void;
2195
- setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
2196
- setAudioMuted(value: boolean): void;
2197
- getAudioElement(): HTMLAudioElement | undefined;
2198
- private handleAudioContextSuspended;
2199
- setPlayoutVolume(value: number): void;
2200
- getAudioMuted(): boolean;
2201
- get hasAudioTrack(): boolean;
2202
- get hasVideoTrack(): boolean;
2203
- get hasVideoLargeTrack(): boolean;
2204
- get hasVideoSmallTrack(): boolean;
2205
- get hasScreenTrack(): boolean;
2206
- get isAudioSubscribing(): boolean;
2207
- get isVideoSubscribing(): boolean;
2208
- get isVideoLargeSubscribing(): boolean;
2209
- get isVideoSmallSubscribing(): boolean;
2210
- get isScreenSubscribing(): boolean;
2211
- get isDataSubscribing(): boolean;
2212
- get audioEnabled(): boolean;
2213
- get videoEnabled(): boolean;
2214
- get screenEnabled(): boolean;
2215
- get getAudioTrack(): MediaStreamAudioTrack | undefined;
2216
- get getCameraStream(): RemoteStream | undefined;
2217
- get getScreenStream(): RemoteStream | undefined;
2218
- setViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2219
- /**
2220
- * 销毁
2221
- * @returns {Promise<void>}
2222
- */
2223
- clear(needStopSub?: boolean): Promise<void>;
2224
- /**
2225
- * 更新远端用户的设备状态
2226
- * @param {string} status
2227
- * @returns {void}
2228
- */
2229
- updateRemoteUserDeviceStatus(status: string): void;
2230
- /**
2231
- * 更新远端用户的推流状态,已经停止推流的 tracks 要 delete,或者整体 stop
2232
- * @param {string} callid
2233
- * @param {string} pullStreamUrl
2234
- * @param {TrackInfo[]} tracks
2235
- * @returns {Promise<TrackChangeState>}
2236
- */
2237
- updateRemoteTracks(callid: string, pullStreamUrl: string, _pubid: string, tracks?: TrackInfo[]): Promise<UpdateTracksResult>;
2238
- /**
2239
- * 订阅远端流
2240
- * @param {SubscribeOptions} options
2241
- * @returns {Promise<void>} 返回可播放的 MediaStream,可能为空。如果同时订阅了主流和辅流,只会返回主流对应的 MediaStream
2242
- */
2243
- subscribe(options?: SubscribeOptions, reason?: SubscribeReason, startTs?: number): Promise<void>;
2244
- /**
2245
- * 订阅远端流
2246
- * @param {SubscribeOptions} options 订阅配置
2247
- * @param {boolean} secondary 是否订阅辅流
2248
- * @returns {Promise<SubscribeResult>}
2249
- */
2250
- private subscribeProxy;
2251
- /**
2252
- * 移除对某些轨道的订阅
2253
- * @param {UnSubscribeOptions} options 取消订阅轨道配置
2254
- * @returns {Promise<SubscribeResult>}
2255
- */
2256
- private subscribeDeleteTracks;
2257
- /**
2258
- * 移除对某些轨道的订阅
2259
- * @param {Partial<ISubConfigItem>} deleteTrack 删除订阅配置
2260
- * @returns {Promise<SubscribeResult>}
2261
- */
2262
- private subscribeDeleteProxy;
2263
- /**
2264
- * 用保存的订阅参数恢复订阅
2265
- */
2266
- restore(): void;
2267
- resumeAudio(): Promise<void>;
2268
- resumeVideo(videoTrack?: AliRtcVideoTrack): Promise<void>;
2269
- resumePlay(): void;
2270
- /**
2271
- * 停止订阅远端流
2272
- * @param {string} userId
2273
- * @param {UnSubscribeOptions} options
2274
- * @returns {Promise<void>}
2275
- */
2276
- stopSubscribe(options?: UnSubscribeOptions): Promise<void>;
2277
- /**
2278
- * 停止对某个拉流 URL 的订阅
2279
- * @param {url} pullStreamUrl
2280
- * @returns {Promise<SubscribeResult>}
2281
- */
2282
- private doStopSubscribe;
2283
- private updateStream;
2284
- private updateScreenStream;
2285
- private clearStream;
2286
- private clearScreenStream;
2287
- private onDataChannelMessage;
2288
- private onDataChannelError;
2289
- private dataChannelConnected;
2290
- private subscribeDataChannel;
2291
- private subscribeStopDataChannel;
2292
- getRetryOptions(): RemoteSubscribeOptions | undefined;
2293
- /**
2294
- * 尝试更新订阅
2295
- * 1. 需要新增订阅的情况:想要订阅 & 没有正在订阅 & 远端有流
2296
- */
2297
- updateSubscribe(reason: SubscribeReason): {
2298
- addOption: SubscribeOptions;
2299
- deleteOption: SubscribeOptions;
2300
- };
2301
- private handleAutoPlayFailed;
2302
- private handleAudioPaused;
2303
- private handleVideoPlayFailded;
2304
- private playAudio;
2305
- stopPlayAudio(): void;
2306
- playAll(isScreen?: boolean, isReplace?: boolean): void;
2307
- /**
2308
- * 播放
2309
- */
2310
- private play;
2311
- stopPlayAll(isScreen?: boolean): void;
2312
- /**
2313
- * 是否开启声音
2314
- * @param {boolean} enable
2315
- * @returns {void}
2316
- */
2317
- toggleAudio(enable?: boolean): void;
2318
- /**
2319
- * 是否开启画面
2320
- * @param {boolean} enable
2321
- * @returns {void}
2322
- */
2323
- toggleVideo(enable?: boolean): void;
2324
- /**
2325
- * 是否开启画面
2326
- * @param {boolean} enable
2327
- * @returns {void}
2328
- */
2329
- toggleScreen(enable?: boolean): void;
2330
- getStats(): Promise<{
2331
- audio: AliRtcRemoteAudioStats[];
2332
- video: AliRtcRemoteVideoStats[];
2333
- }>;
2334
- /**
2335
- * 开启音量检测
2336
- * @param {number} interval 时间间隔
2337
- */
2338
- enableAudioVolumeIndication(interval: number): void;
2339
- private reportSubscribeMonitor;
2340
- private startStreamMonitor;
2341
- /**
2342
- * 停止本地流数据采集
2343
- */
2344
- private stopStreamMonitor;
2345
- }
2346
-
2347
- interface RemoteSubscribeOptions {
2348
- remoteUser: RemoteUser;
2349
- options: SubscribeOptions;
2350
- }
2351
- declare enum RtsPeerConnectionType {
2352
- PUBLISH = "publish",
2353
- SUBSCRIBE = "subscribe"
2354
- }
2355
- interface RtsManagerEventListener {
2356
- reconnecting: (type: RtsPeerConnectionType) => {};
2357
- disconnected: () => {};
2358
- connected: (isReconnected: boolean, type: RtsPeerConnectionType) => {};
2359
- subscribeexceeds: () => {};
2360
- seimessage: (url: string, payloadType: number, data: ArrayBuffer) => {};
2361
- }
2362
- declare class RtsManager extends EventEmitter$1<RtsManagerEventListener> {
2363
- /**
2364
- * @ignore
2365
- */
2366
- static logName: string;
2367
- private rts;
2368
- private encodedInsertableStreams;
2369
- private audioRedEnabled;
2370
- private localStreamManager;
2371
- private slsReporter;
2372
- private _rtsPeerConnectionType;
2373
- private connecting;
2374
- private connected;
2375
- private rtsDisconnected;
2376
- private _pcTraceId;
2377
- private _localJoinTime;
2378
- private connectionResolve?;
2379
- private connectingPromise?;
2380
- private dcResolve?;
2381
- private dcReject?;
2382
- private dcConnectingPromise?;
2383
- private _publishingTracks;
2384
- private parameter;
2385
- preferredPubL1Ip?: string;
2386
- preferredSubL1Ip?: string;
2387
- constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, parameter: Parameter);
2388
- private addRTSListener;
2389
- /**
2390
- * 更新鉴权信息,传入一个新的带鉴权的 URL,RTS 会去除鉴权信息做更新
2391
- * @param newUrlWithAuth
2392
- */
2393
- updateAuth(newUrlWithAuth: string): void;
2394
- get pcTraceId(): string;
2395
- set localJoinTime(time: number);
2396
- setEncodedInsertableStreams(enable: boolean): void;
2397
- setReceiverPreferredVideoCodecH265(): void;
2398
- setSenderPreferredVideoCodecH265(): void;
2399
- supportVideoCodec(codec: CodecType): boolean | undefined;
2400
- changeVideoCodec(codec: CodecType): void;
2401
- setAudioRedEnabled(enable: boolean): void;
2402
- clear(): void;
2403
- private startConnect;
2404
- private setConnected;
2405
- get isConnecting(): boolean;
2406
- get isConnected(): boolean;
2407
- get publishingTracks(): TrackInfo[];
2408
- private getPubMsid;
2409
- private updatePublishingTracks;
2410
- private httpPublish;
2411
- waitPublishSender(streamUrl: string, isAudio?: boolean, msid?: string): Promise<any>;
2412
- getPublishVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
2413
- getPublishAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
2414
- publishAdd(streamUrl: string, stream: LocalStream, callId: string, extra?: PublishExtraParams, isResume?: boolean, waitSender?: boolean, reason?: PublishReason): Promise<string>;
2415
- publishDelete(streamUrl: string, options: PublishOptions): Promise<string>;
2416
- publishReplace(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams): Promise<string>;
2417
- publishStop(streamUrl: string): Promise<string>;
2418
- publishAddDataChannel(streamUrl: string): Promise<any>;
2419
- publishStopDataChannel(streamUrl: string, datachannel: any): Promise<void>;
2420
- unpublish(): Promise<void>;
2421
- /**
2422
- * 获取 sub/subAdd config
2423
- * @param {ISubscribeConfig | ISubConfigItem} options
2424
- * @returns {Omit<ISignalConfig | ISubConfigItem, 'url'>}
2425
- */
2426
- private getSubConfig;
2427
- private handleHTTPConfig;
2428
- private httpSubscribe;
2429
- private subscribeAdd;
2430
- subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<ISubDeleteResult | undefined>;
2431
- subscribeStop(streamUrl: string): Promise<void>;
2432
- subscribeAddDataChannel(streamUrl: string): Promise<any>;
2433
- subscribeStopDatachannel(streamUrl: string, datachannel: any): Promise<any>;
2434
- publish(streamUrl: string, callId: string, isResume?: boolean, reason?: PublishReason): Promise<{
2435
- traceId: string;
2436
- l1ip?: string;
2437
- }>;
2438
- private reportSubscribeLatency;
2439
- subscribe(remoteSubscribeOptions: RemoteSubscribeOptions, reason: SubscribeReason, callId: string, remoteCallId: string, startTs: number): Promise<any>;
2440
- getSubscribeVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
2441
- getSubscribeAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
2442
- getStreamByMsid(config: any): LocalStream | RemoteStream;
2443
- getDatachannelByMsid(config: {
2444
- url: string;
2445
- msid?: string;
2446
- }): any;
2447
- getPCStats(): Promise<any>;
2448
- sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
2449
- }
2450
-
2451
- declare class User extends EventEmitter$1<UserListener> {
2452
- protected uid: string;
2453
- protected name: string;
2454
- protected rtsManager: RtsManager;
2455
- callId: string;
2456
- protected audioLevelMonitor: AudioLevelMonitor;
2457
- protected audioVolumeIndicationInterval: number;
2458
- constructor(userId: string, displayname: string, rtsManager: RtsManager, interval: number);
2459
- get userId(): string;
2460
- get displayname(): string;
2461
- protected createCallId(): void;
2462
- setUserInfo(uid: string, displayName: string): void;
2463
- refreshUserInfo(uid: string): void;
2464
- /**
2465
- * 获取音频 level
2466
- */
2467
- getAudioLevel(): number;
2468
- enableAudioVolumeIndication(interval: number): void;
2469
- /**
2470
- * 销毁用户,清空数据
2471
- */
2472
- clear(): void;
2473
- }
2474
-
2475
- interface AliRtcLocalAudioStats {
2476
- track: AliRtcAudioTrack;
2477
- stats: any;
2478
- }
2479
-
2480
- interface AliRtcLocalVideoStats {
2481
- track: AliRtcVideoTrack;
2482
- streamType?: AliRtcVideoStreamType;
2483
- stats: any;
2484
- }
2485
-
2486
- declare enum AliRtcDataMsgType {
2487
- AliEngineDataMsgNone = 0,
2488
- AliEngineDataMsgMusicProgress = 1,
2489
- AliEngineDataMsgCustom = 2
2490
- }
2491
- declare class AliRtcDataChannelMsg {
2492
- data: ArrayBuffer;
2493
- networkTime: number;
2494
- futureOrProgress: number;
2495
- type: AliRtcDataMsgType;
2496
- constructor(data: ArrayBuffer, type?: AliRtcDataMsgType, networkTime?: number, progress?: number);
2497
- toBuffer(): ArrayBuffer;
2498
- static parse(buffer: ArrayBuffer): AliRtcDataChannelMsg | undefined;
2499
- }
2500
-
2501
- interface AliEngineCameraCapturerConfiguration {
2502
- width?: number;
2503
- height?: number;
2504
- frameRate?: number;
2505
- maxSendFrameRate?: number;
2506
- bitrate?: number;
2507
- cameraDirection?: AliRtcCameraDirection;
2508
- deviceId?: string;
2509
- }
2510
- type VideoProfileWithSendFramerate = Partial<IProfile & {
2511
- maxSendFrameRate: number;
2512
- }>;
2513
-
2514
- declare class LocalUser extends User {
2515
- /**
2516
- * @ignore
2517
- */
2518
- static logName: string;
2519
- private _url;
2520
- private joinTime;
2521
- private publishPromise;
2522
- private previewElements;
2523
- private screenPreviewElements;
2524
- private streamManager;
2525
- private dc;
2526
- protected streamTracks?: TrackInfo[];
2527
- protected publishId: string;
2528
- protected signalingManager: SignalingManager;
2529
- private shouldPublish;
2530
- traceId: string;
2531
- private monitorTimerId?;
2532
- private monitorDataCache;
2533
- private trackTraceIdMap;
2534
- private candidateDataCache;
2535
- private pcMediaStatsMap;
2536
- protected slsReporter: SLSReporter;
2537
- private audioPubState;
2538
- private videoPubState;
2539
- private videoSmallPubState;
2540
- private screenPubState;
2541
- private dataPubState;
2542
- private parameter;
2543
- constructor(config: LocalUserConfig);
2544
- get url(): string;
2545
- set url(value: string);
2546
- get joined(): boolean;
2547
- get isPublishing(): boolean;
2548
- get publishStreams(): PublishStreamInfo;
2549
- get cameraTrack(): MediaStreamTrack | undefined;
2550
- get screenTrack(): MediaStreamTrack | undefined;
2551
- get audioTrack(): MediaStreamTrack | undefined;
2552
- get hasCamera(): boolean;
2553
- get hasMicrophone(): boolean;
2554
- get hasScreenShare(): boolean;
2555
- get hasCameraTrackInMS(): boolean;
2556
- get hasCameraDualTrackInMS(): boolean;
2557
- get hasScreenTrackInMS(): boolean;
2558
- get hasAudioTrackInMS(): boolean;
2559
- get cameraDirection(): string | undefined;
2560
- get audioCaptureDisabled(): boolean;
2561
- get cameraCaptureDisabled(): boolean;
2562
- get publishLocalVideoStreamEnabled(): boolean;
2563
- get publishLocalAudioStreamEnabled(): boolean;
2564
- get publishLocalScreenStreamEnabled(): boolean;
2565
- setPublishLocalAudioStreamEnabled(enable: boolean): void;
2566
- setPublishLocalVideoStreamEnabled(enable: boolean): void;
2567
- setPublishLocalScreenStreamEnabled(enable: boolean): void;
2568
- initInfo(authInfo: AliRtcAuthInfo, pushStreamUrl: string): void;
2569
- setVideoProfile(profile?: VideoProfileWithSendFramerate): Promise<void>;
2570
- setVideoContentHint(hint: string): void;
2571
- setScreenContentHint(hint: string): void;
2572
- setAudioProfile(profileKey: AudioProfileKey): Promise<void>;
2573
- setScreenProfile(profile?: Partial<IProfile>): Promise<void>;
2574
- setCameraDirection(direction: AliRtcCameraDirection): void;
2575
- setCameraDeviceId(deviceId: string): void;
2576
- muteLocalCamera(mute: boolean): void;
2577
- muteLocalMic(mute: boolean): void;
2578
- muteLocalScreen(mute: boolean): void;
2579
- setMicrophoneDeviceId(deviceId: string): void;
2580
- setMicrophoneConstraints(constraints: MediaTrackConstraints): void;
2581
- updatePubId(): void;
2582
- clearPublishState(): void;
2583
- leave(): Promise<void>;
2584
- /**
2585
- * 销毁,停止推流
2586
- * @returns {Promise<void>}
2587
- */
2588
- clear(): Promise<void>;
2589
- resetElement(element: HTMLVideoElement): void;
2590
- setPreviewElement(previewParams: PreviewConfig): void;
2591
- startDefaultCameraAndMic(audioOnly?: boolean): Promise<void>;
2592
- /**
2593
- * 为本地预览设置渲染元素和视频流
2594
- * @param {AliRtcLocalView} view 渲染元素,null 则为停止显示
2595
- * @param {AliRtcVideoTrack} track 视频流类型
2596
- */
2597
- setViewConfig(elements: null | HTMLVideoElement[], track: AliRtcVideoTrack): void;
2598
- /**
2599
- * 开启摄像头采集
2600
- * @param params
2601
- * @returns
2602
- */
2603
- startCameraCapture(): Promise<LocalStream | undefined>;
2604
- /**
2605
- * 关闭摄像头采集
2606
- * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
2607
- */
2608
- stopCameraCapture(): Promise<void>;
2609
- /**
2610
- * 开启麦克风采集
2611
- * @param params
2612
- * @returns
2613
- */
2614
- startAudioCapture(): Promise<LocalStream | undefined>;
2615
- /**
2616
- * 关闭音频采集
2617
- * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
2618
- */
2619
- stopAudioCapture(): Promise<void>;
2620
- startCameraAndMic(): Promise<LocalStream | undefined>;
2621
- /**
2622
- * 预览本地流
2623
- * @param {PreviewConfig} previewParams
2624
- * @returns {Promise<MediaStream>}
2625
- */
2626
- preview(previewParams: PreviewConfig): Promise<MediaStream | undefined>;
2627
- /**
2628
- * 在所有预览容器中预览当前流
2629
- * @param {boolean} screen 是否指定预览辅流
2630
- */
2631
- previewAll(previewAllParams?: PreviewAllConfig): Promise<void>;
2632
- /**
2633
- * 停止预览本地流
2634
- */
2635
- stopPreview(previewParams?: StopPreviewConfig): void;
2636
- /**
2637
- * 恢复推流
2638
- * @returns {Promise<void>}
2639
- */
2640
- resumePublish(): Promise<void>;
2641
- createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
2642
- stopLocalStream(options: PublishOptions): Promise<void>;
2643
- private compareAndPublish;
2644
- private reportAudioProfile;
2645
- private reportVideoProfile;
2646
- private reportScreenProfile;
2647
- private updateDataChannel;
2648
- private publishDataChannel;
2649
- /**
2650
- * 开始推流
2651
- * @param isResume 是否是恢复推流
2652
- * @returns
2653
- */
2654
- startPublish(isResume?: boolean, reason?: PublishReason): Promise<void>;
2655
- /**
2656
- * 重新执行 progress 并触发 publishupdate
2657
- */
2658
- updateStreams(): Promise<void>;
2659
- /**
2660
- * 对比本地流和正在推流,进行推流更新
2661
- * @param isResume 是否是恢复推流
2662
- */
2663
- publishUpdate(reason?: PublishReason): Promise<PublishInfo | undefined>;
2664
- private syncPublishToRoomServer;
2665
- private refreshPushStreamUrl;
2666
- /**
2667
- * 推流,用于 rts subscribe/publish 被调用后,此时 DataChannel 已存在
2668
- * @param {LocalStream} stream
2669
- * @returns {Promise<PublishInfo>}
2670
- */
2671
- publishAdd(stream: LocalStream, extra: PublishExtraParams, isResume?: boolean, retryTimes?: number): Promise<PublishInfo>;
2672
- /**
2673
- * 替换推流 Track(仅限于替换已存在的 Track 类型)
2674
- * @param {LocalStream} stream
2675
- * @returns {Promise<PublishInfo>}
2676
- */
2677
- publishReplace(stream: LocalStream, extra?: PublishExtraParams): Promise<PublishInfo>;
2678
- /**
2679
- * 停止推某些轨,不销毁 DataChannel 和 LocalStream,用于非销毁场景
2680
- * @param {PublishOptions} options
2681
- * @returns {Promise<PublishInfo>}
2682
- */
2683
- publishDeleteTracks(options: PublishOptions): Promise<PublishInfo>;
2684
- /**
2685
- * 停止推流,不销毁 LocalStream,用于非销毁场景
2686
- * @returns {Promise<PublishInfo>}
2687
- */
2688
- publishStop(): Promise<PublishInfo>;
2689
- /**
2690
- * 停止推流,销毁 DataChannel,用于销毁的场景
2691
- * @returns {Promise<PublishInfo>}
2692
- */
2693
- unPublish(): Promise<PublishInfo>;
2694
- /**
2695
- * 事件通知本地的设备使用状态
2696
- */
2697
- reportSelfDeviceStatus(): void;
2698
- /**
2699
- * 从localStream 中获取当前的设备状态
2700
- * @returns {string}
2701
- */
2702
- private getDeviceStatus;
2703
- private onTrackEnd;
2704
- private resetPreviewElements;
2705
- private resetSecondayPreviewElements;
2706
- getMediaStats(id: string): any;
2707
- private reportPublishMonitor;
2708
- private reportNetwork;
2709
- private startStreamMonitor;
2710
- /**
2711
- * 停止本地流数据采集
2712
- */
2713
- private stopStreamMonitor;
2714
- /**
2715
- * 清除本地流
2716
- * @returns {void}
2717
- */
2718
- clearStream(): void;
2719
- /**
2720
- * 获取当前使用的摄像头 deviceId
2721
- * @returns {string | undefined}
2722
- */
2723
- getCurrentCameraDeviceId(): string | undefined;
2724
- /**
2725
- * 获取当前使用的摄像头 deviceId
2726
- * @returns {string | undefined}
2727
- */
2728
- getCurrentMicDeviceId(): string | undefined;
2729
- enableAudioVolumeIndication(interval: number): void;
2730
- sendSEI(message: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
2731
- sendDataChannelMessage(message: AliRtcDataChannelMsg): void;
2732
- getStats(): Promise<{
2733
- audio: AliRtcLocalAudioStats[];
2734
- video: AliRtcLocalVideoStats[];
2735
- candidate: any;
2736
- }>;
2737
- }
2738
-
2739
- interface AudioMixerPluginOptions {
2740
- audio?: number;
2741
- screen?: number;
2742
- }
2743
-
2744
- type AliRtcDualVideoPluginOptions = VideoScalerOptions;
2745
-
2746
- declare enum AliRtcCapabilityProfile {
2747
- Default = 0,
2748
- Human = 1,
2749
- Robot = 2
2750
- }
2751
- type AliRtcChannelParam = {
2752
- userName?: string;
2753
- capabilityProfile?: AliRtcCapabilityProfile;
2754
- };
2755
-
2756
- interface RemoteUserMap {
2757
- [userId: string]: RemoteUser;
2758
- }
2759
- declare class BizControl extends EventEmitter$1<BizControlListener> {
2760
- /**
2761
- * @ignore
2762
- */
2763
- static logName: string;
2764
- protected self: LocalUser;
2765
- protected userMap: RemoteUserMap;
2766
- private usersViewMap;
2767
- rtsManager: RtsManager;
2768
- protected localStreamManager: LocalStreamManager;
2769
- protected authInfo?: AliRtcAuthInfo;
2770
- protected signalingManager: SignalingManager;
2771
- pluginManager: PluginManager;
2772
- private audioMixerPlugin?;
2773
- private dualVideoPlugin?;
2774
- private blankAudioPlugin?;
2775
- private audioProcessorPlugin?;
2776
- protected slsReporter: SLSReporter;
2777
- private statsMonitorId?;
2778
- private autoSubAudio;
2779
- private autoSubVideo;
2780
- private autoSubScreen;
2781
- private wantSubAudio;
2782
- private wantSubVideo;
2783
- private wantSubScreen;
2784
- private defaultStreamType;
2785
- private audioMuted;
2786
- private playoutVolume;
2787
- private refreshUrlTimer?;
2788
- private audioVolumeIndicationInterval;
2789
- private indicationTimer;
2790
- private parameter;
2791
- private audio3AConfig;
2792
- private dcReadyHelper?;
2793
- constructor(config: BizControlConfig);
2794
- private addSignalingManagerListener;
2795
- isAutoSubAudio(): boolean;
2796
- setAutoSubAudio(value: boolean): void;
2797
- isAutoSubVideo(): boolean;
2798
- setAutoSubVideo(value: boolean): void;
2799
- isAutoSubScreen(): boolean;
2800
- setAutoSubScreen(value: boolean): void;
2801
- isWantSubAudio(): boolean;
2802
- setWantSubAudio(value: boolean): void;
2803
- isWantSubVideo(): boolean;
2804
- setWantSubVideo(value: boolean): void;
2805
- isWantSubScreen(): boolean;
2806
- setWantSubScreen(value: boolean): void;
2807
- setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
2808
- setRemoteUserVideoStreamType(userId: string, type: AliRtcVideoStreamType): void;
2809
- setAudioMuted(mute: boolean): void;
2810
- setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2811
- setRemoteViewConfig(uid: string, view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2812
- get channel(): string | undefined;
2813
- get userId(): string | undefined;
2814
- get remoteUsers(): RemoteUser[];
2815
- /**
2816
- * 获取推流对象,只能是自己
2817
- */
2818
- get publisher(): LocalUser | undefined;
2819
- get isSubscribing(): boolean;
2820
- /**
2821
- * 处理远端用户推流状态变化
2822
- * @param {string} userId
2823
- * @param {string} displayname
2824
- * @param {string} callid
2825
- * @param {string} pullStreamUrl
2826
- * @param {TrackInfo[]} tracks
2827
- * @returns {void}
2828
- */
2829
- onRemotePublishStateChange(publishInfo: PublishUser, updateSubscribe?: boolean): void;
2830
- /** 定期更新所有人的推拉流地址,便于重连
2831
- * @param pushStreamUrl 已有的推流地址,根据地址中的过期时间来设置定时器
2832
- * @private
2833
- */
2834
- private setTimeoutToUpdateAllStreamUrls;
2835
- /**
2836
- * 登陆成功后初始化用户管理,创建自己
2837
- * @param {AliRtcAuthInfo} authInfo
2838
- * @param {JoinResult} data
2839
- * @returns {Promise<void>}
2840
- */
2841
- init(authInfo: AliRtcAuthInfo, data: JoinResult, channelParam: AliRtcChannelParam): void;
2842
- leave(): Promise<void>;
2843
- /**
2844
- * 离会后清除所有数据
2845
- * @returns {Promise<void>}
2846
- */
2847
- clear(): Promise<void>;
2848
- private startStatsMonitor;
2849
- private stopStatsMonitor;
2850
- /**
2851
- * 添加远端用户
2852
- * @param {JoinInfo} userJoinInfo
2853
- * @param {SubscribeReason} reason
2854
- * @returns {void}
2855
- */
2856
- addUser(userJoinInfo: JoinInfo, reason: SubscribeReason): RemoteUser;
2857
- /**
2858
- * 执行添加远端用户
2859
- * @param {string} userId
2860
- * @param {string} displayName
2861
- * @returns {RemoteUser}
2862
- */
2863
- private executeAddUser;
2864
- /**
2865
- * 远端用户设备状态变化
2866
- * @param {DeviceStatusChangeType} event
2867
- * @param {string} userId
2868
- */
2869
- private onRemoteDeviceStatusChange;
2870
- /**
2871
- * 远端流数据采集上报
2872
- * @param {any} stat
2873
- */
2874
- private onRemoteStatReport;
2875
- /**
2876
- * rts 单 PC 订阅超限
2877
- */
2878
- private onSubscribeExceeds;
2879
- /**
2880
- * 移除远端用户
2881
- * @param {LeaveInfo} user
2882
- * @returns {Promise<void>}
2883
- */
2884
- removeLeftUser(user: LeaveInfo): Promise<void>;
2885
- /**
2886
- * 更新远端用户数据
2887
- * @param {JoinInfo[]} users
2888
- * @returns {{joinList: JoinInfo[], leaveList: LeaveInfo[], presentList: JoinInfo[]}}
2889
- */
2890
- diffUsers(users: JoinInfo[]): {
2891
- joinList: JoinInfo[];
2892
- leaveList: LeaveInfo[];
2893
- presentList: JoinInfo[];
2894
- };
2895
- /**
2896
- * 根据 userId 获取 RemoteUser
2897
- * @param {string} userId
2898
- * @returns {RemoteUser | undefined}
2899
- */
2900
- getRemoteUser(userId: string): RemoteUser | undefined;
2901
- /**
2902
- * 更新远端用户设备信息
2903
- * @param {RemoteUserStatus} user
2904
- * @returns {boolean} true: 用户状态改变 false: 用户状态没有改变
2905
- */
2906
- updateRemoteUserDeviceStatus(user: RemoteUserStatus): void;
2907
- updateAudioWant(uid: string, sub: boolean): void;
2908
- updateVideoWant(uid: string, sub: boolean): void;
2909
- updateScreenWant(uid: string, sub: boolean): void;
2910
- private stopIndication;
2911
- private startIndication;
2912
- setEnableDualVideoStream(enabled: boolean, options?: AliRtcDualVideoPluginOptions): void;
2913
- setAudioVolume(options: AudioMixerPluginOptions): void;
2914
- enableAudioVolumeIndication(interval: number): void;
2915
- setPlayoutVolume(volume: number): void;
2916
- refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
2917
- setEnableMediaExtensionMsg(enable: boolean): void;
2918
- setAudioRedEnabled(enable: boolean): void;
2919
- setVideoCodec(codec: CodecType): void;
2920
- setParameter(parameter: string): void;
2921
- private setupAudioProcessingPluginIfNeeded;
2922
- getParameter(): string;
2923
- sendDataChannelMessage(message: AliRtcDataChannelMsg): void;
2924
- }
2925
-
2926
- declare enum AliRtcLiveTranscodingMixMode {
2927
- /*! 单路模式 */
2928
- LiveTranscodingSingle = 0,
2929
- /*! 混流模式 */
2930
- LiveTranscodingMix = 1
2931
- }
2932
- declare enum AliRtcLiveTranscodingStreamType {
2933
- /*! 原始流 */
2934
- LiveTranscodingOrigin = 0,
2935
- /*! 音频 */
2936
- LiveTranscodingAudio = 1,
2937
- /*! 视频 */
2938
- LiveTranscodingVideo = 2
2939
- }
2940
- declare enum AliRtcLiveTranscodingSourceType {
2941
- /*! 相机流 */
2942
- LiveTranscodingCamera = 0,
2943
- /*! 屏幕流 */
2944
- LiveTranscodingShareScreen = 1
2945
- }
2946
- declare enum AliRtcLiveTranscodingTaskProfile {
2947
- LiveTranscoding_Profile_1IN_1080P = 0,
2948
- LiveTranscoding_Profile_1IN_720P = 1,
2949
- LiveTranscoding_Profile_1IN_360P = 2,
2950
- LiveTranscoding_Profile_2IN_1080P = 3,
2951
- LiveTranscoding_Profile_2IN_720P = 4,
2952
- LiveTranscoding_Profile_2IN_360P = 5,
2953
- LiveTranscoding_Profile_4IN_1080P = 6,
2954
- LiveTranscoding_Profile_4IN_720P = 7,
2955
- LiveTranscoding_Profile_4IN_360P = 8,
2956
- LiveTranscoding_Profile_9IN_1080P = 9,
2957
- LiveTranscoding_Profile_9IN_720P = 10,
2958
- LiveTranscoding_Profile_9IN_360P = 11,
2959
- LiveTranscoding_Profile_12IN_1080P = 12,
2960
- LiveTranscoding_Profile_12IN_720P = 13,
2961
- LiveTranscoding_Profile_12IN_360P = 14,
2962
- LiveTranscoding_Profile_16IN_1080P = 15,
2963
- LiveTranscoding_Profile_16IN_720P = 16,
2964
- LiveTranscoding_Profile_16IN_360P = 17,
2965
- LiveTranscoding_Profile_Mixed = 9999
2966
- }
2967
- declare enum AliRtcLiveTranscodingAudioSampleRate {
2968
- LiveTranscoding_HZ_48000 = 48000,
2969
- LiveTranscoding_HZ_44100 = 44100,
2970
- LiveTranscoding_HZ_32000 = 32000,
2971
- LiveTranscoding_HZ_16000 = 16000,
2972
- LiveTranscoding_HZ_8000 = 8000
2973
- }
2974
- declare enum AliRtcLiveTranscodingSegmentType {
2975
- /*! 无人像分割 */
2976
- LiveTranscodingNoBody = 0,
2977
- /*! 人像分割 */
2978
- LiveTranscodingBody = 1
2979
- }
2980
- declare enum AliRtcLiveTranscodingFontType {
2981
- NOTO_SERIF_CJKSC_REGULAR = 0,
2982
- ALIBABA_PUHUITI_REGULAR = 1,
2983
- ALIBABA_PUHUITI_BOLD = 2,
2984
- ALIBABA_PUHUITI_Heavy = 3,
2985
- ALIBABA_PUHUITI_LIGHT = 4,
2986
- ALIBABA_PUHUITI_MEDIUM = 5
2987
- }
2988
- declare enum AliRtcLiveTranscodingCropMode {
2989
- /*! 缩放模式 */
2990
- LiveTranscodingOrigin = 0,
2991
- /*! 剪裁 */
2992
- LiveTranscodingCrop = 1,
2993
- /*! 填充 */
2994
- LiveTranscodingFill = 2
2995
- }
2996
- declare enum AliRtcLiveTranscodingMediaProcessMode {
2997
- /*! 通用模式 */
2998
- LiveTranscodingNormal = 0,
2999
- /*! 虚拟背景模式 */
3000
- LiveTranscodingVirtualBackground = 1
3001
- }
3002
- declare enum AliRtcLiveTranscodingState {
3003
- LiveTranscodingState_IDLE = 0,
3004
- LiveTranscodingState_CONNNECT = 1,
3005
- LiveTranscodingState_RUNNING = 2,
3006
- LiveTranscodingState_RECOVERING = 3,
3007
- LiveTranscodingState_FAILURE = 4,
3008
- LiveTranscodingState_END = 5
3009
- }
3010
- declare enum AliRtcLiveTranscodingErrorCode {
3011
- LiveTranscodingErrorPublishOk = 0,
3012
- LiveTranscodingErrorStreamNotFound = 17825793,
3013
- LiveTranscodingErrorStreamAlreadyExist = 17825794,
3014
- LiveTranscodingErrorInvalidParam = 17825795,
3015
- LiveTranscodingErrorInternalError = 17825796,
3016
- LiveTranscodingErrorRtmpServerError = 17825797,
3017
- LiveTranscodingErrorRtmpStreamUrlError = 17825798,
3018
- LiveTranscodingErrorPublishTimeout = 17825799,
3019
- LiveTranscodingErrorNotAuthorized = 17825800
3020
- }
3021
- declare enum AliRtcTrascodingPublishTaskStatus {
3022
- /*! 任务开始 */
3023
- TrascodingPublishTaskStatusStart = 0,
3024
- /*! 任务更新 */
3025
- TrascodingPublishTaskStatusUpdate = 1,
3026
- /*! 任务已停止 */
3027
- TrascodingPublishTaskStatusStop = 2
3028
- }
3029
- declare enum MPU_TASK_TRANSACTION_TYPE {
3030
- MPU_TASK_TRANSACTION_START = 0,
3031
- MPU_TASK_TRANSACTION_UPDATE = 1,
3032
- MPU_TASK_TRANSACTION_STOP = 2,
3033
- MPU_TASK_TRANSACTION_LIST = 3,
3034
- MPU_TASK_TRANSACTION_POLLING = 4,
3035
- MPU_TASK_TRANSACTION_ACKNOWLEDGE = 5,
3036
- MPU_TASK_TRANSACTION_END = 6
3037
- }
3038
-
3039
- declare class AliRtcLiveTranscodingEncodeParam {
3040
- videoWidth: number;
3041
- videoHeight: number;
3042
- videoFramerate: number;
3043
- videoBitrate: number;
3044
- videoGop: number;
3045
- audioSamplerate: AliRtcLiveTranscodingAudioSampleRate;
3046
- audioBitrate: number;
3047
- audioChannels: number;
3048
- constructor(videoWidth: number, videoHeight: number, videoFramerate?: number, videoBitrate?: number, videoGop?: number, audioSamplerate?: AliRtcLiveTranscodingAudioSampleRate, audioBitrate?: number, audioChannels?: number);
3049
- }
3050
-
3051
- declare class AliRtcTranscodingClockWidget {
3052
- x: number;
3053
- y: number;
3054
- fontSize: number;
3055
- zOrder: number;
3056
- fontColor: number;
3057
- fontType: AliRtcLiveTranscodingFontType;
3058
- constructor(x: number, y: number, fontSize: number);
3059
- constructor(x: number, y: number, fontSize: number, zOrder: number);
3060
- constructor(x: number, y: number, fontSize: number, zOrder: number, fontColor: number);
3061
- constructor(x: number, y: number, fontSize: number, zOrder: number, fontColor: number, fontType: AliRtcLiveTranscodingFontType);
3062
- toJson(videoWidth: number, videoHeight: number): {
3063
- x: number;
3064
- y: number;
3065
- fonttype: AliRtcLiveTranscodingFontType;
3066
- fontsize: number;
3067
- fontcolor: number;
3068
- zorder: number;
3069
- };
3070
- }
3071
-
3072
- declare enum DisplayType {
3073
- NOT_DISPLAY = 0,
3074
- ALWAYS = 1,
3075
- WHEN_NO_VIDEO = 2
3076
- }
3077
- declare class AliRtcTranscodingImage {
3078
- static DisplayType: typeof DisplayType;
3079
- url: string;
3080
- x: number;
3081
- y: number;
3082
- width: number;
3083
- height: number;
3084
- alpha: number;
3085
- display: DisplayType;
3086
- zOrder: number;
3087
- constructor(url: string, x: number, y: number, width: number, height: number);
3088
- constructor(url: string, x: number, y: number, width: number, height: number, zOrder: number);
3089
- constructor(url: string, x: number, y: number, width: number, height: number, zOrder: number, alpha: number);
3090
- constructor(url: string, x: number, y: number, width: number, height: number, zOrder: number, alpha: number, display: DisplayType);
3091
- toJson(videoWidth: number, videoHeight: number): {
3092
- url: string;
3093
- alpha: number;
3094
- display: DisplayType;
3095
- x: number;
3096
- y: number;
3097
- width: number;
3098
- height: number;
3099
- zorder: number;
3100
- };
3101
- }
3102
-
3103
- declare class AliRtcTranscodingText {
3104
- text: string;
3105
- x: number;
3106
- y: number;
3107
- fontSize: number;
3108
- zOrder: number;
3109
- fontColor: number;
3110
- fontType: AliRtcLiveTranscodingFontType;
3111
- constructor(text: string, x: number, y: number, fontSize: number);
3112
- constructor(text: string, x: number, y: number, fontSize: number, zOrder: number);
3113
- constructor(text: string, x: number, y: number, fontSize: number, zOrder: number, fontColor: number);
3114
- constructor(text: string, x: number, y: number, fontSize: number, zOrder: number, fontColor: number, fontType: AliRtcLiveTranscodingFontType);
3115
- toJson(videoWidth: number, videoHeight: number): {
3116
- text: string;
3117
- x: number;
3118
- y: number;
3119
- fonttype: AliRtcLiveTranscodingFontType;
3120
- fontsize: number;
3121
- fontcolor: number;
3122
- zorder: number;
3123
- };
3124
- }
3125
-
3126
- declare class AliRtcTranscodingUser {
3127
- userId: string;
3128
- x: number;
3129
- y: number;
3130
- width: number;
3131
- height: number;
3132
- zOrder?: number;
3133
- sourceType?: AliRtcLiveTranscodingSourceType;
3134
- segmentType: AliRtcLiveTranscodingSegmentType;
3135
- images: AliRtcTranscodingImage[];
3136
- texts: AliRtcTranscodingText[];
3137
- constructor(userId: string, x: number, y: number, width: number, height: number);
3138
- constructor(userId: string, x: number, y: number, width: number, height: number, zOrder: number);
3139
- constructor(userId: string, x: number, y: number, width: number, height: number, zOrder: number, sourceType: AliRtcLiveTranscodingSourceType);
3140
- toJson(index: number, videoWidth: number, videoHeight: number, mediaProcessMode?: AliRtcLiveTranscodingMediaProcessMode): {
3141
- [key: string]: any;
3142
- };
3143
- }
3144
-
3145
- declare class LiveTranscodingMixParam {
3146
- taskProfile: AliRtcLiveTranscodingTaskProfile;
3147
- encodeParam?: AliRtcLiveTranscodingEncodeParam;
3148
- users: AliRtcTranscodingUser[];
3149
- backgroundColor: number;
3150
- backgrounds: AliRtcTranscodingImage[];
3151
- watermarks: AliRtcTranscodingImage[];
3152
- clockWidgets: AliRtcTranscodingClockWidget[];
3153
- cropMode?: AliRtcLiveTranscodingCropMode;
3154
- mediaProcessMode?: AliRtcLiveTranscodingMediaProcessMode;
3155
- constructor(taskProfile: AliRtcLiveTranscodingTaskProfile);
3156
- }
3157
-
3158
- declare class AliRtcLiveTranscodingSingleParam {
3159
- userId?: string;
3160
- streamType?: AliRtcLiveTranscodingStreamType;
3161
- sourceType?: AliRtcLiveTranscodingSourceType;
3162
- constructor(uid?: string, streamType?: AliRtcLiveTranscodingStreamType, sourceType?: AliRtcLiveTranscodingSourceType);
3163
- }
3164
-
3165
- declare class AliRtcLiveTranscodingParam {
3166
- /*! 旁路模式 */
3167
- mixMode: AliRtcLiveTranscodingMixMode;
3168
- /*! 路模式单路参数 */
3169
- singleParam?: AliRtcLiveTranscodingSingleParam;
3170
- /*! 旁路模式混流参数 */
3171
- mixParam?: LiveTranscodingMixParam;
3172
- constructor(mixMode?: AliRtcLiveTranscodingMixMode, singleParam?: AliRtcLiveTranscodingSingleParam, mixParam?: LiveTranscodingMixParam);
3173
- toJson(type: MPU_TASK_TRANSACTION_TYPE, authInfo: AliRtcAuthInfo, taskId: string, streamUrl?: string, messageId?: string): {
3174
- [key: string]: any;
3175
- };
3176
- }
3177
-
3178
- declare class AliRtcLiveTranscoding {
3179
- authInfo?: AliRtcAuthInfo;
3180
- private slsReporter;
3181
- constructor(slsReporter: SLSReporter);
3182
- private doRequest;
3183
- setAuthInfo(authInfo: AliRtcAuthInfo): void;
3184
- clear(): void;
3185
- startPublishLiveStream(streamUrl: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
3186
- startPublishLiveStreamWithTaskId(taskId: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
3187
- updatePublishLiveStream(streamUrl: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
3188
- updatePublishLiveStreamWithTaskId(taskId: string, transcodingParam: AliRtcLiveTranscodingParam): Promise<any>;
3189
- stopPublishLiveStream(streamUrl: string): Promise<any>;
3190
- stopPublishLiveStreamWithTaskId(taskId: string): Promise<any>;
3191
- refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
3192
- }
3193
-
3194
- declare enum AliRtcLogLevel {
3195
- DEBUG = 0,
3196
- INFO = 1,
3197
- API = 2,
3198
- WARNING = 3,
3199
- ERROR = 4,
3200
- NONE = 5
3201
- }
3202
-
3203
- interface AliRtcBeautyConfig {
3204
- whiteningLevel: number;
3205
- /*! 磨皮等级[0-1.0] */
3206
- smoothnessLevel: number;
3207
- }
3208
-
3209
- interface AliRtcWebTrackConfig {
3210
- biz: string;
3211
- extraParams?: string;
3212
- }
3213
- interface AliRtcEngineConfig {
3214
- env?: AliRtcEnv;
3215
- webTrack?: boolean | AliRtcWebTrackConfig;
3216
- maxSignalingConnectRetryCount?: number;
3217
- }
3218
- interface AliRtcAIAgentParam {
3219
- /*! ai agent id */
3220
- agentId: string;
3221
- /*! ai agent的区域 */
3222
- region: string;
3223
- /*! 启动ai agent的action */
3224
- action: string;
3225
- /*! 启动ai agent的参数 */
3226
- params: string;
3227
- }
3228
-
3229
- interface AliRtcEngineEventListener {
3230
- /**
3231
- * @brief 网络连接状态改变
3232
- * @param status 连接状态
3233
- * @param reason 连接状态变化原因
3234
- */
3235
- connectionStatusChange: (status: AliRtcConnectionStatus, reason: AliRtcConnectionStatusChangeReason) => void;
3236
- /**
3237
- * @brief 本地设备异常回调
3238
- * @param deviceType 设备类型, 参考{@link AliRtcEngine.AliRtcEngineLocalDeviceType}
3239
- * @param exceptionType 设备异常类型, 参考{@link AliRtcEngine.AliRtcEngineLocalDeviceExceptionType}
3240
- * @param msg 异常时携带的信息
3241
- * @note 此回调标识了内部无法恢复了设备异常,收到此回调时用户需要检查设备是否可用
3242
- */
3243
- localDeviceException: (localDeviceType: AliRtcEngineLocalDeviceType, localDeviceExceptionType: AliRtcEngineLocalDeviceExceptionType, description: string) => void;
3244
- /**
3245
- * @brief 用户鉴权信息即将过期通知,收到后30秒鉴权过期
3246
- * @note 该回调在鉴权信息30秒前触发,收到该回调后应该及时更新鉴权信息,参考 {@link AliRtcEngine.refreshAuthInfo}
3247
- */
3248
- /**
3249
- * 被服务器踢出/会议结束频道的消息
3250
- * @param code 原因参考{@link AliRtcEngine.AliRtcOnByeType}
3251
- */
3252
- bye: (code: AliRtcOnByeType) => void;
3253
- /**
3254
- * @brief 远端用户(通信模式)/(互动模式,主播角色)加入频道回调
3255
- * @details 该回调在以下场景会被触发
3256
- * - 通信模式:远端用户加入频道会触发该回调,如果当前用户在加入频道前已有其他用户在频道中,当前用户加入频道后也会收到已加入频道用户的回调
3257
- * - 互动模式:
3258
- * - 远端主播角色用户加入频道会触发该回调,如果当前用户在加入频道前已有其他主播在频道中,当前用户加入频道后也会收到已加入频道主播的回调
3259
- * - 远端观众角色调用 {@link AliRtcEngine.setClientRole} 切换为主播角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkInteractive},同时设置了推流时,会触发该回调
3260
- *
3261
- * @param uid 用户ID,从App server分配的唯一标示符
3262
- * @param elapsed 用户加入频道时的耗时
3263
- * @note 互动模式下回调行为
3264
- * - 主播间可以互相收到加入频道回调
3265
- * - 观众可以收到主播加入频道回调
3266
- * - 主播无法收到观众加入频道回调
3267
- */
3268
- remoteUserOnLineNotify: (uid: string, elapsed: number) => void;
3269
- /**
3270
- * @brief 远端用户(通信模式)/(互动模式,主播角色)离开频道回调
3271
- * @details 该回调在以下场景会被触发
3272
- * - 通信模式:远端用户离开频道会触发该回调
3273
- * - 互动模式:
3274
- * - 远端主播角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkInteractive} 离开频道
3275
- * - 远端主播切换调用 {@link AliRtcEngine.setClientRole} 切换为观众角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkLive},会触发该回调
3276
- * - 通信模式和互动模式主播角色情况下,当长时间收不到远端用户数据,超时掉线时,会触发该回调
3277
- *
3278
- * @param uid 用户ID,从App server分配的唯一标示符
3279
- * @param reason 用户离线的原因,详见 {@link AliRtcEngine.AliRtcUserOfflineReason}
3280
- */
3281
- remoteUserOffLineNotify: (uid: string, aliRtcUserOfflineReason: AliRtcUserOfflineReason) => void;
3282
- /**
3283
- * @brief 远端用户的音视频流发生变化回调
3284
- * @details 该回调在以下场景会被触发
3285
- * - 当远端用户从未推流变更为推流(包括音频和视频)
3286
- * - 当远端用户从已推流变更为未推流(包括音频和视频)
3287
- * - 互动模式下,调用 {@link AliRtcEngine.setClientRole} 切换为主播角色 {@link AliRtcEngine.AliRtcSdkClientRole.AliRtcSdkInteractive},同时设置了推流时,会触发该回调
3288
- *
3289
- * @param uid 用户ID,从App server分配的唯一标示符
3290
- * @param audioTrack 音频流类型,详见 {@link AliRtcEngine.AliRtcAudioTrack}
3291
- * @param videoTrack 视频流类型,详见 {@link AliRtcEngine.AliRtcVideoTrack}
3292
- * @note 该回调仅在通信模式用户和互动模式下的主播角色才会触发
3293
- */
3294
- remoteTrackAvailableNotify: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
3295
- /**
3296
- * @brief 远端用户静音/取消静音回调
3297
- * @param uid 远端用户ID
3298
- * @param isMute 该用户是否静音
3299
- * - true: 静音
3300
- * - false: 取消静音
3301
- */
3302
- userAudioMuted: (uid: string, isMute: boolean) => void;
3303
- /**
3304
- * @brief 对端用户发送视频黑帧数据发送通知
3305
- * @param uid 执行muteVideo的用户ID
3306
- * @param isMute
3307
- * - true: 推流黑帧
3308
- * - false: 正常推流
3309
- * @note 该接口用于对端用户发送视频黑帧数据时的回调
3310
- */
3311
- userVideoMuted: (uid: string, isMute: boolean) => void;
3312
- /**
3313
- * @brief 对端用户发送屏幕黑帧数据发送通知
3314
- * @param uid 执行muteVideo的用户ID
3315
- * @param isMute
3316
- * - true: 推流黑帧
3317
- * - false: 正常推流
3318
- * @note 该接口用于对端用户发送屏幕黑帧数据时的回调
3319
- */
3320
- userScreenMuted: (uid: string, isMute: boolean) => void;
3321
- /**
3322
- * 音量反馈
3323
- * @param {Array} speakers 用户音量对象数组
3324
- * @param {string} speaker.userId 用户ID
3325
- * @param {number} speaker.volume 音量
3326
- * @note userId 为空字符串时代表是本地麦克风采集的音量
3327
- */
3328
- audioVolume: (speakers: {
3329
- userId: string;
3330
- volume: number;
3331
- }[]) => void;
3332
- /**
3333
- * 发布视频流的数据统计
3334
- * @param aliRtcStats 统计信息
3335
- */
3336
- aliRtcStats: (aliRtcStats: any) => void;
3337
- /**
3338
- * 音频推流变更回调
3339
- * @param track 流标识
3340
- * @param oldState 之前的推流状态
3341
- * @param newState 当前的推流状态
3342
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3343
- * @param channel 当前频道
3344
- */
3345
- audioPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
3346
- /**
3347
- * 音频订阅情况变更回调
3348
- * @param uid 用户ID
3349
- * @param oldState 之前的订阅状态
3350
- * @param newState 当前的订阅状态
3351
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3352
- * @param channel 当前频道
3353
- */
3354
- audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3355
- /**
3356
- * 视频推流变更回调
3357
- * @param oldState 之前的推流状态
3358
- * @param newState 当前的推流状态
3359
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3360
- * @param channel 当前频道
3361
- */
3362
- videoPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
3363
- /**
3364
- * 次要流推流变更回调
3365
- * @param oldState 之前的推流状态
3366
- * @param newState 当前的推流状态
3367
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3368
- * @param channel 当前频道
3369
- */
3370
- dualStreamPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
3371
- /**
3372
- * 屏幕分享推流变更回调
3373
- * @param oldState 之前的推流状态
3374
- * @param newState 当前的推流状态
3375
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3376
- * @param channel 当前频道
3377
- */
3378
- screenSharePublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
3379
- /**
3380
- * DataChannel 推流变更回调
3381
- * @param oldState 之前的推流状态
3382
- * @param newState 当前的推流状态
3383
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3384
- * @param channel 当前频道
3385
- */
3386
- dataPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number, channel: string) => void;
3387
- /**
3388
- * 相机流订阅情况变更回调
3389
- * @param uid 用户ID
3390
- * @param oldState 之前的订阅状态
3391
- * @param newState 当前的订阅状态
3392
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3393
- * @param channel 当前频道
3394
- */
3395
- videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3396
- /**
3397
- * 大小流订阅情况变更回调
3398
- * @param uid 用户ID
3399
- * @param oldStreamType 之前的订阅状态
3400
- * @param newStreamType 当前的订阅状态
3401
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3402
- * @param channel 当前频道
3403
- */
3404
- subscribeStreamTypeChanged: (uid: string, oldStreamType: AliRtcVideoStreamType, newStreamType: AliRtcVideoStreamType, elapseSinceLastState: number, channel: string) => void;
3405
- /**
3406
- * 屏幕分享流订阅情况变更回调
3407
- * @param uid 用户ID
3408
- * @param oldState 之前的订阅状态
3409
- * @param newState 当前的订阅状态
3410
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3411
- * @param channel 当前频道
3412
- */
3413
- screenShareSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3414
- /**
3415
- * DataChannel 订阅情况变更回调
3416
- * @param uid 用户ID
3417
- * @param oldState 之前的订阅状态
3418
- * @param newState 当前的订阅状态
3419
- * @param elapseSinceLastState 状态变更时间间隔(毫秒)
3420
- * @param channel 当前频道
3421
- */
3422
- dataSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3423
- /**
3424
- * 收到媒体扩展信息回调
3425
- * @param uid 用户ID,媒体信息发送用户的ID
3426
- * @param message 媒体扩展信息
3427
- * @param payloadType payload类型,sendMediaExtensionMsg返回5,sendMediaExtensionMsgEx发送的会返回具体类型
3428
- * @note 当一端通过 {@link AliRtcEngine.sendMediaExtensionMsg} 发送信息后,其他端通过该回调接收数据
3429
- */
3430
- mediaExtensionMsgReceived: (uid: string, message: ArrayBuffer, payloadType: number) => void;
3431
- /**
3432
- * @brief 用户鉴权信息即将过期通知,收到后30秒鉴权过期
3433
- * @note 该回调在鉴权信息30秒前触发,收到该回调后应该及时更新鉴权信息,参考 {@link AliRtcEngine.refreshAuthInfo:}
3434
- */
3435
- authInfoWillExpire: () => void;
3436
- /**
3437
- * @brief 用户调用需要鉴权的接口,服务端返回信息过期
3438
- * @note 该回调触发代表鉴权信息已过期,想要继续在会中,需要重新入会,参考 {@link AliRtcEngine.joinChannel:name:onResultWithUserId:}
3439
- */
3440
- authInfoExpired: () => {};
3441
- /**
3442
- * 远程用户的音频自动播放失败
3443
- * @param uid
3444
- * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
3445
- */
3446
- remoteAudioAutoPlayFail: (uid: string) => void;
3447
- /**
3448
- * 远程用户的视频自动播放失败
3449
- * @param uid
3450
- * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
3451
- */
3452
- remoteVideoAutoPlayFail: (uid: string, videoTrack: AliRtcVideoTrack) => void;
3453
- /**
3454
- * 远程用户的音频播放出错
3455
- * @param uid 用户ID
3456
- * @param reason 出错原因,可选
3457
- */
3458
- remoteAudioPlayError: (uid: string, reason: string | undefined) => void;
3459
- /**
3460
- * 远程用户的视频播放出错
3461
- * @param uid 用户ID
3462
- * @param reason 出错原因,可选
3463
- */
3464
- remoteVideoPlayError: (uid: string, reason: string | undefined) => void;
3465
- /**
3466
- * 远程用户订阅数据通道
3467
- * @param uid 用户ID
3468
- */
3469
- remoteUserSubscribedDataChannel: (uid: string) => void;
3470
- /**
3471
- * rtc 传输数据统计
3472
- * @param stats 统计信息
3473
- */
3474
- rtcStats: (stats: any) => void;
3475
- /**
3476
- * 发布视频流的数据统计
3477
- * @param aliRtcStats 统计信息
3478
- */
3479
- rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
3480
- /**
3481
- * 发布音频流的数据统计
3482
- * @param aliRtcStats 统计信息
3483
- */
3484
- rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
3485
- /**
3486
- * 订阅视频流的数据统计
3487
- * @param aliRtcStats 统计信息
3488
- */
3489
- rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
3490
- /**
3491
- * 订阅远端音频流的数据统计
3492
- * @param aliRtcStats 统计信息
3493
- */
3494
- rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
3495
- /**
3496
- * @brief 错误通知
3497
- * @deprecated 请使用 occurError
3498
- * @details 如果engine出现error,通过这个回调通知app
3499
- * @param error 错误类型,参考 {@link AliRtcError}
3500
- * @param uid 用户 Id,不一定存在
3501
- */
3502
- onOccurError: (error: AliRtcError, uid?: string) => void;
3503
- /**
3504
- * @brief 错误通知
3505
- * @details 如果engine出现error,通过这个回调通知app
3506
- * @param error 错误类型,参考 {@link AliRtcError}
3507
- * @param uid 用户 Id,不一定存在
3508
- */
3509
- occurError: (error: AliRtcError, uid?: string) => void;
3510
- /**
3511
- * @brief 收到数据通道消息
3512
- * @param uid 用户ID
3513
- * @param message 消息
3514
- */
3515
- dataChannelMsg: (uid: string, message: AliRtcDataChannelMsg) => void;
3516
- /**
3517
- * @brief AI agent处理结果
3518
- * @param code 返回code码
3519
- * @param action 结果对应的action
3520
- * @param result 结果
3521
- */
3522
- AIAgentResult: (code: number, action: string, result: string) => void;
3523
- }
3524
-
3525
- declare enum AliRtcRawDataStreamType {
3526
- /** 相机流 */
3527
- AliRtcSdkStreamTypeCapture = 0,
3528
- /** 屏幕共享流 */
3529
- AliRtcSdkStreamTypeScreen = 1
3530
- }
3531
-
3532
- interface AliRtcScreenShareConfiguration {
3533
- width?: number;
3534
- height?: number;
3535
- frameRate?: number;
3536
- bitrate?: number;
3537
- }
3538
-
3539
- interface AliRtcScreenShareStartConfig {
3540
- audio?: boolean;
3541
- videoTrack?: MediaStreamVideoTrack;
3542
- audioTrack?: MediaStreamAudioTrack;
3543
- }
3544
-
3545
- interface AliRtcVideoTrackConfig {
3546
- userId?: string;
3547
- streamType: AliRtcRawDataStreamType;
3548
- }
3549
-
3550
- interface ImageHolderPluginOptions {
3551
- imageUrl: string;
3552
- }
3553
- declare class AliRtcImageHolderPlugin extends AliRtcPlugin {
3554
- private url;
3555
- private image?;
3556
- private canvas;
3557
- private mediaStream?;
3558
- private updateableManager;
3559
- private updateable;
3560
- private hasVideoTrack;
3561
- constructor(url: string, fps?: number);
3562
- get initOptions(): {
3563
- imageUrl: string;
3564
- };
3565
- setOptions(options: ImageHolderPluginOptions): void;
3566
- private drawImageToCanvas;
3567
- start(): Promise<MediaStreamTrack>;
3568
- stop(): void;
3569
- isSupported(): boolean;
3570
- shouldUpdate(_streamInfo: AliRtcLocalStreamInfo): boolean;
3571
- process(streamInfo: AliRtcLocalStreamInfo): Promise<void>;
3572
- }
3573
-
3574
- declare class AliRtcEngine extends EventEmitter$1<AliRtcEngineEventListener> {
3575
- /**
3576
- * @ignore
3577
- */
3578
- static logName: string;
3579
- /**
3580
- * @ignore
3581
- */
3582
- static logError: boolean;
3583
- /**
3584
- * 检查浏览器是否支持 WebRTC
3585
- * @param {string} direction
3586
- * @returns {Promise<AliRtcCheckResult>}
3587
- */
3588
- static isSupported: (direction?: "sendonly" | "recvonly" | "sendrecv" | undefined) => Promise<AliRtcCheckResult>;
3589
- /**
3590
- * 检查浏览器是否支持开启大小流
3591
- * @returns {boolean}
3592
- */
3593
- static isDualVideoStreamSupported: typeof VideoScalerFactory.isSupport;
3594
- /**
3595
- * 获取摄像头列表
3596
- * @returns {Promise<string[]>}
3597
- */
3598
- static getCameraList: () => Promise<MediaDeviceInfo[]>;
3599
- static getMicrophoneList: () => Promise<MediaDeviceInfo[]>;
3600
- static getSpeakerList: () => Promise<MediaDeviceInfo[]>;
3601
- static getSdkVersion(): string;
3602
- /**
3603
- * 设置日志等级
3604
- * @param level
3605
- */
3606
- static setLogLevel(level: AliRtcLogLevel): void;
3607
- private static _instance?;
3608
- /**
3609
- * @brief 获取AliRtcEngine实例
3610
- * @param key key 可选参与,用于创建多个实例
3611
- * @details 该方法为同步调用,以单例的形式提供对象创建。
3612
- */
3613
- static getInstance(config?: AliRtcEngineConfig): AliRtcEngine;
3614
- static AliRtcSdkChannelProfile: typeof AliRtcSdkChannelProfile;
3615
- static AliRtcSdkClientRole: typeof AliRtcSdkClientRole;
3616
- static AliRtcVideoStreamType: typeof AliRtcVideoStreamType;
3617
- static AliRtcVideoTrack: typeof AliRtcVideoTrack;
3618
- static AliRtcAudioTrack: typeof AliRtcAudioTrack;
3619
- static AliRtcPublishState: typeof AliRtcPublishState;
3620
- static AliRtcSubscribeState: typeof AliRtcSubscribeState;
3621
- static AliRtcRawDataStreamType: typeof AliRtcRawDataStreamType;
3622
- static AliRtcLogLevel: typeof AliRtcLogLevel;
3623
- static AliRtcEngineLocalDeviceType: typeof AliRtcEngineLocalDeviceType;
3624
- static AliRtcEngineLocalDeviceExceptionType: typeof AliRtcEngineLocalDeviceExceptionType;
3625
- static AliRtcConnectionStatus: typeof AliRtcConnectionStatus;
3626
- static AliRtcConnectionStatusChangeReason: typeof AliRtcConnectionStatusChangeReason;
3627
- static AliRtcPlugin: typeof AliRtcPlugin;
3628
- static AliRtcPluginTrackType: typeof AliRtcPluginTrackType;
3629
- static AliRtcImageHolderPlugin: typeof AliRtcImageHolderPlugin;
3630
- static AliRtcLiveTranscodingParam: typeof AliRtcLiveTranscodingParam;
3631
- static AliRtcLiveTranscodingEncodeParam: typeof AliRtcLiveTranscodingEncodeParam;
3632
- static AliRtcLiveTranscodingMixParam: typeof LiveTranscodingMixParam;
3633
- static AliRtcLiveTranscodingSingleParam: typeof AliRtcLiveTranscodingSingleParam;
3634
- static AliRtcTranscodingClockWidget: typeof AliRtcTranscodingClockWidget;
3635
- static AliRtcTranscodingImage: typeof AliRtcTranscodingImage;
3636
- static AliRtcTranscodingText: typeof AliRtcTranscodingText;
3637
- static AliRtcTranscodingUser: typeof AliRtcTranscodingUser;
3638
- static AliRtcLiveTranscodingMixMode: typeof AliRtcLiveTranscodingMixMode;
3639
- static AliRtcLiveTranscodingStreamType: typeof AliRtcLiveTranscodingStreamType;
3640
- static AliRtcLiveTranscodingSourceType: typeof AliRtcLiveTranscodingSourceType;
3641
- static AliRtcLiveTranscodingTaskProfile: typeof AliRtcLiveTranscodingTaskProfile;
3642
- static AliRtcLiveTranscodingAudioSampleRate: typeof AliRtcLiveTranscodingAudioSampleRate;
3643
- static AliRtcLiveTranscodingSegmentType: typeof AliRtcLiveTranscodingSegmentType;
3644
- static AliRtcLiveTranscodingFontType: typeof AliRtcLiveTranscodingFontType;
3645
- static AliRtcLiveTranscodingCropMode: typeof AliRtcLiveTranscodingCropMode;
3646
- static AliRtcLiveTranscodingMediaProcessMode: typeof AliRtcLiveTranscodingMediaProcessMode;
3647
- static AliRtcLiveTranscodingState: typeof AliRtcLiveTranscodingState;
3648
- static AliRtcLiveTranscodingErrorCode: typeof AliRtcLiveTranscodingErrorCode;
3649
- static AliRtcTrascodingPublishTaskStatus: typeof AliRtcTrascodingPublishTaskStatus;
3650
- static AliRtcDataChannelMsg: typeof AliRtcDataChannelMsg;
3651
- static AliRtcDataMsgType: typeof AliRtcDataMsgType;
3652
- /**
3653
- * @brief 销毁 {@link AliRtcEngine}实例
3654
- * @details 调用该方法将会释放所有内部使用的资源,当完成音视频通信之后都建议调用该方法释放实例.调用该方法后,你将不能再使用 {@link AliRtcEngine} 的其他方法和任何回调,如需要再次使用需要重新调用 {@link AliRtcEngine.getInstance} 方法创建一个新的实例。
3655
- * @note 该方法为同步调用,需要等待内部资源释放之后才能执行其他方法
3656
- */
3657
- destroy(): Promise<void>;
3658
- protected channelProfile: AliRtcSdkChannelProfile;
3659
- protected clientRole: AliRtcSdkClientRole;
3660
- protected signalingManager: SignalingManager;
3661
- protected bizControl: BizControl;
3662
- protected liveTranscoding: AliRtcLiveTranscoding;
3663
- protected maxSignalingConnectRetryCount?: number;
3664
- protected slsReporter: SLSReporter;
3665
- protected connectState: AliRtcConnectionStatus;
3666
- protected networkError: boolean;
3667
- private _audioOnlyMode;
3668
- private _authInfoWillExpireTimer;
3669
- private _authInfoExpiredTimer;
3670
- private _serverCheckAuthInfoTimestamp;
3671
- private _localCheckAuthInfoTimestamp;
3672
- private _proxyAiTid;
3673
- private _agentParam;
3674
- constructor(config?: AliRtcEngineConfig);
3675
- /**
3676
- * 获取当前频道号,已经入会成功返回频道号,否则返回undefined
3677
- */
3678
- get channel(): string | undefined;
3679
- /**
3680
- * 获取当前用户的 userId,已经入会成功返回自己的 userId,否则返回 undefined
3681
- */
3682
- get userId(): string | undefined;
3683
- get remoteUsers(): RemoteUser[];
3684
- get publisher(): LocalUser | undefined;
3685
- get publishAudioStream(): LocalStream | undefined;
3686
- get isPublishing(): boolean;
3687
- private get currentRoleCanPublish();
3688
- /**
3689
- * 监听 Publisher 事件
3690
- */
3691
- private addPublisherListeners;
3692
- private occurError;
3693
- /**
3694
- * 监听 UM 事件
3695
- */
3696
- private addBizControlListeners;
3697
- /**
3698
- * 添加信令处理
3699
- * @returns {void}
3700
- */
3701
- private addSignalingManagerListeners;
3702
- private backToUnpublishStatus;
3703
- /**
3704
- * 处理入会远程的用户
3705
- * @param {JoinInfo[]} userJoinInfo
3706
- * @returns {void}
3707
- */
3708
- private handleUsersJoin;
3709
- /**
3710
- * 本地用户设备状态变化,通过信令发送给其他人
3711
- * @param {string} status
3712
- * @returns {void}
3713
- */
3714
- protected onLocalDeviceStatusChange(status: string): void;
3715
- /**
3716
- * 网络恢复后,重推;
3717
- */
3718
- private resumePublishForNetworkRecovery;
3719
- /**
3720
- * 处理房间信令重连成功/心跳恢复
3721
- * @returns {void}
3722
- */
3723
- protected onNetworkRecovery(users?: JoinInfo[]): Promise<void>;
3724
- private resumeSubList;
3725
- /**
3726
- * 重新订阅远端用户
3727
- * @param {string} userId
3728
- * @returns {Promise<void>}
3729
- */
3730
- retrySubscribe(userId: string): Promise<void>;
3731
- /**
3732
- * 处理网络异常
3733
- * @param {AliRtcError} err
3734
- * @returns {void}
3735
- */
3736
- protected onNetworkError(): void;
3737
- /**
3738
- * 处理错误
3739
- * @param {AliRtcError} err
3740
- * @returns {void}
3741
- */
3742
- protected onError(err: AliRtcError): void;
3743
- /**
3744
- * 是否开启大小流
3745
- * @param {boolean} enabled
3746
- * @param {AliRtcDualVideoPluginOptions} [options]
3747
- */
3748
- setEnableDualVideoStream(enabled: boolean, options?: AliRtcDualVideoPluginOptions): void;
3749
- /**
3750
- * 对本地流的操作预检查
3751
- */
3752
- private hadPushStream;
3753
- /**
3754
- * 获取当前使用的麦克风 deviceId
3755
- * @returns {string | undefined}
3756
- */
3757
- getCurrentMicDeviceId(): string | undefined;
3758
- /**
3759
- * 设置频道模式
3760
- * @param {AliRtcSdkChannelProfile} channelProfile 频道类型,默认值为 AliEngineCommunication
3761
- * @note 该接口只可以在加入频道之前调用,会议中不可以重新设置,离开频道后可以重新设置
3762
- */
3763
- setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
3764
- private startDefaultDevices;
3765
- private startPublish;
3766
- /**
3767
- * 设置用户角色
3768
- * @param {AliRtcSdkClientRole} clientRole 用户角色类型,默认值为 {@link AliRtcSdkClientRole.AliRtcSdkLive}(观众角色)
3769
- * @note 非通信模式下角色类型才有效
3770
- */
3771
- setClientRole(clientRole: AliRtcSdkClientRole): Promise<void>;
3772
- /**
3773
- * 获取用户角色
3774
- * @returns {AliRtcSdkClientRole}
3775
- */
3776
- getCurrentClientRole(): AliRtcSdkClientRole;
3777
- /**
3778
- * 是否开启纯音频模式
3779
- * @param {boolean} audioOnly
3780
- * - true:只有音频推流和拉流
3781
- * - false(默认值):音视频都支持
3782
- * @note 只可以在 {@link joinChannel} 之前设置
3783
- */
3784
- setAudioOnlyMode(audioOnly: boolean): void;
3785
- setAudioRedEnabled(audioRedEnabled: boolean): void;
3786
- setVideoCodec(videoCodec: CodecType): void;
3787
- /**
3788
- * 设定鉴权信息过期事件定时器
3789
- * @param expireTimestamp 鉴权信息过期时间
3790
- * @param serverTimestamp 入会时服务端时间
3791
- */
3792
- private setCheckAuthInfoTimer;
3793
- /**
3794
- * 清除鉴权信息过期事件定时器
3795
- */
3796
- private clearCheckAuthInfoTimer;
3797
- /**
3798
- * @brief 加入频道
3799
- * @details 该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
3800
- * @details 一般在调用该方法前会根据场景先选择频道模式,通过调用 {@link setChannelProfile} 实现,默认频道模式为通信模式 {@link AliRtcSdkChannelProfile.AliRtcSdkCommunication}
3801
- * ``` javascript
3802
- * // 设置频道为互动模式
3803
- * engine.setChannelProfile(AliRtcSdkChannelProfile.AliRtcInteractivelive);
3804
- * // 设置角色为主播角色
3805
- * engine.setClientRole(AliRtcSdkClientRole.AliRtcSdkInteractive);
3806
- * ```
3807
- * @param {AliRtcAuthInfo | string} authInfoOrToken (多参数/单参数) 认证信息,从App Server获取。
3808
- * @param {string} userName 任意用于显示的用户名称。不是User ID
3809
- * @param {any} extraData 入会自定义数据
3810
- * @note
3811
- * - 异步接口,方法执行成功则为成功入会
3812
- * - 正常情况一个Appid对应一个App,只有同一个AppId的应用可进行互相童话,不同AppId和channelID不同都不能互通
3813
- * - 当入会成功后,会触发远端用户收到 {@link AliRtcEngineEventListener.remoteUserOnLineNotify} 回调
3814
- * - 如果已在会中想重新入会,需要先调用 {@link leaveChannel} 离会,且确保方法执行成功
3815
- * - 用户加入频道后,默认订阅频道内所有其他用户的音视频流,默认推送音视频流到远端,因此将会产生计费,如果想要取消默认订阅可以 {@link joinChannel} 前调用 {@link setDefaultSubscribeAllRemoteAudioStreams} 和 {@link setDefaultSubscribeAllRemoteVideoStreams}
3816
- */
3817
- joinChannel(authInfoOrToken: AliRtcAuthInfo | string, userNameOrParam?: string | AliRtcChannelParam, extraData?: any): Promise<void>;
3818
- /**
3819
- * @brief 加入频道
3820
- * @details 该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
3821
- * @details 一般在调用该方法前会根据场景先选择频道模式,通过调用 {@link setChannelProfile} 实现,默认频道模式为通信模式 {@link AliRtcSdkChannelProfile.AliRtcSdkCommunication}
3822
- * ``` javascript
3823
- * // 设置频道为互动模式
3824
- * engine.setChannelProfile(AliRtcSdkChannelProfile.AliRtcInteractiveLive);
3825
- * // 设置角色为主播角色
3826
- * engine.setClientRole(AliRtcSdkClientRole.AliRtcSdkInteractive);
3827
- * ```
3828
- * @param token 认证信息,从App Server获取。
3829
- * @param channelParam 入会参数,详见{@link AliRtcChannelParam}
3830
- * @param agentParam 入会参数,详见{@link AliRtcAIAgentParam}
3831
- * @note
3832
- * - 异步接口,方法执行成功则为成功入会
3833
- * - 正常情况一个AppId对应一个App,只有同一个AppId的应用可进行互相通话,不同AppId和channelID不同都不能互通
3834
- * - 当入会成功后,会触发远端用户收到 {@link AliRtcEngineEventListener.remoteUserOnLineNotify} 回调
3835
- * - 如果已在会中想重新入会,需要先调用 {@link leaveChannel} 离会,且确保方法执行成功
3836
- * - 用户加入频道后,默认订阅频道内所有其他用户的音视频流,默认推送音视频流到远端,因此将会产生计费,如果想要取消默认订阅可以 {@link joinChannel} 前调用 {@link setDefaultSubscribeAllRemoteAudioStreams} 和 {@link setDefaultSubscribeAllRemoteVideoStreams}
3837
- */
3838
- joinAIChannel(token: string, channelParam: AliRtcChannelParam, agentParam: AliRtcAIAgentParam): Promise<void>;
3839
- /**
3840
- * 离开频道
3841
- * @note 如果当前不在频道内,调用 leaveChannel 不会对实例产生任何影响,但会产生消息,通知频道内其他用户
3842
- */
3843
- leaveChannel(): Promise<void>;
3844
- /**
3845
- * 检查当前是否在频道中
3846
- * @returns {boolean}
3847
- * - true:在频道中
3848
- * - false:不在频道中
3849
- */
3850
- isInCall(): boolean;
3851
- /**
3852
- * 刷新鉴权信息
3853
- * @param {AliRtcRefreshAuthInfo | string} authInfoOrToken
3854
- */
3855
- refreshAuthInfo(authInfoOrToken: AliRtcRefreshAuthInfo | string): Promise<void>;
3856
- /**
3857
- * 检查当前是否纯音频模式
3858
- * @returns {boolean}
3859
- * - true:纯音频模式
3860
- * - false:音视频模式
3861
- */
3862
- isAudioOnly(): boolean;
3863
- /**
3864
- * @brief 是否推送音频流
3865
- * @param enabled 是否开启/关闭本地音频流推送
3866
- * - true: 开启音频流推送
3867
- * - false: 关闭音频流推送
3868
- * @note SDK默认设置推送音频流,在加入频道前也可以调用此接口修改默认值,并在加入频道成功时生效
3869
- * @note 加入频道后调用不会停止本地音频采集
3870
- */
3871
- publishLocalAudioStream(enabled: boolean): Promise<void>;
3872
- /**
3873
- * @brief 查询是否设置推送音频流
3874
- * @return
3875
- * - true: 已设置推送
3876
- * - false: 未设置推送
3877
- * @note SDK默认设置推送音频流,如果需要取消推送音频流,可以通过 {@link publishLocalAudioStream}方法设置为不推送
3878
- */
3879
- isLocalAudioStreamPublished(): boolean;
3880
- /**
3881
- * 设置是否默认接收音频流
3882
- * @param sub
3883
- * - true: 接收用户的音频流
3884
- * - false: 停止接收用户的音频流
3885
- * @note 入会前入会后均可调用。如果在加入频道后调用 setDefaultSubscribeAllRemoteAudioStreams(false),会接收不到设置后加入频道的用户的音频流。
3886
- * @note 停止接收音频流后,如果想要恢复接收,请调用 {@link subscribeRemoteAudioStream},并指定你想要接收的远端用户ID;
3887
- * @note 如果想恢复接收多个用户的音频流,则需要多次调用 {@link subscribeRemoteAudioStream}。setDefaultSubscribeAllRemoteAudioStreams(true) 只能恢复接收后面加入频道的用户的音频流。
3888
- */
3889
- setDefaultSubscribeAllRemoteAudioStreams(sub: boolean): void;
3890
- /**
3891
- * 停止/恢复接收所有远端音频流
3892
- * @param sub
3893
- * - true: 接收所有用户的音频流
3894
- * - false: 停止接收所有用户的音频流
3895
- * @note 该接口作为订阅远端音频流的总开关,如果设置为false,则不仅当前会议中所有远端音频流都会停止订阅,后续入会的新用户也将不再订阅(即使设置了setDefaultSubscribeAllRemoteAudioStreams(true))
3896
- */
3897
- subscribeAllRemoteAudioStreams(sub: boolean): void;
3898
- /**
3899
- * 手动拉音频流
3900
- * @param uid uid
3901
- * @param sub,默认为 true
3902
- * - true: 接收指定用户的音频流
3903
- * - false: 停止接收指定用户的音频流
3904
- * @note 如果之前有调用过 subscribeAllRemoteAudioStreams(false) 对所有远端音频进行静音,在调用本 API 之前请确保你已调用 subscribeAllRemoteAudioStreams(true)。
3905
- * @note {@link subscribeAllRemoteAudioStreams} 是全局控制,{@link subscribeRemoteAudioStream} 是精细控制。
3906
- */
3907
- subscribeRemoteAudioStream(uid: string, sub: boolean): void;
3908
- /**
3909
- * 手动恢复远端用户音频流
3910
- * @param uid
3911
- * 用于在自动播放失败等场景恢复播放
3912
- */
3913
- resumeRemoteAudioStream(uid: string): void;
3914
- stopRemoteAudioPlay(uid: string): void;
3915
- /**
3916
- * @brief 是否推送本地视频流
3917
- * @param enabled 是否开启/关闭本地视频流推送
3918
- * - true: 开启视频流推送
3919
- * - false: 关闭视频流推送
3920
- * @note SDK默认设置推送视频流,在加入频道前也可以调用此接口修改默认值,并在加入频道成功时生效
3921
- * @note 加入频道后调用不会停止本地视频采集
3922
- */
3923
- publishLocalVideoStream(enabled: boolean): Promise<void>;
3924
- /**
3925
- * @brief 查询是否设置推送视频流
3926
- * @return
3927
- * - true: 已设置推送
3928
- * - false: 未设置推送
3929
- * @note SDK默认设置推送视频流,如果需要取消推送视频流,可以通过 {@link publishLocalVideoStream} 方法设置为不推送
3930
- */
3931
- isLocalVideoStreamPublished(): boolean;
3932
- /**
3933
- * 设置默认订阅的相机流格式,大流或小流,会覆盖单人的大小流设置
3934
- * @param {AliRtcVideoStreamType} streamType 流类型
3935
- * @note 仅支持传入 1 (默认大流)、2(默认小流),传入其他无效
3936
- * @note 当无默认类型的相机流,但有另一个,将拉取另一个
3937
- */
3938
- setRemoteDefaultVideoStreamType(streamType: AliRtcVideoStreamType): void;
3939
- /**
3940
- * 设置某一用户默认订阅的相机流格式,大流或小流
3941
- * @param userId 远端用户ID
3942
- * @param {AliRtcVideoStreamType} streamType 流类型
3943
- * @note 仅支持传入 1 (默认大流)、2(默认小流),传入其他无效
3944
- * @note 当无默认类型的相机流,但有另一个,将拉取另一个
3945
- */
3946
- setRemoteUserVideoStreamType(userId: string, streamType: AliRtcVideoStreamType): void;
3947
- /**
3948
- * 设置是否默认接收视频流
3949
- * @param sub
3950
- * - true: 接收用户的视频流
3951
- * - false: 不接收用户的视频流
3952
- * @note 入会前入会后均可调用。如果在加入频道后调用 setDefaultSubscribeAllRemoteVideoStreams(false),会接收不到设置后加入频道的用户的视频流。
3953
- * @note 停止接收视频流后,如果想要恢复接收,请调用 {@link subscribeRemoteVideoStream},并指定你想要接收的远端用户ID;
3954
- * @note 如果想恢复接收多个用户的视频流,则需要多次调用 {@link subscribeRemoteVideoStream};setDefaultSubscribeAllRemoteVideoStreams(true) 只能恢复接收后面加入频道的用户的视频流。
3955
- */
3956
- setDefaultSubscribeAllRemoteVideoStreams(sub: boolean): void;
3957
- /**
3958
- * 停止/恢复接收所有远端视频流
3959
- * @param sub
3960
- * - true: 接收所有用户的视频流
3961
- * - false: 停止接收所有用户的视频流
3962
- * @note 该接口作为订阅远端视频流的总开关,如果设置为false,则不仅当前会议中所有远端视频流都会停止订阅,后续入会的新用户也将不再订阅(即使设置了setDefaultSubscribeAllRemoteVideoStreams(true))
3963
- */
3964
- subscribeAllRemoteVideoStreams(sub: boolean): void;
3965
- /**
3966
- * 合并订阅远端音视频流
3967
- * @param uid uid
3968
- * @param videoTrack 视频流类型
3969
- * @param subVideo 是否订阅视频
3970
- * @param subAudio 是否订阅音频
3971
- * @return
3972
- */
3973
- subscribeRemoteMediaStream(uid: string, videoTrack: AliRtcVideoTrack, subVideo: boolean, subAudio: boolean): void;
3974
- /**
3975
- * @brief 手动恢复远端用户视频流
3976
- * @param uid
3977
- * @param videoTrack
3978
- * 用于在自动播放失败等场景恢复播放
3979
- */
3980
- resumeRemoteMediaStream(uid: string, videoTrack: AliRtcVideoTrack): void;
3981
- /**
3982
- * @brief 订阅目标频道,指定用户的流
3983
- * @param channelId 目标频道
3984
- * @param uid 用户ID,从App server分配的唯一标示符
3985
- * @param track 订阅的视频流类型
3986
- * @param sub_audio 是否订阅远端用户的音频流
3987
- * - true:订阅指定用户的音频流
3988
- * - false:停止订阅指定用户的音频流
3989
- * @param sub 是否订阅远端用户的流
3990
- * - true:订阅指定用户的流
3991
- * - false:停止订阅指定用户的流
3992
- */
3993
- /**
3994
- * @brief 获取远端在线用户列表
3995
- * @return 当前频道内所有在线用户userid列表
3996
- * @note 若当前频道ChannelProfile设置为 {@link AliRtcSdkChannelProfile.AliRtcSdkInteractiveLive} 模式,只有设置角色为 {@link AliRtcSdkClientRole.AliRtcSdkInteractive} 的用户为在线用户,本方法不返回角色为 {@link AliRtcSdkClientRole.AliRtcSdkLive} 的用户
3997
- */
3998
- getOnlineRemoteUsers(): string[];
3999
- /**
4000
- * @brief 查询远端用户状态
4001
- * @details 通过 uid 查询指定远端用户的状态信息.
4002
- * @param uid 用户ID。从App server分配的唯一标示符
4003
- * @return 返回一个远端用户对象。详见{@link RemoteUser}
4004
- */
4005
- getUserInfo(uid: string): AliRtcRemoteUserInfo | undefined;
4006
- /**
4007
- * @brief 查询用户是否在线
4008
- * @param uid 用户ID,从App server分配的唯一标示符。不可为NULL
4009
- * @return
4010
- * - true: 用户在线
4011
- * - false: 用户不在线
4012
- * @note 根据特定的UserID,查询该用户是否在线。
4013
- */
4014
- isUserOnline(uid: string): boolean;
4015
- /**
4016
- * @brief 开始屏幕共享
4017
- * @param config 开启屏幕共享的配置
4018
- * @note 可以通过 config 选择是否开启音频或使用外部自定义 MediaStream
4019
- * @note 自定义 MediaStream 仅支持一个视频流和一个音频流
4020
- */
4021
- startScreenShare(config?: AliRtcScreenShareStartConfig): Promise<void>;
4022
- /**
4023
- * @brief 停止屏幕共享
4024
- */
4025
- stopScreenShare(): Promise<void>;
4026
- /**
4027
- * @brief 设置屏幕流视频编码属性
4028
- * @details 该方法用于设置屏幕流视频编码属性对应的视频参数,如分辨率、帧率、码率、等 所有设置的参数都有相应的范围限制,如果设置的参数不在有效范围内,SDK会自动调节
4029
- * @param config 预定义的屏幕共享编码属性,
4030
- * @note
4031
- * - 该方法在入会前和入会后都可以调用,如果每次入会只需要设置一次屏幕流视频编码属性,建议在入会前调用
4032
- */
4033
- setScreenShareConfiguration(config: AliRtcScreenShareConfiguration): Promise<void>;
4034
- /**
4035
- * @breif 设置屏幕流采集内容提示
4036
- * @param contentHint 设置屏幕流内容提示,用于提升在不同内容场景下的视频编码质量 [参考文档](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/contentHint)
4037
- */
4038
- setScreenShareContentHint(contentHint: string): Promise<void>;
4039
- /**
4040
- * @brief 是否推送屏幕分享
4041
- * @param enabled 是否开启/关闭本地屏幕分享推送
4042
- * - true: 开启屏幕分享推送
4043
- * - false: 关闭屏幕分享推送
4044
- * @param config 开启屏幕共享的配置
4045
- * @note SDK默认设置推送屏幕分享,在加入频道前也可以调用此接口修改默认值,并在加入频道成功时生效
4046
- * @note 加入频道后调用不会停止本地屏幕采集
4047
- */
4048
- publishLocalScreenShareStream(enabled: boolean, config?: AliRtcScreenShareStartConfig): Promise<void>;
4049
- /**
4050
- * @brief 查询是否设置推送屏幕分享
4051
- * @return
4052
- - true: 已设置推送
4053
- - false: 未设置推送
4054
- * @note SDK默认设置不推送屏幕分享,如果需要推送屏幕共享,可以通过{@link startScreenShare}方法开启屏幕共享推送
4055
- */
4056
- isScreenSharePublished(): boolean;
4057
- /**
4058
- * @brief 设置共享音频的音量大小
4059
- * @param volume 共享音频音量大小,取值范围[0, 100]
4060
- */
4061
- setAudioShareVolume(volume: number): void;
4062
- /**
4063
- * 开启音量检测功能
4064
- * @param {number} interval 检测间隔,单位: ms
4065
- * @note 建议设置为300ms~500ms,取值 ≤0 表示不启用音量检测功能
4066
- */
4067
- enableAudioVolumeIndication(interval: number): void;
4068
- /**
4069
- * 停止/恢复本地音频数据发送
4070
- * @param {boolean} mute 停止或恢复本地音频数据发送
4071
- * - true:静音本地音频
4072
- * - false(默认值):取消静音
4073
- */
4074
- muteLocalMic(mute?: boolean): void;
4075
- /**
4076
- * 停止/恢复远端指定用户的音频流的播放
4077
- * @param {string} uid 用户ID, 从 App server 分配的唯一标示符
4078
- * @param {boolean} mute 停止或恢复远端的音频播放
4079
- * - true:停止播放
4080
- * - false(默认值):恢复播放
4081
- * @note 拉流和解码不受影响,支持 {@link joinChannel} 之前和之后设置
4082
- */
4083
- muteRemoteAudioPlaying(uid: string, mute?: boolean): void;
4084
- /**
4085
- * 停止/恢复远端的所有音频流的播放
4086
- * @param {boolean} mute 停止或恢复远端的音频播放
4087
- * - true:停止播放
4088
- * - false(默认值):恢复播放
4089
- * @note 拉流和解码不受影响,支持 {@link joinChannel} 之前和之后设置
4090
- */
4091
- muteAllRemoteAudioPlaying(mute?: boolean): void;
4092
- /**
4093
- * @brief 开启音频采集
4094
- * @details 此接口可以控制提前打开音频采集,如果不设置,则SDK会自动控制音频采集设备:
4095
- * - 如果打开推送音频流{@link publishLocalAudioStream},SDK在入会后会打开音频采集
4096
- * - 如果关闭推送音频流{@link publishLocalAudioStream},SDK在入会后不会打开音频采集
4097
- * @param {IAudioConstraints} audioConstraints 音频采集参数
4098
- */
4099
- startAudioCapture(audioConstraints?: MediaTrackConstraints): Promise<void>;
4100
- /**
4101
- * @brief 设置音频采集参数
4102
- * @param constraints 音频采集参数
4103
- */
4104
- setAudioConstraints(constraints: MediaTrackConstraints): Promise<void>;
4105
- /**
4106
- * 关闭音频采集
4107
- * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
4108
- */
4109
- stopAudioCapture(): void;
4110
- /**
4111
- * 切换麦克风
4112
- * @param {string} deviceId 麦克风设备ID
4113
- * @param {MediaStreamAudioTrack} audioTrack 音频轨道
4114
- * @note 传入 audioTrack 则会使用传入的音频轨道
4115
- */
4116
- switchMicrophone(deviceId: string, audioTrack?: MediaStreamAudioTrack): Promise<void>;
4117
- /**
4118
- * 设置录音音量
4119
- * @param {VolumeSettings} volumeSettings 录音音量,取值范围[0,100]
4120
- * - 0:静音
4121
- * - <100:减小音量
4122
- * - >100:放大音量
4123
- */
4124
- setRecordingVolume(volume: number): void;
4125
- /**
4126
- * @brief 设置播放音量
4127
- * @param volume 播放音量,取值范围[0,100], 0:静音;100:原始音量
4128
- * @note 注意此方法与 {@link setRemoteAudioVolume} 相互影响,以后调用的一个为准
4129
- */
4130
- setPlayoutVolume(volume: number): void;
4131
- /**
4132
- * @brief 设置播放音量
4133
- * @param userId 用户ID
4134
- * @param volume 播放音量,取值范围[0,100], 0:静音;100:原始音量
4135
- * @note 注意此方法与 {@link setPlayoutVolume} 相互影响,以后调用的一个为准
4136
- */
4137
- setRemoteAudioVolume(userId: string, volume: number): void;
4138
- /**
4139
- * 设置麦克风 profile
4140
- *
4141
- * @param {AudioProfileKey} profileKey
4142
- * @return {Promise<void>}
4143
- */
4144
- setAudioProfile(profileKey: AudioProfileKey): Promise<void>;
4145
- /**
4146
- * @brief 获取当前用户或远端用户的音频轨道
4147
- * @param {string} userId 远端用户 userId
4148
- * @return {MediaStreamTrack} 音频轨道
4149
- *
4150
- */
4151
- getAudioTrack(userId?: string): Promise<MediaStreamTrack | undefined>;
4152
- /**
4153
- * 为本地预览设置渲染元素和视频流
4154
- * @param {AliRtcLocalView} view 渲染元素,null 则为停止显示
4155
- * @param {AliRtcVideoTrack} track 视频流类型
4156
- */
4157
- setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): Promise<void>;
4158
- /**
4159
- * @brief 采集偏好设置
4160
- * @param cameraCapturerConfiguration 偏好设置
4161
- * - width: 设置采集分辨率宽度 默认 1280
4162
- * - height: 设置采集分辨率高度 默认 720
4163
- * - frameRate: 设置采集帧率 默认 30
4164
- * - bitrate: 设置采集码率 默认 2000
4165
- * - cameraDirection: 设置采集方向,前置或后置摄像头
4166
- * - deviceId: 设置采集相机ID
4167
- */
4168
- setCameraCapturerConfiguration(cameraCapturerConfiguration: AliEngineCameraCapturerConfiguration): Promise<void>;
4169
- /**
4170
- * @breif 设置摄像头采集内容提示
4171
- * @param contentHint 设置视频内容提示,用于提升在不同内容场景下的视频编码质量 [参考文档](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/contentHint)
4172
- */
4173
- setCameraCapturerContentHint(contentHint: string): Promise<void>;
4174
- /**
4175
- * 禁用或启用摄像头采集
4176
- * @param enabled
4177
- * - true : 启用摄像头采集
4178
- * - false : 禁用摄像头采集
4179
- */
4180
- enableLocalVideo(enabled?: boolean): Promise<void>;
4181
- /**
4182
- * 是否将停止摄像头流数据发送
4183
- * @param mute
4184
- * - true:停止发送摄像头流数据
4185
- * - false:表示恢复正常
4186
- */
4187
- muteLocalCamera(mute: boolean): Promise<void>;
4188
- /**
4189
- * 是否将停止屏幕共享流数据发送
4190
- * @param mute
4191
- * - true:停止发送屏幕共享流数据
4192
- * - false:表示恢复正常
4193
- */
4194
- muteLocalScreen(mute: boolean): Promise<void>;
4195
- /**
4196
- * 设置远端视频显示视图
4197
- * @param {AliRtcLocalView} view 渲染元素
4198
- * @param {AliRtcVideoTrack} track 视频流类型
4199
- * @param {string} uid 用户ID, 从App server分配的唯一标示符
4200
- * @note 支持joinChannel之前和之后切换窗口。如果 view 传入 null,则停止显示
4201
- */
4202
- setRemoteViewConfig(view: AliRtcLocalView, uid: string, track: AliRtcVideoTrack): void;
4203
- /**
4204
- * 检查camera是否打开
4205
- * @return {boolean}
4206
- * - true: 摄像头已打开
4207
- * - false: 摄像头没有打开
4208
- * @note 该接口用于检查当前camera的状态
4209
- */
4210
- isCameraOn(): boolean;
4211
- /**
4212
- * 切换摄像头
4213
- * @param {string} deviceId 摄像头设备ID
4214
- * @param {MediaStreamVideoTrack} videoTrack 视频流
4215
- * @note 若不传 deviceId 则前后摄像头切换,传入 videoTrack 则会使用传入的 videoTrack
4216
- */
4217
- switchCamera(deviceId?: string, videoTrack?: MediaStreamVideoTrack): Promise<void>;
4218
- /**
4219
- * 获取摄像头设备ID
4220
- * @return {string} 摄像头设备ID
4221
- */
4222
- getCurrentCameraDeviceId(): string | undefined;
4223
- /**
4224
- * @brief 开启摄像头预览
4225
- * @details 开启摄像头预览并自动打开摄像头
4226
- * @note 如果没有调用{@link setLocalViewConfig}设置显示的view,则无法预览,但不影响推流。
4227
- * 可以在{@link joinChannel}之前就开启预览会自动打开摄像头。
4228
- */
4229
- startPreview(): Promise<void>;
4230
- /**
4231
- * @brief 开启屏幕共享预览
4232
- * @details 开启屏幕共享预览并自动打开屏幕共享
4233
- * @param config 开启屏幕共享的配置
4234
- * @note 如果没有调用{@link setLocalViewConfig}设置显示的view,则无法预览,但不影响推流。
4235
- * 可以在{@link joinChannel}之前就开启预览会自动打开屏幕共享。
4236
- */
4237
- startPreviewScreen(config?: AliRtcScreenShareStartConfig): Promise<void>;
4238
- /**
4239
- * @brief 停止本地视频预览
4240
- */
4241
- stopPreview(): Promise<void>;
4242
- /**
4243
- * @brief 停止本地屏幕共享预览
4244
- */
4245
- stopPreviewScreen(): Promise<void>;
4246
- /**
4247
- * @brief 获取当前用户或远端用户的视频轨道
4248
- * @param {AliRtcVideoTrackConfig} config 视频轨道配置
4249
- * @return {MediaStreamTrack} 视频轨道
4250
- *
4251
- */
4252
- getVideoTrack(config: AliRtcVideoTrackConfig): Promise<MediaStreamTrack | undefined>;
4253
- /**
4254
- * @brief 开启旁路直播
4255
- * @details SDK提供了开启旁路直播的功能,可以把实时音视频流经过混流、混音处理转为标准直播流并推送至指定CDN供应商
4256
- * @param streamUrl 推流地址
4257
- * @param transcoding 推流所需参数, 详细定义见{@link AliRtcLiveTranscodingParam}
4258
- */
4259
- startPublishLiveStream(streamUrl: string, transcoding: AliRtcLiveTranscodingParam): Promise<any>;
4260
- /**
4261
- * @brief 更新旁路直播相关参数
4262
- * @details SDK提供了更新旁路直播的功能,用于实时更新旁路直播参数
4263
- * @param streamUrl 推流地址
4264
- * @param transcoding 推流所需参数, 详细定义见{@link AliRtcLiveTranscodingParam}
4265
- */
4266
- updatePublishLiveStream(streamUrl: string, transcoding: AliRtcLiveTranscodingParam): Promise<any>;
4267
- /**
4268
- * @brief 更新旁路直播相关参数
4269
- * @details SDK提供了更新旁路直播的功能,用于实时更新旁路直播参数
4270
- * @param taskId 任务Id
4271
- * @param transcoding 推流所需参数, 详细定义见{@link AliRtcLiveTranscodingParam}
4272
- * @return
4273
- * - 0 : 成功
4274
- * - 非0 : 失败
4275
- * - ERR_INNER(-1) : SDK内部错误,可能的情况为SDK未初始化或者SDK销毁后调用
4276
- * - 其他 : 返回值参考官网错误码
4277
- */
4278
- updatePublishLiveStreamWithTaskId(taskId: string, transcoding: AliRtcLiveTranscodingParam): Promise<any>;
4279
- /**
4280
- * @brief 停止旁路直播
4281
- * @details SDK提供了停止旁路直播的功能
4282
- * @param streamUrl 推流地址
4283
- */
4284
- stopPublishLiveStream(streamUrl: string): Promise<any>;
4285
- /**
4286
- * @brief 停止旁路直播
4287
- * @details SDK提供了停止旁路直播的功能
4288
- * @param taskId 任务Id
4289
- */
4290
- stopPublishLiveStreamWithTaskId(taskId: string): Promise<any>;
4291
- /**
4292
- * 获取旁路直播状态
4293
- * @param streamUrl 推流地址
4294
- * @return 路直播状态
4295
- */
4296
- /**
4297
- * @brief 设置是否启用媒体扩展信息
4298
- * @param enabled 是否启用媒体扩展,需要在加入房间之前调用
4299
- */
4300
- setEnableMediaExtensionMsg(enabled: boolean): void;
4301
- /**
4302
- * @brief 发送媒体扩展信息
4303
- * @details SDK提供了发送和接收媒体扩展信息的功能,接收端参考 {@link AliRtcEngineEventListener.mediaExtensionMsgReceived},使用场景:
4304
- * - 使用媒体扩展信息传递时间戳,计算端到端的网络延迟,或者跟自身其他业务做数据同步
4305
- * - 使用媒体扩展信息传递描述信息。目前可以传递最多 4k Byte数据,可以用来传输少量数据,建议使用Json或者纯字符串;
4306
- * - 内部使用SEI扩展协议来实现;
4307
- *
4308
- * @param message 媒体扩展信息,长度限制为最大4K字节
4309
- * @param repeatCount 重复次数,代表消息冗余度,用于防止网络丢包导致的消息丢失,-1为无限传输
4310
- *
4311
- * @note 启用此能力会增加客户端性能开销,如有需求需要在加入房间之前调用 setEnableMediaExtensionMsg
4312
- * @note 使用媒体扩展信息时需要复用音视频数据通道,因此必须控制自定义消息的发送频率和消息数据长度,使用限制如下:
4313
- * - 每秒最多发送profile条消息,因为sei信息是放到h264/h265流中传输,有视频帧编码才能附加扩展信息;
4314
- * - 为了不影响媒体数据的传输质量,自定义消息体长度限制为4k Byte,可以用来传输少量信息;
4315
- * - sendMediaExtensionMsg函数中repeatCount参数为自定义消息冗余度,若大于1,则会发送多次,
4316
- * - 防止网络丢包导致的消息丢失,此时房间里的其他人也会收到多次相同的消息,需要去重
4317
- * - 发送的自定义消息,在旁路直播时,房间里的订阅者也一样会收到
4318
- * - 同一时间只有一条MediaExtensionMsg在传输,多次调用sendMediaExtensionMsg,新调用的数据会覆盖前一次的数据;
4319
- */
4320
- sendMediaExtensionMsg(message: ArrayBuffer, repeatCount: number): Promise<void>;
4321
- /**
4322
- * @brief 发送媒体扩展信息
4323
- * @details SDK提供了发送和接收媒体扩展信息的功能,接收端参考 {@link AliRtcEngineEventListener.mediaExtensionMsgReceived},使用场景:
4324
- * - 使用媒体扩展信息传递时间戳,计算端到端的网络延迟,或者跟自身其他业务做数据同步
4325
- * - 使用媒体扩展信息传递描述信息。目前可以传递最多 4k Byte数据,可以用来传输少量数据,建议使用Json或者纯字符串;
4326
- * - 内部使用SEI扩展协议来实现;
4327
- *
4328
- * @param message 媒体扩展信息,长度限制为最大4K字节
4329
- * @param repeatCount 重复次数,代表消息冗余度,用于防止网络丢包导致的消息丢失,-1为无限传输
4330
- * @param payloadType [5, 100..254]范围 payloadType=5等于使用sendMediaExtensionMsg 接口
4331
- *
4332
- * @note 启用此能力会增加客户端性能开销,如有需求需要在加入房间之前调用 setEnableMediaExtensionMsg
4333
- * @note 使用媒体扩展信息时需要复用音视频数据通道,因此必须控制自定义消息的发送频率和消息数据长度,使用限制如下:
4334
- * - 每秒最多发送profile条消息,因为sei信息是放到h264/h265流中传输,有视频帧编码才能附加扩展信息;
4335
- * - 为了不影响媒体数据的传输质量,自定义消息体长度限制为4k Byte,可以用来传输少量信息;
4336
- * - sendMediaExtensionMsg函数中repeatCount参数为自定义消息冗余度,若大于1,则会发送多次,
4337
- * - 防止网络丢包导致的消息丢失,此时房间里的其他人也会收到多次相同的消息,需要去重
4338
- * - 发送的自定义消息,在旁路直播时,房间里的订阅者也一样会收到
4339
- * - 同一时间只有一条MediaExtensionMsg在传输,多次调用sendMediaExtensionMsg,新调用的数据会覆盖前一次的数据;
4340
- */
4341
- sendMediaExtensionMsgEx(message: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
4342
- static Plugin: typeof AliRtcPlugin;
4343
- /**
4344
- * @brief 开启音视频处理算法插件
4345
- * @details RTC采用插件件形式提供音视频增强及特效能力,可通过[官网组件文档](https://help.aliyun.com/document_detail/261183.html) 进行组件下载,参考插件集成文档集成进RTC引擎;
4346
- * @param plugin 插件库
4347
- * @param option 插件初始化参数值,请阅读插件库接入文档
4348
- * @note
4349
- * - 入会前入会后均可调用;
4350
- * - 如果重复调用会报错;
4351
- */
4352
- enablePlugin(plugin: AliRtcPlugin, options?: any): void;
4353
- /**
4354
- * @brief 关闭音视频处理算法插件
4355
- * @param name 插件名称,通过 plugin.name 获取
4356
- * @note
4357
- * - 入会前入会后均可调用;
4358
- * - 重复调用返回错误;
4359
- */
4360
- removePlugin(name: string): void;
4361
- /**
4362
- * @brief 根据插件ID设置插件
4363
- * @param name 插件名称,通过 plugin.name 获取
4364
- * @param option 插件初始化参数值,请阅读插件库接入文档
4365
- */
4366
- setPluginOption(name: string, option: any): void;
4367
- getPluginByName(name: string): any;
4368
- /**
4369
- * @brief 根据插件ID获取插件内部信息
4370
- * @param name 插件名称,通过 plugin.name 获取
4371
- */
4372
- getPluginOption(name: string): any;
4373
- /**
4374
- * 美颜功能是否有效
4375
- * @return
4376
- * - true: 美颜功能有效
4377
- * - false: 无效
4378
- */
4379
- isBeautyAvailable(): boolean;
4380
- /**
4381
- * 美颜功能是否开启
4382
- * @return
4383
- * - true: 美颜功能已开启
4384
- * - false: 已关闭
4385
- */
4386
- isBeautyEnabled(): boolean;
4387
- /**
4388
- * @brief 开启或关闭美颜功能, 并设置美颜效果参数
4389
- * @param enable
4390
- * - true: 开启美颜功能
4391
- * - false: 关闭美颜功能
4392
- * @param config 美颜效果参数
4393
- */
4394
- setBeautyEffect(enable: boolean, config: AliRtcBeautyConfig): void;
4395
- /**
4396
- * @brief 开启/关闭虚拟背景替换功能
4397
- * @details 需要集成美颜插件;
4398
- * @param enable 是否开启;
4399
- * @param path 虚拟背景本地图片路径,支持JPG,PNG 格式;
4400
- *
4401
- * @note
4402
- * - 与背景虚化为替换关系,如开启虚拟背景开关后再次开启背景虚化,则只有背景虚化效果;
4403
- */
4404
- enableBackgroundExchange(enable: boolean, path: string): void;
4405
- /**
4406
- * @brief 开启/关闭虚拟背景虚化功能
4407
- * @details 需要集成美颜插件;
4408
- * 需要集成美颜插件,背景替换与背景虚化不可同时使用,如开启虚拟背景开关后再次开启背景虚化,则只有背景虚化效果;
4409
- * @param enable 是否开启;
4410
- *
4411
- * @note
4412
- * - 与虚拟背景为替换关系,如开启背景虚化开关后再次开启虚拟背景,则只有虚拟背景效果;
4413
- */
4414
- enableBackgroundBlur(enable: boolean): void;
4415
- setParameter(parameter: string): void;
4416
- getParameter(): string;
4417
- /**
4418
- * @brief 发送 DataChannel 消息
4419
- * @param dataChannelMsg 伴奏控制消息
4420
- */
4421
- sendDataChannelMessage(dataChannelMsg: AliRtcDataChannelMsg): void;
4422
- }
4423
- declare const WrappedAliRtcEngine: typeof AliRtcEngine;
4424
- type WrappedAliRtcEngine = InstanceType<typeof AliRtcEngine>;
4425
-
4426
- interface AliRtcCheckResult {
4427
- support: boolean;
4428
- detail: {
4429
- isWebRTCSupported: boolean;
4430
- isH264EncodeSupported: boolean;
4431
- isH264DecodeSupported: boolean;
4432
- isBrowserSupported: boolean;
4433
- isScreenShareSupported: boolean;
4434
- isSendMediaExtensionMsgSupported: boolean;
4435
- };
4436
- }
4437
-
4438
- declare enum ConnectionLatencyStage {
4439
- CREATE_ENGINE = "create_engine",
4440
- JOIN = "join",
4441
- WANT_INSERT_PUB_TASK = "wantInsertPubTask",
4442
- INSERT_PUB_TASK = "InsertPubTask",
4443
- HANDLE_PUB_TASK = "HandlePubTask",
4444
- RECV_NOTIFY_PUBLISH = "RecvNotifyPublish",
4445
- INSERT_SUB_TASK = "InsertSubTask",
4446
- HANDLE_SUB_TASK = "HandleSubTask",
4447
- FIRST_REMOTE = "first_remote"
4448
- }
4449
- declare enum ConnectionLatencyStatus {
4450
- START = "start",
4451
- SEND_SIG = "send_sig",
4452
- RECV_RST = "recv_rst",
4453
- END = "end",
4454
- RECEIVED = "received",
4455
- DECODED = "decoded",
4456
- PLAYED = "played"
4457
- }
4458
- type ValidStatusMap = {
4459
- [ConnectionLatencyStage.CREATE_ENGINE]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.END;
4460
- [ConnectionLatencyStage.JOIN]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.SEND_SIG | ConnectionLatencyStatus.RECV_RST | ConnectionLatencyStatus.END;
4461
- [ConnectionLatencyStage.FIRST_REMOTE]: ConnectionLatencyStatus.RECEIVED | ConnectionLatencyStatus.DECODED | ConnectionLatencyStatus.PLAYED;
4462
- [ConnectionLatencyStage.RECV_NOTIFY_PUBLISH]: any;
4463
- [ConnectionLatencyStage.HANDLE_PUB_TASK]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.END;
4464
- [ConnectionLatencyStage.HANDLE_SUB_TASK]: ConnectionLatencyStatus.START | ConnectionLatencyStatus.END;
4465
- };
4466
-
4467
- /**
4468
- * 日志埋点类
4469
- * 每个埋点暴露对应的接口
4470
- */
4471
- declare class SLSReporter {
4472
- private engine;
4473
- protected logClient: LogClient;
4474
- protected authInfo?: AliRtcAuthInfo;
4475
- private ntpClock;
4476
- private static staticClient;
4477
- private static getLogClient;
4478
- static reportOSSUpload(sessionId: string, date: string, responseCode?: number): void;
4479
- constructor(engine: WrappedAliRtcEngine);
4480
- private customFields;
4481
- /**
4482
- * 设置通用字段
4483
- * @param fields 字段键值对
4484
- */
4485
- setCustomFields(fields: {
4486
- [key: string]: any;
4487
- }): void;
4488
- /**
4489
- * 获取通用字段
4490
- * @param key 字段键
4491
- * @returns 字段值或undefined
4492
- */
4493
- getCustomField(key: string): any;
4494
- /**
4495
- * 开始建立连接
4496
- * @param authInfo
4497
- */
4498
- start(info: AliRtcAuthInfo): void;
4499
- updateToken(token: SLSSTSToken, ossToken?: OSSSTSToken): void;
4500
- /**
4501
- * 断开连接
4502
- */
4503
- stop(): void;
4504
- reportPublishAudio3A(callId: string, msid: string, traceId: string, apmJson: string): void;
4505
- reportPublishMonitor(callId: string, traceId: string, msid: string, track: MediaStreamTrack | undefined, stats: any[]): void;
4506
- reportSubscribeMonitor(callId: string, remoteId: string, traceId: string, msid: string, stats: any[]): void;
4507
- reportNetworkMonitor(candidates: any[]): void;
4508
- reportLoopAudioDelay(ssrc: string, result: any): void;
4509
- /**
4510
- * 加入房间成功埋点
4511
- * @param {number} joinTime
4512
- * @param {number} result
4513
- * @param {string} tid
4514
- */
4515
- reportJoin(result: number, timeRecord: TimeRecorder, tid?: string): void;
4516
- /**
4517
- * Join 链接细节
4518
- */
4519
- reportJoinConnection(logInfo: LogInfo): void;
4520
- /**
4521
- * 用户离开频道事件埋点
4522
- * @param {number} leaveTime
4523
- * @param {number} result
4524
- * @param {string} tid
4525
- */
4526
- reportLeave(leaveTime: number, result: number, tid: string): void;
4527
- /**
4528
- * 推流事件上报
4529
- * @param {string} callid
4530
- * @param {boolean} isLargeVideo
4531
- * @param {boolean} isSmallVideo
4532
- * @param {boolean} isScreenShare
4533
- * @param {boolean} isAudio
4534
- * @param {number} result
4535
- * @param {string} tid
4536
- * @param {number} pubTime
4537
- */
4538
- reportPublish(isRepublish: boolean, url: string, callid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number | undefined, pcTraceId: string, traceId: string, startTime: number): void;
4539
- /**
4540
- * 首包上报
4541
- * @param {string} callid
4542
- * @param {number} startTime
4543
- * @param {number} publishTime
4544
- * @param {number} joinTime
4545
- * @param {string} tckid
4546
- * @param {string} pcTraceId
4547
- * @param {string} traceId
4548
- * @param {PublishReason} reason
4549
- */
4550
- reportPublishFirstPacket(isRepublish: boolean, callid: string, startTime: number, publishTime: number, joinTime: number, tckid: string, pcTraceId: string, traceId: string, reason: PublishReason): void;
4551
- /**
4552
- * 停止推流事件上报
4553
- * @param {string} callid
4554
- * @param {number} unpubTime
4555
- * @param {number} result
4556
- * @param {string} tid
4557
- */
4558
- reportUnpublish(callid: string, unpubTime: number, result: number, tid: string): void;
4559
- /**
4560
- * 订阅事件埋点
4561
- * @param {string} callid
4562
- * @param {string} remoteid
4563
- * @param {boolean} isLargeVideo
4564
- * @param {boolean} isSmallVideo
4565
- * @param {boolean} isScreenShare
4566
- * @param {boolean} isAudio
4567
- * @param {number} result
4568
- * @param {string} tid
4569
- * @param {number} subTime
4570
- */
4571
- reportSubscribe(callid: string, remoteid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number, tid: string, subTime: number, logInfo: LogInfo): void;
4572
- reportSubscribeFirstPacket(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
4573
- reportSubscribeFirstFrame(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
4574
- /**
4575
- * 停止订阅事件埋点
4576
- * @param {string} callid
4577
- * @param {string} remoteid
4578
- * @param {number} unsubTime
4579
- * @param {number} result
4580
- * @param {string} tid
4581
- */
4582
- reportUnsubscribe(callid: string, remoteid: string, unsubTime: number, result: number, tid: string): void;
4583
- reportMute(callid: string, enable: boolean, type: 'audio' | 'video' | 'screen'): void;
4584
- /**
4585
- * 更新角色埋点
4586
- * @param {string|undefined} or 旧的角色
4587
- * @param {string} nr 新的角色
4588
- */
4589
- reportRoleUpdate(or: string | undefined, nr: string): void;
4590
- /**
4591
- * 更新角色埋点
4592
- * @param {string|undefined} or 旧的角色
4593
- * @param {string} nr 新的角色
4594
- */
4595
- reportRoleUpdateResult(or: string | undefined, nr: string, ctm: number, result: number): void;
4596
- /**
4597
- * 设置camera videoprofile
4598
- */
4599
- reportVideoProfile(profile: string): void;
4600
- /**
4601
- * 设置screenshare videoprofile
4602
- */
4603
- reportScreenProfile(profile: string): void;
4604
- /**
4605
- * 错误事件埋点
4606
- * @param err
4607
- */
4608
- reportError(err: any): void;
4609
- /**
4610
- * 错误事件埋点
4611
- * @param err
4612
- */
4613
- reportWarning(msg: string): void;
4614
- reportRoomServerEvent(isRequest: boolean, type: string, requestId: string, content: any): void;
4615
- reportTranscodingError(result: number, taskid: string): void;
4616
- reportBye(result: number): void;
4617
- reportAudio(error: any, cost: number, deviceName: string): void;
4618
- reportScreen(error: any, cost: number): void;
4619
- reportScreenStop(error: any): void;
4620
- reportSwitchCamera(deviceId: string): void;
4621
- reportPublishProfile(trackId: string, logInfo: LogInfo): void;
4622
- reportSDKCreated(startTs: number): void;
4623
- reportJoinInvoked(authInfo: AliRtcAuthInfo): void;
4624
- reportJoinResult(error: any): void;
4625
- reportSTSResult(code: number, startTs: number): void;
4626
- reportLeaveInvoked(): void;
4627
- reportSEIMessage(payloadType: number, length: number, repeatCount: number, delay: number, isKey: boolean): void;
4628
- /**
4629
- * 接通耗时事件(12001)
4630
- * 用stage和status来区分接通过程中各个时间节点。
4631
- * @param state
4632
- * @param status
4633
- * @param calid
4634
- * @param tckid
4635
- */
4636
- reportConnectionLatencyEvent<Stage extends keyof ValidStatusMap>(stage: Stage, status: ValidStatusMap[Stage], calid: string, tckid: string, tm?: number, ntptm?: number, http?: boolean): void;
4637
- /**
4638
- * 日志埋点
4639
- * 在埋点中增加tm字段,表示发生埋点的客户端本地时间
4640
- * @param {any} param 埋点内容
4641
- */
4642
- protected log(param: any): void;
4643
- /**
4644
- * 将Object转换成string
4645
- * @param {any} data
4646
- * @returns {string}
4647
- */
4648
- protected data2String(data: any): string;
4649
- }
4650
-
4651
- /**
4652
- * RoomServerMessageCenter支持的事件
4653
- */
4654
- interface RoomServerListener {
4655
- onJoinChannelResult: (data: any) => void;
4656
- onPublishResult: (code: number, tid: string, description: string) => void;
4657
- onNotifyJoin: (users: JoinInfo[]) => void;
4658
- onNotifyStatus: (users: RemoteUserStatus[]) => void;
4659
- onLeaveResult: (code: number, tid: string) => void;
4660
- onRoleUpdateResult: (code: number, tid: string, description: string) => void;
4661
- onRefreshUrlResult: (data: any) => void;
4662
- onNotifyLeave: (users: LeaveInfo[]) => void;
4663
- onNotifyPublish: (users: PublishUser[]) => void;
4664
- onStatusReport: (code: number, tid: string, description: string) => void;
4665
- onBye: (reason: AliRtcOnByeType, description: string) => void;
4666
- onKeepAliveRsp: () => void;
4667
- onConnectFail: (err: AliRtcError) => void;
4668
- onNetworkError: (err: AliRtcError) => void;
4669
- onAuthInvalid: () => void;
4670
- onReconnectStart: () => void;
4671
- onReconnectFail: (err: AliRtcError) => void;
4672
- onReconnectSuccess: (users: JoinInfo[]) => void;
4673
- onError: (err: AliRtcError) => void;
4674
- onUnknownMessage: (response: any) => void;
4675
- }
4676
- /**
4677
- * RoomServer消息中心
4678
- * 负责发送和接收信令数据,消息重发、回复Response
4679
- */
4680
- declare class RoomServerMessageCenter extends EventEmitter$1<RoomServerListener> {
4681
- static logName: string;
4682
- protected authInfo: AliRtcAuthInfo;
4683
- protected userName: string;
4684
- protected channelProfile: AliRtcSdkChannelProfile;
4685
- protected clientRole: AliRtcSdkClientRole;
4686
- private slsReporter;
4687
- protected wsClient: Socket;
4688
- protected packageCreater: PackageCreater;
4689
- protected keepAliveTimer: number;
4690
- protected packageCache: Map<string, ISendPackage>;
4691
- protected isFirstConnect: boolean;
4692
- protected aliveChecker: number;
4693
- protected reconnectData?: ReconnectData;
4694
- private joinChannelExtraData?;
4695
- constructor(authInfo: AliRtcAuthInfo, userName: string, channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, maxConnectRetryCount?: number);
4696
- get retryCount(): number;
4697
- /**
4698
- * 开始连接信令
4699
- * @param roomserverurl
4700
- * @param joinChannelExtraData 发送 joinChannel 信令时额外携带的数据
4701
- */
4702
- start(roomserverurl: string, joinChannelExtraData?: any): void;
4703
- /**
4704
- * 开始心跳计时器,并自动发送心跳包
4705
- */
4706
- startKeepAlive(): void;
4707
- /**
4708
- * 停止心跳计时器
4709
- */
4710
- stopKeepAlive(): void;
4711
- /**
4712
- * 发送入会、重连前所缓存信息
4713
- */
4714
- sendPkgCache(): void;
4715
- /**
4716
- * 发送离开房间
4717
- */
4718
- leave(): void;
4719
- /**
4720
- * 透明通道消息上报
4721
- * @param status
4722
- */
4723
- reportStatus(status: string): void;
4724
- /**
4725
- * 发送推流消息
4726
- */
4727
- publish(_pubInfo: PublishInfo): void;
4728
- /**
4729
- * 更新角色
4730
- */
4731
- roleUpdate(role: string): void;
4732
- /**
4733
- * 更新推拉流地址
4734
- * @param {RefreshInfo} info
4735
- */
4736
- refreshUrl(info: RefreshInfo): void;
4737
- refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
4738
- /**
4739
- * 关闭websocket连接,并销毁
4740
- */
4741
- close(): void;
4742
- /**
4743
- * 通过此方法发送数据到业务信令
4744
- * 此方法会自动保存发送的package,并做重发.
4745
- * response包不要通过此方法发送
4746
- * @param pkg
4747
- */
4748
- protected sendPackage(pkg: ISendPackage): void;
4749
- /**
4750
- * 更新重连 payload
4751
- * @param {ReconnectData} reconnectData
4752
- */
4753
- updateReconnectData(reconnectData?: ReconnectData): void;
4754
- /**
4755
- * 收到websocket连接成功的消息
4756
- * ws连接建立成功后立刻发送join消息
4757
- */
4758
- protected onOpen(): void;
4759
- /**
4760
- * 收到业务信令消息
4761
- * @param event
4762
- */
4763
- protected onMessage(event: MessageEvent): void;
4764
- /**
4765
- * 收到错误消息
4766
- * @param event
4767
- */
4768
- protected onError(event: Event): void;
4769
- /**
4770
- * 连接失败
4771
- */
4772
- protected onConnectFail(): void;
4773
- /**
4774
- * 鉴权失败
4775
- */
4776
- protected onAuthInvalid(): void;
4777
- /**
4778
- * 网络异常
4779
- */
4780
- protected onNetworkError(): void;
4781
- /**
4782
- * 收到websocket断开消息
4783
- * @param event
4784
- */
4785
- protected onClose(event: CloseEvent): void;
4786
- protected onKeepAliveRsp(): void;
4787
- protected onReconnectStart(): void;
4788
- protected onReconnectFail(): void;
4789
- /**
4790
- * 处理 Keepalive 心跳,加速判断网络异常
4791
- */
4792
- protected checkAlive(): void;
4793
- /**
4794
- * 处理收到的业务信令
4795
- * @param response
4796
- */
4797
- protected onRecvMessage(response: any): void;
4798
- /**
4799
- * 收到入会消息的response
4800
- * @param response
4801
- */
4802
- protected onJoinResult(response: any): void;
4803
- /**
4804
- * 收到离开消息的response
4805
- * @param response
4806
- */
4807
- protected onLeaveResult(response: any): void;
4808
- /**
4809
- * 收到publish消息的response
4810
- * @param response
4811
- */
4812
- protected onPublishResult(response: any): void;
4813
- /**
4814
- * 收到roleUpdate消息的response
4815
- * @param response
4816
- */
4817
- protected onRoleUpdateResult(response: any): void;
4818
- /**
4819
- * 收到 refreshurl 消息的response
4820
- * @param response
4821
- */
4822
- protected onRefreshUrlResult(response: any): void;
4823
- /**
4824
- * 收到重联消息的response
4825
- * @param response
4826
- */
4827
- protected onReconnectResult(response: any): void;
4828
- /**
4829
- * 收到业务信令下发的消息
4830
- * @param response
4831
- */
4832
- protected onNotifyJoin(response: any): void;
4833
- /**
4834
- * 收到业务信令下发的透明通道消息
4835
- * @param response
4836
- */
4837
- protected onNotifyStatus(response: any): void;
4838
- /**
4839
- * 收到远端用户离开的通知
4840
- * @param response
4841
- */
4842
- protected onNotifyLeave(response: any): void;
4843
- /**
4844
- * 收到远端用户推流的通知
4845
- * @param response
4846
- */
4847
- protected onNotifyPublish(response: any): void;
4848
- /**
4849
- * 收到statusreport的response
4850
- * @param response
4851
- */
4852
- protected onStatusReport(response: any): void;
4853
- /**
4854
- * 收到被踢出频道的消息
4855
- * @param {any} response
4856
- */
4857
- protected onBye(response: any): void;
4858
- protected onUnknownMessage(response: any): void;
4859
- }
4860
-
4861
- declare class RoomServerSignaling extends EventEmitter$1<RoomServerListener> {
4862
- /**
4863
- * @ignore
4864
- */
4865
- static logName: string;
4866
- protected messageCenter?: RoomServerMessageCenter;
4867
- protected authInfo?: AliRtcAuthInfo;
4868
- protected userName?: string;
4869
- protected channelProfile: AliRtcSdkChannelProfile;
4870
- protected clientRole: AliRtcSdkClientRole;
4871
- private slsReporter;
4872
- protected reconnectData?: ReconnectData;
4873
- protected roomServerUri: string;
4874
- constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
4875
- /**
4876
- * 更新重连数据
4877
- * @param {ReconnectData} reconnectData
4878
- */
4879
- private updateReconnectData;
4880
- /**
4881
- * 释放资源
4882
- */
4883
- reset(): void;
4884
- /**
4885
- * 加入频道
4886
- * @param {AliRtcAuthInfo} authInfo
4887
- * @returns
4888
- */
4889
- join(authInfo: AliRtcAuthInfo, userName: string, maxConnectRetryCount?: number, joinChannelExtraData?: any): Promise<JoinResult>;
4890
- /**
4891
- * 离开频道
4892
- * @returns
4893
- */
4894
- leave(): Promise<SignalingResult>;
4895
- /**
4896
- * 开始推流
4897
- * @param pubInfo
4898
- * @returns
4899
- */
4900
- publish(pubInfo: PublishInfo): Promise<SignalingResult>;
4901
- roleUpdate(role: AliRtcSdkClientRole): Promise<SignalingResult>;
4902
- setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
4903
- /**
4904
- * 更新推流地址
4905
- */
4906
- refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
4907
- /**
4908
- * 上报设备状态
4909
- * @param status
4910
- */
4911
- reportStatus(status: string): Promise<void>;
4912
- protected handleSignalError(code: number, description: string, errorCode?: AliRtcErrorCode): AliRtcError;
4913
- refreshAuthInfo(authInfo: AliRtcAuthInfo): Promise<void>;
4914
- /**
4915
- * 初始化MessageCenter,增加事件监听
4916
- */
4917
- protected initMessageCenter(): void;
4918
- }
4919
-
4920
- interface StsManagerListener {
4921
- onTokenUpdate: (ossToken: OSSToken, slsToken: SLSToken) => void;
4922
- }
4923
- interface OSSToken {
4924
- access_key_id: string;
4925
- access_key_secret: string;
4926
- security_token: string;
4927
- region_endpoint: string;
4928
- bucket_name: string;
4929
- expiration: number;
4930
- }
4931
- interface SLSToken {
4932
- access_key_id: string;
4933
- access_key_secret: string;
4934
- security_token: string;
4935
- region_endpoint: string;
4936
- project: string;
4937
- log_store_stats: string;
4938
- log_store_debug: string;
4939
- expiration: number;
4940
- }
4941
- declare class StsManager extends EventEmitter$1<StsManagerListener> {
4942
- static logName: string;
4943
- private env;
4944
- private authInfo?;
4945
- private timer?;
4946
- private slsReporter;
4947
- private expiration;
4948
- private skipTime;
4949
- constructor(slsReporter: SLSReporter, env: AliRtcEnv);
4950
- refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
4951
- private requestToken;
4952
- startSTSUpdate(authInfo: AliRtcAuthInfo): void;
4953
- clear(): void;
4954
- }
4955
-
4956
- declare class SignalingManager extends EventEmitter$1<RoomServerListener> {
4957
- /**
4958
- * @ignore
4959
- */
4960
- static logName: string;
4961
- protected signaling?: RoomServerSignaling;
4962
- protected authInfo?: AliRtcAuthInfo;
4963
- protected userName?: string;
4964
- protected channelProfile: AliRtcSdkChannelProfile;
4965
- protected clientRole: AliRtcSdkClientRole;
4966
- protected env: AliRtcEnv;
4967
- protected maxConnectRetryCount?: number;
4968
- stsManager: StsManager;
4969
- private slsReporter;
4970
- constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
4971
- reset(): void;
4972
- /**
4973
- * 向业务信令发送入会
4974
- * @param {AliRtcAuthInfo} authInfo
4975
- * @returns
4976
- */
4977
- join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number, timeRecorder?: TimeRecorder, joinChannelExtraData?: any): Promise<JoinResult>;
4978
- retryJoin(): void;
4979
- /**
4980
- * 向业务信令发送离会
4981
- * @returns
4982
- */
4983
- leave(): Promise<SignalingResult>;
4984
- /**
4985
- * 推流
4986
- * @param pubInfo
4987
- * @returns
4988
- */
4989
- publish(pubInfo: PublishInfo): Promise<SignalingResult>;
4990
- /**
4991
- * 通过透明通道发送设备状态
4992
- * @param {string} status
4993
- * @returns
4994
- */
4995
- reportStatus(status: string): Promise<void>;
4996
- /**
4997
- * 切换角色
4998
- * @param {AliRtcSdkClientRole} role
4999
- * @returns
5000
- */
5001
- setClientRole(role: AliRtcSdkClientRole): Promise<SignalingResult | undefined>;
5002
- /**
5003
- * 切换模式
5004
- * @param {AliRtcSdkChannelProfile} channelProfile
5005
- */
5006
- setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
5007
- /**
5008
- * 更新推流url
5009
- * @param {RefreshInfo} info
5010
- * @returns
5011
- */
5012
- refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
5013
- refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): Promise<void>;
5014
- /**
5015
- * 监听业务信令相关的事件
5016
- */
5017
- protected initSignaling(): void;
5018
- /**
5019
- * 收到心跳消息
5020
- */
5021
- protected onKeepAliveRsp(): void;
5022
- /**
5023
- * 收到远端用户入会消息
5024
- * @param {JoinInfo[]} users
5025
- */
5026
- protected onNotifyJoin(users: JoinInfo[]): void;
5027
- /**
5028
- * 收到远端用户的透明通道消息
5029
- * @param {RemoteUserStatus[]} users
5030
- */
5031
- protected onNotifyStatus(users: RemoteUserStatus[]): void;
5032
- /**
5033
- * 收到远端用户的离会消息
5034
- * @param {LeaveInfo[]} users
5035
- */
5036
- protected onNotifyLeave(users: LeaveInfo[]): void;
5037
- /**
5038
- * 收到远端用户推流状态变化消息
5039
- * @param {PublishInfo[]} users
5040
- */
5041
- protected onNotifyPublish(users: PublishUser[]): void;
5042
- /**
5043
- * 收到被踢掉消息
5044
- * @param {string} reason
5045
- * @param {string} description
5046
- */
5047
- protected onBye(reason: AliRtcOnByeType, description: string): void;
5048
- /**
5049
- * 收到连接失败消息
5050
- * @param {AliRtcError} err
5051
- */
5052
- protected onConnectFail(err: AliRtcError): void;
5053
- /**
5054
- * 收到网络异常消息
5055
- * @param {AliRtcError} err
5056
- */
5057
- protected onNetworkError(err: AliRtcError): void;
5058
- /**
5059
- * 收到网络异常消息
5060
- */
5061
- protected onAuthInvalid(): void;
5062
- protected onReconnectStart(): void;
5063
- /**
5064
- * 收到重连成功消息
5065
- * @param {JoinInfo[]} users
5066
- */
5067
- protected onReconnectSuccess(users: JoinInfo[]): void;
5068
- /**
5069
- * 收到重连失败消息
5070
- */
5071
- protected onReconnectFail(err: AliRtcError): void;
5072
- /**
5073
- * 收到错误消息
5074
- * @param {AliRtcError} err
5075
- */
5076
- protected onError(err: AliRtcError): void;
5077
- protected onUnknownMessage(message: any): void;
5078
- }
5079
-
5080
- type Parameter = {
5081
- [key: string]: any;
5082
- };
5083
- interface BizControlConfig {
5084
- slsReporter: SLSReporter;
5085
- signalingManager: SignalingManager;
5086
- }
5087
- interface LocalUserConfig {
5088
- rtsManager: RtsManager;
5089
- localStreamManager: LocalStreamManager;
5090
- slsReporter: SLSReporter;
5091
- signalingManager: SignalingManager;
5092
- pluginManager: PluginManager;
5093
- audioVolumeIndicationInterval: number;
5094
- parameter: {
5095
- [key: string]: any;
5096
- };
5097
- }
5098
- interface RemoteUserConfig {
5099
- userId: string;
5100
- displayName: string;
5101
- rtsManager: RtsManager;
5102
- usersViewMap: {
5103
- [key: string]: RemoteUserViewMap;
5104
- };
5105
- slsReporter: SLSReporter;
5106
- signalingManager: SignalingManager;
5107
- localUser?: LocalUser;
5108
- audioVolumeIndicationInterval: number;
5109
- playoutVolume: number;
5110
- parameter: {
5111
- [key: string]: any;
5112
- };
5113
- }
5114
- declare enum ClientEventType {
5115
- PullStreamStats = "remoteStat",
5116
- RtsSubscribeExceeds = "rtsSubscribeExceeds",
5117
- UserJoined = "userJoined",
5118
- UserLeft = "userLeft",
5119
- Bye = "bye",
5120
- MuteAudio = "muteAudio",
5121
- UnmuteAudio = "unmuteAudio",
5122
- MuteVideo = "muteVideo",
5123
- UnmuteVideo = "unmuteVideo",
5124
- MuteScreen = "muteScreen",
5125
- UnmuteScreen = "unmuteScreen",
5126
- Error = "error"
5127
- }
5128
- declare enum DeviceStatusChange {
5129
- Local = "local-device-status-change",
5130
- Remote = "remote-device-status-change"
5131
- }
5132
- interface UserListener {
5133
- [DeviceStatusChange.Local]: (status: string) => void;
5134
- [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
5135
- [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
5136
- [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
5137
- [TrackEvent.VideoTrackEnded]: () => void;
5138
- [TrackEvent.AudioTrackEnded]: () => void;
5139
- [TrackEvent.ScreenTrackEnded]: () => void;
5140
- remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
5141
- audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
5142
- videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
5143
- screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
5144
- dataSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number) => void;
5145
- audioPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
5146
- videoPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
5147
- dualStreamPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
5148
- screenPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
5149
- dataPublishStateChanged: (oldState: AliRtcPublishState, newState: AliRtcPublishState, elapseSinceLastState: number) => void;
5150
- localDeviceException: (localDeviceType: AliRtcEngineLocalDeviceType, localDeviceExceptionType: AliRtcEngineLocalDeviceExceptionType, description: string) => void;
5151
- publishDataError: (error: AliRtcError) => void;
5152
- remoteAudioAutoPlayFail: (uid: string) => void;
5153
- remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
5154
- remoteAudioPlayError: (uid: string, reason?: string) => void;
5155
- remoteVideoPlayError: (uid: string, reason?: string) => void;
5156
- remoteSubscribeError: (error: AliRtcError) => void;
5157
- occurError: (error: AliRtcError) => void;
5158
- remoteDataChannelMessage: (uid: string, message: AliRtcDataChannelMsg) => void;
5159
- }
5160
- interface BizControlListener {
5161
- [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
5162
- [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
5163
- [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
5164
- remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
5165
- audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
5166
- videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
5167
- screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
5168
- dataSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
5169
- userAudioMuted: (uid: string, isMute: boolean) => void;
5170
- userVideoMuted: (uid: string, isMute: boolean) => void;
5171
- userScreenMuted: (userId: string, isMute: boolean) => void;
5172
- audioVolume: (speakers: {
5173
- userId: string;
5174
- volume: number;
5175
- }[]) => void;
5176
- remoteUserJoin: (uid: string, elapseSinceLastJoin: number) => void;
5177
- rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
5178
- rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
5179
- rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
5180
- rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
5181
- rtcStats: (stats: any) => void;
5182
- remoteAudioAutoPlayFail: (uid: string) => void;
5183
- remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
5184
- remoteAudioPlayError: (uid: string, reason?: string) => void;
5185
- remoteVideoPlayError: (uid: string, reason?: string) => void;
5186
- remoteSubscribeError: (error: AliRtcError, uid?: string) => void;
5187
- occurError: (error: AliRtcError, uid?: string) => void;
5188
- remoteDataChannelMessage: (uid: string, message: AliRtcDataChannelMsg) => void;
5189
- remoteUserSubscribedDataChannel: (uid: string) => void;
5190
- }
5191
- /**
5192
- * 服务端通知的远端用户信息
5193
- */
5194
- interface JoinInfo {
5195
- displayname: string;
5196
- session: string;
5197
- userid: string;
5198
- callid: string;
5199
- clientrole?: string;
5200
- subscribe?: {
5201
- pullstreamurl: string;
5202
- };
5203
- tracks?: TrackInfo[];
5204
- }
5205
- interface LeaveInfo {
5206
- userid: string;
5207
- leavecode: AliRtcUserOfflineReason;
5208
- reason: string;
5209
- }
5210
- interface PublishUser {
5211
- callid: string;
5212
- clientrole?: string;
5213
- displayname: string;
5214
- subscribe?: {
5215
- pullstreamurl: string;
5216
- };
5217
- pubid?: string;
5218
- tracks?: TrackInfo[];
5219
- userid: string;
5220
- sessionid?: string;
5221
- }
5222
- interface RemoteUserStatus {
5223
- userid: string;
5224
- status: string;
5225
- }
5226
- declare enum MsidType {
5227
- Audio = "sophon_audio",
5228
- VideoLarge = "sophon_video_camera_large",
5229
- VideoSmall = "sophon_video_camera_small",
5230
- Screen = "sophon_video_screen_share",
5231
- Data = "sophon_data"
5232
- }
5233
- interface TrackInfo {
5234
- ssrc: string;
5235
- codec: string;
5236
- msid?: MsidType;
5237
- type: string;
5238
- from?: string | undefined;
5239
- userdata?: string;
5240
- trackId?: string;
5241
- attr?: Record<string, any>;
5242
- pt?: number;
5243
- }
5244
- declare enum PublishType {
5245
- Add = "add",
5246
- Delete = "delete",
5247
- Replace = "replace",
5248
- Stop = "stop",
5249
- UnPublish = "unpublish"
5250
- }
5251
- interface PublishInfo {
5252
- type: PublishType;
5253
- userid: string;
5254
- sessionid: string;
5255
- displayname: string;
5256
- pubid?: string;
5257
- resume?: boolean;
5258
- subscribe: {
5259
- signal: string;
5260
- pullstreamurl: string;
5261
- };
5262
- l1ip?: string;
5263
- callid: string;
5264
- tracks: TrackInfo[];
5265
- traceid?: string;
5266
- signaltid?: string;
5267
- }
5268
- interface RefreshUser {
5269
- userid: string;
5270
- subscribe: {
5271
- pullstreamurl: string;
5272
- };
5273
- }
5274
- interface RefreshInfo {
5275
- pushstreamurl?: string;
5276
- users?: RefreshUser[];
5277
- }
5278
- declare enum VideoStreamSource {
5279
- Camera = 0,
5280
- Screen = 1,
5281
- Image = 2
5282
- }
5283
- declare enum AudioStreamSource {
5284
- Microphone = 0,
5285
- Screen = 1,
5286
- Mixed = 2
5287
- }
5288
- interface PublishExtraParams {
5289
- vMsid?: string;
5290
- aMsid?: string;
5291
- isVideoSmall?: boolean;
5292
- isScreen?: boolean;
5293
- isAudio?: boolean;
5294
- }
5295
- interface _LocalStreamConfig extends IStreamConfig {
5296
- videoProfile?: string;
5297
- screenProfile?: string;
5298
- }
5299
- type LocalStreamConfig = Omit<_LocalStreamConfig, 'custom'>;
5300
- interface PreviewConfig {
5301
- videoElement: HTMLVideoElement;
5302
- screen?: boolean;
5303
- }
5304
- interface PreviewAllConfig {
5305
- primary?: boolean;
5306
- screen?: boolean;
5307
- }
5308
- interface StopPreviewConfig {
5309
- videoElement?: HTMLVideoElement;
5310
- primary?: boolean;
5311
- screen?: boolean;
5312
- }
5313
- interface SubConfig {
5314
- isAudioSubscribing: boolean;
5315
- isVideoSubscribing: boolean;
5316
- isScreenSubscribing: boolean;
5317
- audioEnabled: boolean;
5318
- videoEnabled: boolean;
5319
- screenEnabled: boolean;
5320
- }
5321
- interface StreamOptions {
5322
- audio?: boolean;
5323
- video?: boolean;
5324
- screen?: boolean;
5325
- data?: boolean;
5326
- }
5327
- type PublishOptions = StreamOptions & {
5328
- vMsid?: string;
5329
- };
5330
- type StopPublishOptions = StreamOptions;
5331
- type SubscribeOptions = StreamOptions & {
5332
- aMsid?: string;
5333
- vMsid?: string;
5334
- };
5335
- type UnSubscribeOptions = SubscribeOptions;
5336
- /**
5337
- * ------------------ 模式 ----- 采样率 ----- 声道 ----- 码率(kbps) -----
5338
- *
5339
- * standard: 标准音质 48000 单声道 64
5340
- *
5341
- * high: 高音质 48000 单声道 128
5342
- *
5343
- * standard-stereo: 立体声音质 48000 双声道 80
5344
- *
5345
- * high-stereo: 立体声高音质 48000 双声道 192
922
+ * ------------------ 模式 ----- 采样率 ----- 声道 ----- 码率(kbps) -----
923
+ *
924
+ * standard: 标准音质 48000 单声道 64
925
+ *
926
+ * high: 高音质 48000 单声道 128
927
+ *
928
+ * standard-stereo: 立体声音质 48000 双声道 80
929
+ *
930
+ * high-stereo: 立体声高音质 48000 双声道 192
5346
931
  */
5347
932
  type AudioProfileKey = 'standard' | 'high' | 'standard-stereo' | 'high-stereo';
5348
- declare enum SubscribeReason {
5349
- InRoom = "inRoom",
5350
- Join = "join",
5351
- Publish = "publish",
5352
- User = "user",
5353
- Resume = "resume",
5354
- Retry = "retry",
5355
- Reconnect = "reconnect"
5356
- }
5357
- declare enum PublishReason {
5358
- MANUAL = 0,
5359
- JOIN_CHANNEL = 1,
5360
- ROLE_CHANGE = 2,
5361
- RECONNECT = 3
5362
- }
5363
933
 
5364
934
  interface AliRtcLocalStreamListener {
5365
935
  videotrackended: () => void;
@@ -5514,7 +1084,7 @@ type AudioPluginOptions = {
5514
1084
  dumpAudioData?: boolean;
5515
1085
  aiaecOn?: boolean;
5516
1086
  farMediaStream?: MediaStream;
5517
- slsReporter?: SLSReporter;
1087
+ slsReporter?: any;
5518
1088
  enableSoft3ACheck: boolean;
5519
1089
  useHardOnly: boolean;
5520
1090
  };