aliyun-rtc-sdk 6.11.5 → 6.11.6-beta.2

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.
@@ -1,12 +1,12 @@
1
1
  /// <reference types="dom-mediacapture-transform" />
2
2
 
3
3
  import { default as default_2 } from 'eventemitter3';
4
+ import { default as default_3 } from '@aliyun-sls/web-track-browser';
4
5
  import { IAudioConstraints } from 'media-device';
5
6
  import { IProfile } from 'aliyun-rts-sdk';
6
7
  import { IStreamConfig } from 'aliyun-rts-sdk';
7
8
  import { IVideoConstraints } from 'media-device';
8
9
  import { LocalStream } from 'aliyun-rts-sdk';
9
- import { LogReporter } from 'browser-log-reporter';
10
10
  import { RemoteStream } from 'aliyun-rts-sdk';
11
11
 
12
12
  declare interface AliEngineCameraCapturerConfiguration {
@@ -41,7 +41,7 @@ export declare interface AliRtcAuthInfo {
41
41
  /** 令牌 */
42
42
  token: string;
43
43
  /** 会议id */
44
- callid?: string;
44
+ sessionId?: string;
45
45
  /** 角色鉴权值 */
46
46
  role?: AliRtcSdkTokenRole;
47
47
  }
@@ -124,6 +124,10 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
124
124
  * @ignore
125
125
  */
126
126
  static logName: string;
127
+ /**
128
+ * @ignore
129
+ */
130
+ static logError: boolean;
127
131
  /**
128
132
  * 检查浏览器是否支持 WebRTC
129
133
  * @param {string} direction
@@ -199,11 +203,10 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
199
203
  protected channelProfile: AliRtcSdkChannelProfile;
200
204
  protected clientRole: AliRtcSdkClientRole;
201
205
  protected signalingManager: SignalingManager;
202
- protected userManager: UserManager;
206
+ protected bizControl: BizControl;
203
207
  protected liveTranscoding: AliRtcLiveTranscoding;
204
208
  protected maxSignalingConnectRetryCount?: number;
205
- protected reporter: Reporter;
206
- protected webTrackingClient: WebTrackingClient;
209
+ protected slsReporter: SLSReporter;
207
210
  protected connectState: AliRtcConnectionStatus;
208
211
  protected networkError: boolean;
209
212
  private audioMixerPlugin;
@@ -245,7 +248,7 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
245
248
  /**
246
249
  * 监听 UM 事件
247
250
  */
248
- private addUserManagerListeners;
251
+ private addBizControlListeners;
249
252
  /**
250
253
  * 添加信令处理
251
254
  * @returns {void}
@@ -339,7 +342,29 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
339
342
  private clearCheckAuthInfoTimer;
340
343
  private startDefaultDevicesCapture;
341
344
  /**
342
- * @brief 加入频道
345
+ * @brief 加入频道(单参数)
346
+ * @details 该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
347
+ * @details 一般在调用该方法前会根据场景先选择频道模式,通过调用 {@link setChannelProfile} 实现,默认频道模式为通信模式 {@link AliRtcSdkChannelProfile.AliRtcSdkCommunication}
348
+ * ``` javascript
349
+ * // 设置频道为互动模式
350
+ * engine.setChannelProfile(AliRtcSdkChannelProfile.AliRtcInteractivelive);
351
+ * // 设置角色为主播角色
352
+ * engine.setClientRole(AliRtcSdkClientRole.AliRtcSdkInteractive);
353
+ * ```
354
+ * @param {string} token 单参数认证信息,从App Server获取。
355
+ * @param {string} channelId 频道ID
356
+ * @param {string} userId 用户ID
357
+ * @param {string} userName 任意用于显示的用户名称。不是User ID
358
+ * @note
359
+ * - 异步接口,方法执行成功则为成功入会
360
+ * - 正常情况一个Appid对应一个App,只有同一个AppId的应用可进行互相童话,不同AppId和channelID不同都不能互通
361
+ * - 当入会成功后,会触发远端用户收到 {@link AliRtcEngineEventListener.remoteUserOnLineNotify} 回调
362
+ * - 如果已在会中想重新入会,需要先调用 {@link leaveChannel} 离会,且确保方法执行成功
363
+ * - 用户加入频道后,默认订阅频道内所有其他用户的音视频流,默认推送音视频流到远端,因此将会产生计费,如果想要取消默认订阅可以 {@link joinChannel} 前调用 {@link setDefaultSubscribeAllRemoteAudioStreams} 和 {@link setDefaultSubscribeAllRemoteVideoStreams}
364
+ */
365
+ joinChannel(token: string, channelId: string, userId: string, userName: string): Promise<void>;
366
+ /**
367
+ * @brief 加入频道(多参数)
343
368
  * @details 该方法让用户加入频道,一个频道内可以加入多个用户进行互相通话。
344
369
  * @details 一般在调用该方法前会根据场景先选择频道模式,通过调用 {@link setChannelProfile} 实现,默认频道模式为通信模式 {@link AliRtcSdkChannelProfile.AliRtcSdkCommunication}
345
370
  * ``` javascript
@@ -636,6 +661,19 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
636
661
  * - >100:放大音量
637
662
  */
638
663
  setRecordingVolume(volume: number): void;
664
+ /**
665
+ * @brief 设置播放音量
666
+ * @param volume 播放音量,取值范围[0,100], 0:静音;100:原始音量
667
+ * @note 注意此方法与 {@link setRemoteAudioVolume} 相互影响,以后调用的一个为准
668
+ */
669
+ setPlayoutVolume(volume: number): void;
670
+ /**
671
+ * @brief 设置播放音量
672
+ * @param userId 用户ID
673
+ * @param volume 播放音量,取值范围[0,100], 0:静音;100:原始音量
674
+ * @note 注意此方法与 {@link setPlayoutVolume} 相互影响,以后调用的一个为准
675
+ */
676
+ setRemoteAudioVolume(userId: string, volume: number): void;
639
677
  /**
640
678
  * 设置麦克风 profile
641
679
  *
@@ -659,9 +697,12 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
659
697
  /**
660
698
  * @brief 采集偏好设置
661
699
  * @param cameraCapturerConfiguration 偏好设置
662
- * - videoProfile: videoProfileKey IProfile
663
- * - cameraDirection: 设置采集方向,前置或后置摄像头
664
- * - deviceId: 设置采集相机ID
700
+ * - width: 设置采集分辨率宽度 默认 1280
701
+ * - height: 设置采集分辨率高度 默认 720
702
+ * - frameRate: 设置采集帧率 默认 30
703
+ * - bitrate: 设置采集码率 默认 2000
704
+ * - cameraDirection: 设置采集方向,前置或后置摄像头
705
+ * - deviceId: 设置采集相机ID
665
706
  */
666
707
  setCameraCapturerConfiguration(cameraCapturerConfiguration: AliEngineCameraCapturerConfiguration): Promise<void>;
667
708
  /**
@@ -1124,6 +1165,11 @@ declare interface AliRtcEngineEventListener {
1124
1165
  * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
1125
1166
  */
1126
1167
  remoteVideoAutoPlayFail: (uid: string, videoTrack: AliRtcVideoTrack) => void;
1168
+ /**
1169
+ * rtc 传输数据统计
1170
+ * @param stats 统计信息
1171
+ */
1172
+ rtcStats: (stats: any) => void;
1127
1173
  /**
1128
1174
  * 发布视频流的数据统计
1129
1175
  * @param aliRtcStats 统计信息
@@ -1437,6 +1483,8 @@ export declare enum AliRtcErrorCode {
1437
1483
 
1438
1484
  declare class AliRtcLiveTranscoding {
1439
1485
  authInfo?: AliRtcAuthInfo;
1486
+ private slsReporter;
1487
+ constructor(slsReporter: SLSReporter);
1440
1488
  private doRequest;
1441
1489
  setAuthInfo(authInfo: AliRtcAuthInfo): void;
1442
1490
  clear(): void;
@@ -1747,6 +1795,7 @@ export declare abstract class AliRtcPlugin extends default_2<AliRtcPluginListene
1747
1795
  lastOutputAudioTrack?: MediaStreamTrack;
1748
1796
  lastInputVideoTrack?: MediaStreamTrack;
1749
1797
  lastOutputVideoTrack?: MediaStreamTrack;
1798
+ private _hasCleared;
1750
1799
  constructor(name: string, streamType?: AliRtcRawDataStreamType, trackType?: AliRtcPluginTrackType);
1751
1800
  get initOptions(): {};
1752
1801
  getOptions(): any;
@@ -2058,6 +2107,182 @@ declare enum AudioStreamSource {
2058
2107
  Mixed = 2
2059
2108
  }
2060
2109
 
2110
+ declare class BizControl extends default_2<BizControlListener> {
2111
+ /**
2112
+ * @ignore
2113
+ */
2114
+ static logName: string;
2115
+ protected self: LocalUser | undefined;
2116
+ protected userMap: RemoteUserMap;
2117
+ private usersViewMap;
2118
+ rtsManager: RtsManager;
2119
+ protected localStreamManager: LocalStreamManager;
2120
+ protected authInfo?: AliRtcAuthInfo;
2121
+ protected signalingManager: SignalingManager;
2122
+ pluginManager: PluginManager;
2123
+ protected slsReporter: SLSReporter;
2124
+ private statsMonitorId?;
2125
+ private autoSubAudio;
2126
+ private autoSubVideo;
2127
+ private autoSubScreen;
2128
+ private wantSubAudio;
2129
+ private wantSubVideo;
2130
+ private wantSubScreen;
2131
+ private defaultStreamType;
2132
+ private audioMuted;
2133
+ private playoutVolume;
2134
+ private audioVolumeIndicationInterval;
2135
+ private indicationTimer;
2136
+ constructor(config: BizControlConfig);
2137
+ private addSignalingManagerListener;
2138
+ isAutoSubAudio(): boolean;
2139
+ setAutoSubAudio(value: boolean): void;
2140
+ isAutoSubVideo(): boolean;
2141
+ setAutoSubVideo(value: boolean): void;
2142
+ isAutoSubScreen(): boolean;
2143
+ setAutoSubScreen(value: boolean): void;
2144
+ isWantSubAudio(): boolean;
2145
+ setWantSubAudio(value: boolean): void;
2146
+ isWantSubVideo(): boolean;
2147
+ setWantSubVideo(value: boolean): void;
2148
+ isWantSubScreen(): boolean;
2149
+ setWantSubScreen(value: boolean): void;
2150
+ setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
2151
+ setRemoteUserVideoStreamType(userId: string, type: AliRtcVideoStreamType): void;
2152
+ setAudioMuted(mute: boolean): void;
2153
+ setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2154
+ setRemoteViewConfig(uid: string, view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2155
+ get channel(): string | undefined;
2156
+ get userId(): string | undefined;
2157
+ get remoteUsers(): RemoteUser[];
2158
+ /**
2159
+ * 获取推流对象,只能是自己
2160
+ */
2161
+ get publisher(): LocalUser | undefined;
2162
+ get isSubscribing(): boolean;
2163
+ /**
2164
+ * 处理远端用户推流状态变化
2165
+ * @param {string} userId
2166
+ * @param {string} displayname
2167
+ * @param {string} callid
2168
+ * @param {string} pullStreamUrl
2169
+ * @param {TrackInfo[]} tracks
2170
+ * @returns {void}
2171
+ */
2172
+ onRemotePublishStateChange(publishInfo: PublishUser): void;
2173
+ /**
2174
+ * 登陆成功后初始化用户管理,创建自己
2175
+ * @param {AliRtcAuthInfo} authInfo
2176
+ * @param {string} pushStreamUrl
2177
+ * @returns {Promise<void>}
2178
+ */
2179
+ init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
2180
+ /**
2181
+ * 离会后清除所有数据
2182
+ * @returns {Promise<void>}
2183
+ */
2184
+ clear(): Promise<void>;
2185
+ private startStatsMonitor;
2186
+ private stopStatsMonitor;
2187
+ /**
2188
+ * 添加远端用户
2189
+ * @param {string} userId
2190
+ * @param {string} displayName
2191
+ * @returns {void}
2192
+ */
2193
+ addUser(userId: string, displayName: string, reason: SubscribeReason): RemoteUser;
2194
+ /**
2195
+ * 执行添加远端用户
2196
+ * @param {string} userId
2197
+ * @param {string} displayName
2198
+ * @returns {RemoteUser}
2199
+ */
2200
+ private executeAddUser;
2201
+ /**
2202
+ * 远端用户设备状态变化
2203
+ * @param {DeviceStatusChangeType} event
2204
+ * @param {string} userId
2205
+ */
2206
+ private onRemoteDeviceStatusChange;
2207
+ /**
2208
+ * 远端流数据采集上报
2209
+ * @param {any} stat
2210
+ */
2211
+ private onRemoteStatReport;
2212
+ /**
2213
+ * rts 单 PC 订阅超限
2214
+ */
2215
+ private onSubscribeExceeds;
2216
+ /**
2217
+ * 移除远端用户
2218
+ * @param {LeaveInfo} user
2219
+ * @returns {Promise<void>}
2220
+ */
2221
+ removeLeftUser(user: LeaveInfo): Promise<void>;
2222
+ /**
2223
+ * 更新远端用户数据
2224
+ * @param {JoinInfo[]} users
2225
+ * @returns {{joinList: JoinInfo[], leaveList: LeaveInfo[], presentList: JoinInfo[]}}
2226
+ */
2227
+ updateUsers(users: JoinInfo[]): {
2228
+ joinList: JoinInfo[];
2229
+ leaveList: LeaveInfo[];
2230
+ presentList: JoinInfo[];
2231
+ };
2232
+ /**
2233
+ * 根据 userId 获取 RemoteUser
2234
+ * @param {string} userId
2235
+ * @returns {RemoteUser | undefined}
2236
+ */
2237
+ getRemoteUser(userId: string): RemoteUser | undefined;
2238
+ /**
2239
+ * 更新远端用户设备信息
2240
+ * @param {RemoteUserStatus} user
2241
+ * @returns {boolean} true: 用户状态改变 false: 用户状态没有改变
2242
+ */
2243
+ updateRemoteUserDeviceStatus(user: RemoteUserStatus): void;
2244
+ updateAudioWant(uid: string, sub: boolean): void;
2245
+ updateVideoWant(uid: string, sub: boolean): void;
2246
+ updateScreenWant(uid: string, sub: boolean): void;
2247
+ private stopIndication;
2248
+ private startIndication;
2249
+ enableAudioVolumeIndication(interval: number): void;
2250
+ setPlayoutVolume(volume: number): void;
2251
+ refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
2252
+ setEnableMediaExtensionMsg(enable: boolean): void;
2253
+ setAudioRedEnabled(enable: boolean): void;
2254
+ }
2255
+
2256
+ declare interface BizControlConfig {
2257
+ slsReporter: SLSReporter;
2258
+ signalingManager: SignalingManager;
2259
+ }
2260
+
2261
+ declare interface BizControlListener {
2262
+ [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
2263
+ [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
2264
+ [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
2265
+ remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
2266
+ audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
2267
+ videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
2268
+ screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
2269
+ userAudioMuted: (uid: string, isMute: boolean) => void;
2270
+ userVideoMuted: (uid: string, isMute: boolean) => void;
2271
+ userScreenMuted: (userId: string, isMute: boolean) => void;
2272
+ audioVolume: (speakers: {
2273
+ userId: string;
2274
+ volume: number;
2275
+ }[]) => void;
2276
+ rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
2277
+ rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
2278
+ rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
2279
+ rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
2280
+ rtcStats: (stats: any) => void;
2281
+ remoteAudioAutoPlayFail: (uid: string) => void;
2282
+ remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
2283
+ remoteSubscribeError: (error: AliRtcError) => void;
2284
+ }
2285
+
2061
2286
  declare enum ClientEventType {
2062
2287
  PullStreamStats = "remoteStat",
2063
2288
  RtsSubscribeExceeds = "rtsSubscribeExceeds",
@@ -2114,16 +2339,6 @@ declare enum DisplayType {
2114
2339
  WHEN_NO_VIDEO = 2
2115
2340
  }
2116
2341
 
2117
- declare enum EventId {
2118
- JoinChannel = 70012,
2119
- JoinChannelRes = 70013,
2120
- LeaveChannel = 70015,
2121
- EnvCheck = 100001,
2122
- Push = 10030,
2123
- Pull = 10050,
2124
- SubscribeStats = 10080
2125
- }
2126
-
2127
2342
  declare interface ISignalingInterface {
2128
2343
  join(authInfo: AliRtcAuthInfo, userName: string, connectRetryCount?: number): Promise<JoinResult>;
2129
2344
  leave(): Promise<SignalingResult>;
@@ -2195,6 +2410,7 @@ declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
2195
2410
  */
2196
2411
  static logName: string;
2197
2412
  private pluginManager;
2413
+ private slsReporter;
2198
2414
  private publishingCameraVideoStream;
2199
2415
  private publishingScreenVideoStream;
2200
2416
  cameraStreamInfo: AliRtcLocalStreamInfo;
@@ -2205,7 +2421,7 @@ declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
2205
2421
  private _publishLocalAudioStreamEnabled;
2206
2422
  private _publishLocalVideoStreamEnabled;
2207
2423
  private _publishLocalScreenStreamEnabled;
2208
- constructor(pluginManager: PluginManager);
2424
+ constructor(pluginManager: PluginManager, slsReporter: SLSReporter);
2209
2425
  get hasCamera(): boolean;
2210
2426
  get audioCaptureDisabled(): boolean;
2211
2427
  set audioCaptureDisabled(closed: boolean);
@@ -2298,6 +2514,7 @@ declare class LocalUser extends User {
2298
2514
  */
2299
2515
  static logName: string;
2300
2516
  protected url: string;
2517
+ private joinTime;
2301
2518
  private _isPublishing;
2302
2519
  private publishPromise;
2303
2520
  private previewElements;
@@ -2308,8 +2525,11 @@ declare class LocalUser extends User {
2308
2525
  protected signalingManager: SignalingManager;
2309
2526
  traceId: string;
2310
2527
  private monitorTimerId?;
2311
- protected reporter: Reporter;
2312
- protected webTrackingClient: WebTrackingClient;
2528
+ private monitorDataCache;
2529
+ private trackTraceIdMap;
2530
+ private candidateDataCache;
2531
+ private pcMediaStatsMap;
2532
+ protected slsReporter: SLSReporter;
2313
2533
  private audioPubState;
2314
2534
  private videoPubState;
2315
2535
  private videoSmallPubState;
@@ -2403,12 +2623,15 @@ declare class LocalUser extends User {
2403
2623
  createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
2404
2624
  stopLocalStream(options: PublishOptions): Promise<void>;
2405
2625
  private compareAndPublish;
2626
+ private reportAudioProfile;
2627
+ private reportVideoProfile;
2628
+ private reportScreenProfile;
2406
2629
  /**
2407
2630
  * 开始推流
2408
2631
  * @param isResume 是否是恢复推流
2409
2632
  * @returns
2410
2633
  */
2411
- startPublish(isResume?: boolean): Promise<void>;
2634
+ startPublish(isResume?: boolean, reason?: PublishReason): Promise<void>;
2412
2635
  /**
2413
2636
  * 对比本地流和正在推流,进行推流更新
2414
2637
  * @param isResume 是否是恢复推流
@@ -2456,6 +2679,10 @@ declare class LocalUser extends User {
2456
2679
  private onTrackEnd;
2457
2680
  private resetPreviewElements;
2458
2681
  private resetSecondayPreviewElements;
2682
+ getMediaStats(id: string): any;
2683
+ private reportPublishMonitor;
2684
+ private reportNetwork;
2685
+ private startStreamMonitor;
2459
2686
  /**
2460
2687
  * 停止本地流数据采集
2461
2688
  */
@@ -2480,14 +2707,14 @@ declare class LocalUser extends User {
2480
2707
  getStats(): Promise<{
2481
2708
  audio: AliRtcLocalAudioStats[];
2482
2709
  video: AliRtcLocalVideoStats[];
2710
+ transport: any;
2483
2711
  }>;
2484
2712
  }
2485
2713
 
2486
2714
  declare interface LocalUserConfig {
2487
2715
  rtsManager: RtsManager;
2488
2716
  localStreamManager: LocalStreamManager;
2489
- reporter: Reporter;
2490
- webTrackingClient: WebTrackingClient;
2717
+ slsReporter: SLSReporter;
2491
2718
  signalingManager: SignalingManager;
2492
2719
  pluginManager: PluginManager;
2493
2720
  audioVolumeIndicationInterval: number;
@@ -2498,12 +2725,16 @@ declare interface LocalUserConfig {
2498
2725
  * 在入会之前,会将埋点缓存,入会后以每200ms一条的速度将缓存的埋点按顺序上报
2499
2726
  */
2500
2727
  declare class LogClient {
2501
- protected reporter?: LogReporter;
2728
+ protected tracker?: default_3;
2502
2729
  protected param?: any;
2503
2730
  protected msgCacheArr: any[];
2504
2731
  protected index: number;
2505
- constructor();
2732
+ protected stsOpt?: any;
2733
+ protected slsToken?: SLSSTSToken;
2734
+ protected ossToken?: OSSSTSToken;
2735
+ private createTracker;
2506
2736
  start(info: AliRtcAuthInfo): void;
2737
+ updateToken(slsToken: SLSSTSToken, ossToken?: OSSSTSToken): void;
2507
2738
  /**
2508
2739
  * 断开连接
2509
2740
  */
@@ -2517,11 +2748,10 @@ declare class LogClient {
2517
2748
  * 初始化公共参数
2518
2749
  */
2519
2750
  protected initParam(info: AliRtcAuthInfo): void;
2520
- /**
2521
- * 通过LogReporter发送日志
2522
- * @param log
2523
- */
2524
- protected realSendReport(log: any): void;
2751
+ }
2752
+
2753
+ declare interface LogInfo {
2754
+ [key: string]: string | number;
2525
2755
  }
2526
2756
 
2527
2757
  declare interface MediaTrackInfo {
@@ -2551,6 +2781,24 @@ declare enum MsidType {
2551
2781
  Screen = "sophon_video_screen_share"
2552
2782
  }
2553
2783
 
2784
+ declare interface OSSSTSToken {
2785
+ access_key_id: string;
2786
+ access_key_secret: string;
2787
+ security_token: string;
2788
+ region_endpoint: string;
2789
+ bucket_name: string;
2790
+ expiration: number;
2791
+ }
2792
+
2793
+ declare interface OSSToken {
2794
+ access_key_id: string;
2795
+ access_key_secret: string;
2796
+ security_token: string;
2797
+ region_endpoint: string;
2798
+ bucket_name: string;
2799
+ expiration: number;
2800
+ }
2801
+
2554
2802
  declare class PluginManager extends default_2<PluginManagerListener> {
2555
2803
  private plugins;
2556
2804
  add(plugin: AliRtcPlugin, options: any): void;
@@ -2585,6 +2833,7 @@ declare interface PublishExtraParams {
2585
2833
  }
2586
2834
 
2587
2835
  declare interface PublishInfo {
2836
+ type: PublishType;
2588
2837
  userid: string;
2589
2838
  sessionid: string;
2590
2839
  displayname: string;
@@ -2604,6 +2853,11 @@ declare type PublishOptions = StreamOptions & {
2604
2853
  vMsid?: string;
2605
2854
  };
2606
2855
 
2856
+ declare enum PublishReason {
2857
+ MANUAL = 0,
2858
+ JOINCHANNEL = 1
2859
+ }
2860
+
2607
2861
  declare interface PublishStreamInfo {
2608
2862
  audio?: LocalStream;
2609
2863
  video?: LocalStream;
@@ -2613,6 +2867,14 @@ declare interface PublishStreamInfo {
2613
2867
  screenProfile?: LocalProfileManager;
2614
2868
  }
2615
2869
 
2870
+ declare enum PublishType {
2871
+ Add = "add",
2872
+ Delete = "delete",
2873
+ Replace = "replace",
2874
+ Stop = "stop",
2875
+ UnPublish = "unpublish"
2876
+ }
2877
+
2616
2878
  declare interface PublishUser {
2617
2879
  callid: string;
2618
2880
  clientrole?: string;
@@ -2679,6 +2941,7 @@ declare class RemoteStreamInfo extends default_2<StreamListener> {
2679
2941
  * @returns
2680
2942
  */
2681
2943
  getScreenInfo(): RemoteMediaTrackInfo;
2944
+ get subscribingInfos(): RemoteMediaTrackInfo[];
2682
2945
  /**
2683
2946
  * 远端流是否包含音频轨道
2684
2947
  * @returns
@@ -2756,7 +3019,7 @@ declare class RemoteUser extends User {
2756
3019
  static logName: string;
2757
3020
  remoteCallid: string;
2758
3021
  remoteUserInfo: AliRtcRemoteUserInfo;
2759
- protected localUserId: string;
3022
+ protected localUser?: LocalUser;
2760
3023
  protected lastPubId: string;
2761
3024
  protected stream?: RemoteStream;
2762
3025
  protected screenStream?: RemoteStream;
@@ -2768,13 +3031,13 @@ declare class RemoteUser extends User {
2768
3031
  protected secondaryMediaStream?: MediaStream;
2769
3032
  protected prevSubConfig?: SubConfig;
2770
3033
  protected signalingManager: SignalingManager;
2771
- protected reporter: Reporter;
2772
- protected webTrackingClient: WebTrackingClient;
3034
+ protected slsReporter: SLSReporter;
2773
3035
  private wantSubAudio;
2774
3036
  private wantSubVideo;
2775
3037
  private wantSubScreen;
2776
3038
  private defaultVideoStreamType;
2777
3039
  private audioMuted;
3040
+ private playoutVolume;
2778
3041
  private audioSubState;
2779
3042
  private videoSubState;
2780
3043
  private videoLargeSubState;
@@ -2782,6 +3045,9 @@ declare class RemoteUser extends User {
2782
3045
  private screenSubState;
2783
3046
  streamInfo: RemoteStreamInfo;
2784
3047
  streamUrl: string;
3048
+ private monitorTimerId?;
3049
+ private monitorDataCache;
3050
+ private trackTraceIdMap;
2785
3051
  constructor(config: RemoteUserConfig);
2786
3052
  isWantSubAudio(): boolean;
2787
3053
  setWantSubAudio(value: boolean): void;
@@ -2791,6 +3057,7 @@ declare class RemoteUser extends User {
2791
3057
  setWantSubScreen(value: boolean): void;
2792
3058
  setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
2793
3059
  setAudioMuted(value: boolean): void;
3060
+ setPlayoutVolume(value: number): void;
2794
3061
  getAudioMuted(): boolean;
2795
3062
  get hasAudioTrack(): boolean;
2796
3063
  get hasVideoTrack(): boolean;
@@ -2833,7 +3100,7 @@ declare class RemoteUser extends User {
2833
3100
  * @param {SubscribeOptions} options
2834
3101
  * @returns {Promise<void>} 返回可播放的 MediaStream,可能为空。如果同时订阅了主流和辅流,只会返回主流对应的 MediaStream
2835
3102
  */
2836
- subscribe(options?: SubscribeOptions): Promise<void>;
3103
+ subscribe(options?: SubscribeOptions, reason?: SubscribeReason, startTs?: number): Promise<void>;
2837
3104
  /**
2838
3105
  * 订阅远端流
2839
3106
  * @param {SubscribeOptions} options 订阅配置
@@ -2881,7 +3148,7 @@ declare class RemoteUser extends User {
2881
3148
  * 尝试更新订阅
2882
3149
  * 1. 需要新增订阅的情况:想要订阅 & 没有正在订阅 & 远端有流
2883
3150
  */
2884
- updateSubscribe(): {
3151
+ updateSubscribe(reason: SubscribeReason): {
2885
3152
  addOption: SubscribeOptions;
2886
3153
  deleteOption: SubscribeOptions;
2887
3154
  };
@@ -2922,6 +3189,12 @@ declare class RemoteUser extends User {
2922
3189
  * @param {number} interval 时间间隔
2923
3190
  */
2924
3191
  enableAudioVolumeIndication(interval: number): void;
3192
+ private reportSubscribeMonitor;
3193
+ private startStreamMonitor;
3194
+ /**
3195
+ * 停止本地流数据采集
3196
+ */
3197
+ private stopStreamMonitor;
2925
3198
  }
2926
3199
 
2927
3200
  declare interface RemoteUserConfig {
@@ -2931,11 +3204,11 @@ declare interface RemoteUserConfig {
2931
3204
  usersViewMap: {
2932
3205
  [key: string]: RemoteUserViewMap;
2933
3206
  };
2934
- reporter: Reporter;
2935
- webTrackingClient: WebTrackingClient;
3207
+ slsReporter: SLSReporter;
2936
3208
  signalingManager: SignalingManager;
2937
- localUserId: string;
3209
+ localUser?: LocalUser;
2938
3210
  audioVolumeIndicationInterval: number;
3211
+ playoutVolume: number;
2939
3212
  }
2940
3213
 
2941
3214
  declare interface RemoteUserMap {
@@ -2953,222 +3226,52 @@ declare interface RemoteUserViewMap {
2953
3226
  }
2954
3227
 
2955
3228
  /**
2956
- * 日志埋点类
2957
- * 每个埋点暴露对应的接口
3229
+ * RoomServerMessageCenter支持的事件
2958
3230
  */
2959
- declare class Reporter {
2960
- protected logClient: LogClient;
2961
- constructor();
2962
- /**
2963
- * 开始建立连接
2964
- * @param authInfo
2965
- */
2966
- start(info: AliRtcAuthInfo): void;
2967
- /**
2968
- * 断开连接
2969
- */
2970
- stop(): void;
2971
- /**
2972
- * 加入房间成功埋点
2973
- * @param {number} joinTime
2974
- * @param {number} result
2975
- * @param {string} tid
2976
- */
2977
- reportJoin(joinTime: number, result: number, tid: string): void;
3231
+ declare interface RoomServerListener {
3232
+ onJoinChannelResult: (data: any) => void;
3233
+ onPublishResult: (code: number, tid: string, description: string) => void;
3234
+ onNotifyJoin: (users: JoinInfo[]) => void;
3235
+ onNotifyStatus: (users: RemoteUserStatus[]) => void;
3236
+ onLeaveResult: (code: number, tid: string) => void;
3237
+ onRoleUpdateResult: (code: number, tid: string, description: string) => void;
3238
+ onRefreshUrlResult: (data: any) => void;
3239
+ onNotifyLeave: (users: LeaveInfo[]) => void;
3240
+ onNotifyPublish: (users: PublishUser[]) => void;
3241
+ onStatusReport: (code: number, tid: string, description: string) => void;
3242
+ onBye: (reason: AliRtcOnByeType, description: string) => void;
3243
+ onKeepAliveRsp: () => void;
3244
+ onConnectFail: (err: AliRtcError) => void;
3245
+ onNetworkError: (err: AliRtcError) => void;
3246
+ onAuthInvalid: () => void;
3247
+ onReconnectStart: () => void;
3248
+ onReconnectFail: (err: AliRtcError) => void;
3249
+ onReconnectSuccess: (users: JoinInfo[]) => void;
3250
+ onError: (err: AliRtcError) => void;
3251
+ }
3252
+
3253
+ declare class RtsManager extends default_2<RtsManagerEventListener> {
2978
3254
  /**
2979
- * 调用 client.join 入会上报事件及用户等信息
2980
- * @param {string} usrid 用户id
2981
- * @param {string} usrn 用户名
2982
- * @param {string} channelid 频道id
2983
- */
2984
- reportJoinInvoked(usrid: string, usrn: string, channelid: string): void;
2985
- /**
2986
- * 上报ice状态变化
2987
- * @param {string} calid
2988
- * @param {string} icestate
2989
- * @param {number} evt_seq
2990
- */
2991
- reportIceState(calid: string, icestate: string, evt_seq: number): void;
2992
- /**
2993
- * 用户离开频道事件埋点
2994
- * @param {number} leaveTime
2995
- * @param {number} result
2996
- * @param {string} tid
2997
- */
2998
- reportLeave(leaveTime: number, result: number, tid: string): void;
2999
- /**
3000
- * 调用 client.leave 离会上报事件
3001
- */
3002
- reportLeaveInvoked(): void;
3003
- /**
3004
- * 推流事件上报
3005
- * @param {string} callid
3006
- * @param {boolean} isLargeVideo
3007
- * @param {boolean} isSmallVideo
3008
- * @param {boolean} isScreenShare
3009
- * @param {boolean} isAudio
3010
- * @param {number} result
3011
- * @param {string} tid
3012
- * @param {number} pubTime
3013
- */
3014
- reportPublish(callid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number | undefined, tid: string, pubTime: number): void;
3015
- /**
3016
- * 调用 client.publish 推流上报事件及流轨道等信息
3017
- * @param {boolean} [isLargeVideo] 是否推视频大流
3018
- * @param {boolean} [isSmallVideo] 是否推视频小流
3019
- * @param {boolean} [isScreenShare] 是否推屏幕流
3020
- * @param {boolean} [isAudio] 是否推音频流
3021
- */
3022
- reportPublishInvoked(isLargeVideo?: boolean, isSmallVideo?: boolean, isScreenShare?: boolean, isAudio?: boolean): void;
3023
- /**
3024
- * republish事件上报
3025
- * @param callid
3026
- * @param islarge 是否推大流
3027
- * @param isScreenShare 是否推屏幕流
3028
- * @param isAudio 是否推音频流
3029
- * @param result 推流结果(0成功,非0失败)
3030
- * @param tid tid
3031
- * @param repubTime repub耗时
3032
- * @param msg 详情描述
3033
- */
3034
- reportRepublish(callid: string, isLarge: boolean, isScreen: boolean, isAudio: boolean, result: number, tid: string, repubTime: number, msg: string): void;
3035
- /**
3036
- * 用户调用LocalStream.addTrack 或者 LocalStream.removeTrack
3037
- * @param callid
3038
- * @param trackType
3039
- * @param state -1: remove 0: replace 1: add
3040
- */
3041
- reportRepublishInvoked(callid: string, trackType: string, state: 0 | 1 | -1): void;
3042
- /**
3043
- * 停止推流事件上报
3044
- * @param {string} callid
3045
- * @param {number} unpubTime
3046
- * @param {number} result
3047
- * @param {string} tid
3048
- */
3049
- reportUnpublish(callid: string, unpubTime: number, result: number, tid: string): void;
3050
- /**
3051
- * 调用 client.unpublish 停止推流上报事件
3052
- */
3053
- reportUnpublishInvoked(): void;
3054
- /**
3055
- * 订阅事件埋点
3056
- * @param {string} callid
3057
- * @param {string} remoteid
3058
- * @param {boolean} isLargeVideo
3059
- * @param {boolean} isSmallVideo
3060
- * @param {boolean} isScreenShare
3061
- * @param {boolean} isAudio
3062
- * @param {number} result
3063
- * @param {string} tid
3064
- * @param {number} subTime
3065
- */
3066
- reportSubscribe(callid: string, remoteid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number, tid: string, subTime: number, usrid: string): void;
3067
- /**
3068
- * 调用 client.subscribe 拉流上报事件及用户信息、流轨道等信息
3069
- * @param {string} rmtid 远程流所属的用户id
3070
- * @param {boolean} [isLargeVideo] 是否推视频大流
3071
- * @param {boolean} [isSmallVideo] 是否推视频小流
3072
- * @param {boolean} [isScreenShare] 是否推屏幕流
3073
- * @param {boolean} [isAudio] 是否推音频流
3074
- */
3075
- reportSubscribeInvoked(rmtid?: string, isLargeVideo?: boolean, isSmallVideo?: boolean, isScreenShare?: boolean, isAudio?: boolean): void;
3076
- /**
3077
- * 停止订阅事件埋点
3078
- * @param {string} callid
3079
- * @param {string} remoteid
3080
- * @param {number} unsubTime
3081
- * @param {number} result
3082
- * @param {string} tid
3083
- */
3084
- reportUnsubscribe(callid: string, remoteid: string, unsubTime: number, result: number, tid: string): void;
3085
- /**
3086
- * 调用 client.unsubscribe 停止拉流上报事件
3087
- * @param {string} rmtid 远程流所属的用户id
3088
- */
3089
- reportUnsubscribeInvoked(rmtid?: string): void;
3090
- /**
3091
- * 更新角色埋点
3092
- * @param {string|undefined} or 旧的角色
3093
- * @param {string} nr 新的角色
3094
- * @param {number} ctm 耗时
3095
- * @param {number} rslt 是否成功
3096
- */
3097
- reportRoleUpdate(or: string | undefined, nr: string, ctm: number, rslt: number): void;
3098
- /**
3099
- * 调用 client.setClientRole 更新角色上报事件
3100
- * @param {string} nr 新角色值
3101
- */
3102
- reportRoleUpdateInvoked(nr: string): void;
3103
- /**
3104
- * 设置camera videoprofile
3105
- */
3106
- reportVideoProfile(profile: string): void;
3107
- /**
3108
- * 设置screenshare videoprofile
3109
- */
3110
- reportScreenProfile(profile: string): void;
3111
- /**
3112
- * 错误事件埋点
3113
- * @param err
3114
- */
3115
- reportError(err: any): void;
3116
- /**
3117
- * 日志埋点
3118
- * 在埋点中增加tm字段,表示发生埋点的客户端本地时间
3119
- * @param {any} param 埋点内容
3120
- */
3121
- protected log(param: any): void;
3122
- /**
3123
- * 将Object转换成string
3124
- * @param {any} data
3125
- * @returns {string}
3126
- */
3127
- protected data2String(data: any): string;
3128
- }
3129
-
3130
- /**
3131
- * RoomServerMessageCenter支持的事件
3132
- */
3133
- declare interface RoomServerListener {
3134
- onJoinChannelResult: (data: any) => void;
3135
- onPublishResult: (code: number, tid: string, description: string) => void;
3136
- onNotifyJoin: (users: JoinInfo[]) => void;
3137
- onNotifyStatus: (users: RemoteUserStatus[]) => void;
3138
- onLeaveResult: (code: number, tid: string) => void;
3139
- onRoleUpdateResult: (code: number, tid: string, description: string) => void;
3140
- onRefreshUrlResult: (data: any) => void;
3141
- onNotifyLeave: (users: LeaveInfo[]) => void;
3142
- onNotifyPublish: (users: PublishUser[]) => void;
3143
- onStatusReport: (code: number, tid: string, description: string) => void;
3144
- onBye: (reason: AliRtcOnByeType, description: string) => void;
3145
- onKeepAliveRsp: () => void;
3146
- onConnectFail: (err: AliRtcError) => void;
3147
- onNetworkError: (err: AliRtcError) => void;
3148
- onAuthInvalid: () => void;
3149
- onReconnectStart: () => void;
3150
- onReconnectFail: (err: AliRtcError) => void;
3151
- onReconnectSuccess: (users: JoinInfo[]) => void;
3152
- onError: (err: AliRtcError) => void;
3153
- }
3154
-
3155
- declare class RtsManager extends default_2<RtsManagerEventListener> {
3156
- /**
3157
- * @ignore
3255
+ * @ignore
3158
3256
  */
3159
3257
  static logName: string;
3160
3258
  private rts;
3161
3259
  private encodedInsertableStreams;
3162
3260
  private audioRedEnabled;
3163
3261
  private localStreamManager;
3262
+ private slsReporter;
3164
3263
  private connecting;
3165
3264
  private connected;
3265
+ private _pcTraceId;
3266
+ private _localJoinTime;
3166
3267
  private connectionResolve?;
3167
3268
  connectingPromise?: Promise<unknown>;
3168
3269
  private dcResolve?;
3169
3270
  dcConnectingPromise?: Promise<unknown>;
3170
3271
  private _publishingTracks;
3171
- constructor(localStreamManager: LocalStreamManager);
3272
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter);
3273
+ get pcTraceId(): string;
3274
+ set localJoinTime(time: number);
3172
3275
  setEncodedInsertableStreams(enable: boolean): void;
3173
3276
  setAudioRedEnabled(enable: boolean): void;
3174
3277
  destroy(): void;
@@ -3181,10 +3284,9 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3181
3284
  private updatePublishingTracks;
3182
3285
  private httpPublish;
3183
3286
  private waitPublishSender;
3184
- private checkSubscribeStats;
3185
3287
  getPublishVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3186
3288
  getPublishAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3187
- publishAdd(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams, isResume?: boolean, retryTimes?: number, waitSender?: boolean): Promise<string>;
3289
+ publishAdd(streamUrl: string, stream: LocalStream, callId: string, extra?: PublishExtraParams, isResume?: boolean, retryTimes?: number, waitSender?: boolean, reason?: PublishReason): Promise<string>;
3188
3290
  publishDelete(streamUrl: string, options: PublishOptions): Promise<string>;
3189
3291
  publishReplace(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams): Promise<string>;
3190
3292
  publishStop(streamUrl: string): Promise<string>;
@@ -3202,17 +3304,12 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3202
3304
  stream: any;
3203
3305
  } | undefined>;
3204
3306
  subscibeStop(streamUrl: string): Promise<void>;
3205
- publish(streamUrl: string, isResume?: boolean): Promise<string>;
3206
- subscribe(remoteSubscribeOptions: RemoteSubscribeOptions): Promise<{
3207
- traceId: string;
3208
- stream: RemoteStream;
3209
- } | {
3210
- url: string;
3211
- stream: RemoteStream;
3212
- traceId?: string | undefined;
3213
- } | null>;
3307
+ publish(streamUrl: string, callId: string, isResume?: boolean, reason?: PublishReason): Promise<string>;
3308
+ subscribe(remoteSubscribeOptions: RemoteSubscribeOptions, reason: SubscribeReason, callId: string, remoteCallId: string, startTs: number): Promise<any>;
3214
3309
  getSubscribeVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3215
3310
  getSubscribeAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3311
+ getStreamByMsid(config: any): LocalStream | RemoteStream;
3312
+ getPCStats(): Promise<any>;
3216
3313
  sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
3217
3314
  }
3218
3315
 
@@ -3232,14 +3329,16 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3232
3329
  protected clientRole: AliRtcSdkClientRole;
3233
3330
  protected env: AliRtcEnv;
3234
3331
  protected maxConnectRetryCount?: number;
3235
- constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, env?: AliRtcEnv);
3332
+ stsManager: StsManager;
3333
+ private slsReporter;
3334
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
3236
3335
  reset(): void;
3237
3336
  /**
3238
3337
  * 向业务信令发送入会
3239
3338
  * @param {AliRtcAuthInfo} authInfo
3240
3339
  * @returns
3241
3340
  */
3242
- join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number): Promise<JoinResult>;
3341
+ join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number, timeRecorder?: TimeRecorder): Promise<JoinResult>;
3243
3342
  retryJoin(): void;
3244
3343
  /**
3245
3344
  * 向业务信令发送离会
@@ -3348,6 +3447,186 @@ declare interface SignalingResult {
3348
3447
  message?: string;
3349
3448
  }
3350
3449
 
3450
+ /**
3451
+ * 日志埋点类
3452
+ * 每个埋点暴露对应的接口
3453
+ */
3454
+ declare class SLSReporter {
3455
+ private engine;
3456
+ protected logClient: LogClient;
3457
+ protected authInfo?: AliRtcAuthInfo;
3458
+ private static staticClient;
3459
+ private static getLogClient;
3460
+ static reportOSSUpload(sessionId: string, date: string, responseCode?: number): void;
3461
+ constructor(engine: AliRtcEngine);
3462
+ /**
3463
+ * 开始建立连接
3464
+ * @param authInfo
3465
+ */
3466
+ start(info: AliRtcAuthInfo): void;
3467
+ updateToken(token: SLSSTSToken, ossToken?: OSSSTSToken): void;
3468
+ /**
3469
+ * 断开连接
3470
+ */
3471
+ stop(): void;
3472
+ reportPublishMonitor(callId: string, traceId: string, msid: string, track: MediaStreamTrack | undefined, stats: any[]): void;
3473
+ reportSubscribeMonitor(callId: string, remoteId: string, traceId: string, msid: string, stats: any[]): void;
3474
+ reportNetworkMonitor(candidates: any[]): void;
3475
+ /**
3476
+ * 加入房间成功埋点
3477
+ * @param {number} joinTime
3478
+ * @param {number} result
3479
+ * @param {string} tid
3480
+ */
3481
+ reportJoin(result: number, timeRecord: TimeRecorder, tid?: string): void;
3482
+ /**
3483
+ * Join 链接细节
3484
+ */
3485
+ reportJoinConnection(logInfo: LogInfo): void;
3486
+ /**
3487
+ * 用户离开频道事件埋点
3488
+ * @param {number} leaveTime
3489
+ * @param {number} result
3490
+ * @param {string} tid
3491
+ */
3492
+ reportLeave(leaveTime: number, result: number, tid: string): void;
3493
+ /**
3494
+ * 推流事件上报
3495
+ * @param {string} callid
3496
+ * @param {boolean} isLargeVideo
3497
+ * @param {boolean} isSmallVideo
3498
+ * @param {boolean} isScreenShare
3499
+ * @param {boolean} isAudio
3500
+ * @param {number} result
3501
+ * @param {string} tid
3502
+ * @param {number} pubTime
3503
+ */
3504
+ 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;
3505
+ /**
3506
+ * 首包上报
3507
+ * @param {string} callid
3508
+ * @param {number} startTime
3509
+ * @param {number} publishTime
3510
+ * @param {number} joinTime
3511
+ * @param {string} tckid
3512
+ * @param {string} pcTraceId
3513
+ * @param {string} traceId
3514
+ * @param {PublishReason} reason
3515
+ */
3516
+ reportPublishFirstPacket(isRepublish: boolean, callid: string, startTime: number, publishTime: number, joinTime: number, tckid: string, pcTraceId: string, traceId: string, reason: PublishReason): void;
3517
+ /**
3518
+ * 停止推流事件上报
3519
+ * @param {string} callid
3520
+ * @param {number} unpubTime
3521
+ * @param {number} result
3522
+ * @param {string} tid
3523
+ */
3524
+ reportUnpublish(callid: string, unpubTime: number, result: number, tid: string): void;
3525
+ /**
3526
+ * 订阅事件埋点
3527
+ * @param {string} callid
3528
+ * @param {string} remoteid
3529
+ * @param {boolean} isLargeVideo
3530
+ * @param {boolean} isSmallVideo
3531
+ * @param {boolean} isScreenShare
3532
+ * @param {boolean} isAudio
3533
+ * @param {number} result
3534
+ * @param {string} tid
3535
+ * @param {number} subTime
3536
+ */
3537
+ reportSubscribe(callid: string, remoteid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number, tid: string, subTime: number, logInfo: LogInfo): void;
3538
+ reportSubscribeFirstPacket(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
3539
+ reportSubscribeFirstFrame(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
3540
+ /**
3541
+ * 停止订阅事件埋点
3542
+ * @param {string} callid
3543
+ * @param {string} remoteid
3544
+ * @param {number} unsubTime
3545
+ * @param {number} result
3546
+ * @param {string} tid
3547
+ */
3548
+ reportUnsubscribe(callid: string, remoteid: string, unsubTime: number, result: number, tid: string): void;
3549
+ reportMute(callid: string, enable: boolean, type: 'audio' | 'video' | 'screen'): void;
3550
+ /**
3551
+ * 更新角色埋点
3552
+ * @param {string|undefined} or 旧的角色
3553
+ * @param {string} nr 新的角色
3554
+ */
3555
+ reportRoleUpdate(or: string | undefined, nr: string): void;
3556
+ /**
3557
+ * 更新角色埋点
3558
+ * @param {string|undefined} or 旧的角色
3559
+ * @param {string} nr 新的角色
3560
+ */
3561
+ reportRoleUpdateResult(or: string | undefined, nr: string, ctm: number, result: number): void;
3562
+ /**
3563
+ * 设置camera videoprofile
3564
+ */
3565
+ reportVideoProfile(profile: string): void;
3566
+ /**
3567
+ * 设置screenshare videoprofile
3568
+ */
3569
+ reportScreenProfile(profile: string): void;
3570
+ /**
3571
+ * 错误事件埋点
3572
+ * @param err
3573
+ */
3574
+ reportError(err: any): void;
3575
+ /**
3576
+ * 错误事件埋点
3577
+ * @param err
3578
+ */
3579
+ reportWarning(msg: string): void;
3580
+ reportRoomServerEvent(isRequest: boolean, type: string, requestId: string, content: any): void;
3581
+ reportTranscodingError(result: number, taskid: string): void;
3582
+ reportBye(result: number): void;
3583
+ reportAudio(error: any, cost: number, deviceName: string): void;
3584
+ reportScreen(error: any, cost: number): void;
3585
+ reportScreenStop(error: any): void;
3586
+ reportSwitchCamera(deviceId: string): void;
3587
+ reportPublishProfile(trackId: string, logInfo: LogInfo): void;
3588
+ reportSDKCreated(startTs: number): void;
3589
+ reportJoinInvoked(authInfo: AliRtcAuthInfo): void;
3590
+ reportJoinResult(error: any): void;
3591
+ reportSTSResult(code: number): void;
3592
+ reportLeaveInvoked(): void;
3593
+ reportSEIMessage(payloadType: number, length: number, repeatCount: number, delay: number, isKey: boolean): void;
3594
+ /**
3595
+ * 日志埋点
3596
+ * 在埋点中增加tm字段,表示发生埋点的客户端本地时间
3597
+ * @param {any} param 埋点内容
3598
+ */
3599
+ protected log(param: any): void;
3600
+ /**
3601
+ * 将Object转换成string
3602
+ * @param {any} data
3603
+ * @returns {string}
3604
+ */
3605
+ protected data2String(data: any): string;
3606
+ }
3607
+
3608
+ declare interface SLSSTSToken {
3609
+ access_key_id: string;
3610
+ access_key_secret: string;
3611
+ expiration: number;
3612
+ log_store_debug: string;
3613
+ log_store_stats: string;
3614
+ project: string;
3615
+ region_endpoint: string;
3616
+ security_token: string;
3617
+ }
3618
+
3619
+ declare interface SLSToken {
3620
+ access_key_id: string;
3621
+ access_key_secret: string;
3622
+ security_token: string;
3623
+ region_endpoint: string;
3624
+ project: string;
3625
+ log_store_stats: string;
3626
+ log_store_debug: string;
3627
+ expiration: number;
3628
+ }
3629
+
3351
3630
  declare interface StopPreviewConfig {
3352
3631
  videoElement?: HTMLVideoElement;
3353
3632
  primary?: boolean;
@@ -3367,6 +3646,25 @@ declare interface StreamOptions {
3367
3646
  screen?: boolean;
3368
3647
  }
3369
3648
 
3649
+ declare class StsManager extends default_2<StsManagerListener> {
3650
+ static logName: string;
3651
+ private env;
3652
+ private authInfo?;
3653
+ private timer?;
3654
+ private slsReporter;
3655
+ private expiration;
3656
+ private skipTime;
3657
+ constructor(slsReporter: SLSReporter, env: AliRtcEnv);
3658
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
3659
+ private requestToken;
3660
+ startSTSUpdate(authInfo: AliRtcAuthInfo): void;
3661
+ clear(): void;
3662
+ }
3663
+
3664
+ declare interface StsManagerListener {
3665
+ onTokenUpdate: (ossToken: OSSToken, slsToken: SLSToken) => void;
3666
+ }
3667
+
3370
3668
  declare interface SubConfig {
3371
3669
  isAudioSubscribing: boolean;
3372
3670
  isVideoSubscribing: boolean;
@@ -3380,6 +3678,19 @@ declare type SubscribeOptions = StreamOptions & {
3380
3678
  vMsid?: string;
3381
3679
  };
3382
3680
 
3681
+ declare enum SubscribeReason {
3682
+ InRoom = "inRoom",
3683
+ Join = "join",
3684
+ Publish = "publish",
3685
+ User = "user",
3686
+ Resume = "resume"
3687
+ }
3688
+
3689
+ declare interface TimeRecorder {
3690
+ start: number;
3691
+ [key: string]: number;
3692
+ }
3693
+
3383
3694
  declare enum TrackEvent_2 {
3384
3695
  VideoTrackEnded = "videoTrackEnded",
3385
3696
  AudioTrackEnded = "audioTrackEnded",
@@ -3408,12 +3719,13 @@ declare class User extends default_2<UserListener> {
3408
3719
  protected uid: string;
3409
3720
  protected name: string;
3410
3721
  protected rtsManager: RtsManager;
3411
- callid: string;
3722
+ callId: string;
3412
3723
  protected audioLevelMonitor: AudioLevelMonitor;
3413
3724
  protected audioVolumeIndicationInterval: number;
3414
3725
  constructor(userId: string, displayname: string, rtsManager: RtsManager, interval: number);
3415
3726
  get userId(): string;
3416
3727
  get displayname(): string;
3728
+ protected createCallId(): void;
3417
3729
  setUserInfo(uid: string, displayName: string): void;
3418
3730
  refreshUserInfo(uid: string): void;
3419
3731
  /**
@@ -3449,188 +3761,6 @@ declare interface UserListener {
3449
3761
  remoteSubscribeError: (error: AliRtcError) => void;
3450
3762
  }
3451
3763
 
3452
- declare class UserManager extends default_2<UserManagerListener> {
3453
- /**
3454
- * @ignore
3455
- */
3456
- static logName: string;
3457
- protected self: LocalUser | undefined;
3458
- protected userMap: RemoteUserMap;
3459
- private usersViewMap;
3460
- rtsManager: RtsManager;
3461
- protected localStreamManager: LocalStreamManager;
3462
- protected authInfo?: AliRtcAuthInfo;
3463
- protected signalingManager: SignalingManager;
3464
- pluginManager: PluginManager;
3465
- protected reporter: Reporter;
3466
- protected webTrackingClient: WebTrackingClient;
3467
- private statsMonitorId?;
3468
- private autoSubAudio;
3469
- private autoSubVideo;
3470
- private autoSubScreen;
3471
- private wantSubAudio;
3472
- private wantSubVideo;
3473
- private wantSubScreen;
3474
- private defaultStreamType;
3475
- private audioMuted;
3476
- private audioVolumeIndicationInterval;
3477
- private indicationTimer;
3478
- constructor(config: UserManagerConfig);
3479
- private addSignalingManagerListener;
3480
- isAutoSubAudio(): boolean;
3481
- setAutoSubAudio(value: boolean): void;
3482
- isAutoSubVideo(): boolean;
3483
- setAutoSubVideo(value: boolean): void;
3484
- isAutoSubScreen(): boolean;
3485
- setAutoSubScreen(value: boolean): void;
3486
- isWantSubAudio(): boolean;
3487
- setWantSubAudio(value: boolean): void;
3488
- isWantSubVideo(): boolean;
3489
- setWantSubVideo(value: boolean): void;
3490
- isWantSubScreen(): boolean;
3491
- setWantSubScreen(value: boolean): void;
3492
- setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
3493
- setRemoteUserVideoStreamType(userId: string, type: AliRtcVideoStreamType): void;
3494
- setAudioMuted(mute: boolean): void;
3495
- setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
3496
- setRemoteViewConfig(uid: string, view: AliRtcLocalView, track: AliRtcVideoTrack): void;
3497
- get channel(): string | undefined;
3498
- get userId(): string | undefined;
3499
- get remoteUsers(): RemoteUser[];
3500
- /**
3501
- * 获取推流对象,只能是自己
3502
- */
3503
- get publisher(): LocalUser | undefined;
3504
- get isSubscribing(): boolean;
3505
- /**
3506
- * 处理远端用户推流状态变化
3507
- * @param {string} userId
3508
- * @param {string} displayname
3509
- * @param {string} callid
3510
- * @param {string} pullStreamUrl
3511
- * @param {TrackInfo[]} tracks
3512
- * @returns {void}
3513
- */
3514
- onRemotePublishStateChange(publishInfo: PublishUser): void;
3515
- /**
3516
- * 登陆成功后初始化用户管理,创建自己
3517
- * @param {AliRtcAuthInfo} authInfo
3518
- * @param {string} pushStreamUrl
3519
- * @returns {Promise<void>}
3520
- */
3521
- init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
3522
- /**
3523
- * 离会后清除所有数据
3524
- * @returns {Promise<void>}
3525
- */
3526
- clear(): Promise<void>;
3527
- private startStatsMonitor;
3528
- private stopStatsMonitor;
3529
- /**
3530
- * 根据userId获取RemoteUser
3531
- * @param {string} userId
3532
- * @param {string} displayname
3533
- * @returns {RemoteUser}
3534
- */
3535
- getUser(userId: string, displayname: string): RemoteUser;
3536
- /**
3537
- * 添加远端用户
3538
- * @param {string} userId
3539
- * @param {string} displayName
3540
- * @returns {void}
3541
- */
3542
- addUser(userId: string, displayName: string): RemoteUser;
3543
- /**
3544
- * 执行添加远端用户
3545
- * @param {string} userId
3546
- * @param {string} displayName
3547
- * @returns {RemoteUser}
3548
- */
3549
- private executeAddUser;
3550
- /**
3551
- * 远端用户设备状态变化
3552
- * @param {DeviceStatusChangeType} event
3553
- * @param {string} userId
3554
- */
3555
- private onRemoteDeviceStatusChange;
3556
- /**
3557
- * 远端流数据采集上报
3558
- * @param {any} stat
3559
- */
3560
- private onRemoteStatReport;
3561
- /**
3562
- * rts 单 PC 订阅超限
3563
- */
3564
- private onSubscribeExceeds;
3565
- /**
3566
- * 移除远端用户
3567
- * @param {LeaveInfo} user
3568
- * @returns {Promise<void>}
3569
- */
3570
- removeLeftUser(user: LeaveInfo): Promise<void>;
3571
- /**
3572
- * 更新远端用户数据
3573
- * @param {JoinInfo[]} users
3574
- * @returns {{joinList: JoinInfo[], leaveList: LeaveInfo[], presentList: JoinInfo[]}}
3575
- */
3576
- updateUsers(users: JoinInfo[]): {
3577
- joinList: JoinInfo[];
3578
- leaveList: LeaveInfo[];
3579
- presentList: JoinInfo[];
3580
- };
3581
- /**
3582
- * 根据 userId 获取 RemoteUser
3583
- * @param {string} userId
3584
- * @returns {RemoteUser | undefined}
3585
- */
3586
- getRemoteUser(userId: string): RemoteUser | undefined;
3587
- /**
3588
- * 更新远端用户设备信息
3589
- * @param {RemoteUserStatus} user
3590
- * @returns {boolean} true: 用户状态改变 false: 用户状态没有改变
3591
- */
3592
- updateRemoteUserDeviceStatus(user: RemoteUserStatus): void;
3593
- updateAudioWant(uid: string, sub: boolean): void;
3594
- updateVideoWant(uid: string, sub: boolean): void;
3595
- updateScreenWant(uid: string, sub: boolean): void;
3596
- private stopIndication;
3597
- private startIndication;
3598
- enableAudioVolumeIndication(interval: number): void;
3599
- refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
3600
- setEnableMediaExtensionMsg(enable: boolean): void;
3601
- setAudioRedEnabled(enable: boolean): void;
3602
- }
3603
-
3604
- declare interface UserManagerConfig {
3605
- reporter: Reporter;
3606
- webTrackingClient: WebTrackingClient;
3607
- signalingManager: SignalingManager;
3608
- }
3609
-
3610
- declare interface UserManagerListener {
3611
- [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
3612
- [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
3613
- [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
3614
- remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
3615
- audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3616
- videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3617
- screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3618
- userAudioMuted: (uid: string, isMute: boolean) => void;
3619
- userVideoMuted: (uid: string, isMute: boolean) => void;
3620
- userScreenMuted: (userId: string, isMute: boolean) => void;
3621
- audioVolume: (speakers: {
3622
- userId: string;
3623
- volume: number;
3624
- }[]) => void;
3625
- rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
3626
- rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
3627
- rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
3628
- rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
3629
- remoteAudioAutoPlayFail: (uid: string) => void;
3630
- remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
3631
- remoteSubscribeError: (error: AliRtcError) => void;
3632
- }
3633
-
3634
3764
  declare interface VideoScaler {
3635
3765
  getVideoTrack: () => MediaStreamTrack;
3636
3766
  updateOptions: (options: VideoScalerOptions) => void;
@@ -3660,90 +3790,4 @@ declare enum VideoStreamSource {
3660
3790
  Image = 2
3661
3791
  }
3662
3792
 
3663
- declare interface WebTrackConfig {
3664
- biz: string;
3665
- extraParams?: string;
3666
- }
3667
-
3668
- declare class WebTrackingClient {
3669
- protected index: number;
3670
- private tracker?;
3671
- private enable;
3672
- private commonParams;
3673
- constructor(config?: WebTrackConfig | boolean);
3674
- updateAuthInfo(info: AliRtcAuthInfo): void;
3675
- /**
3676
- * 调用加入房间API事件
3677
- * @param {AliRtcAuthInfo} authInfo 鉴权信息
3678
- */
3679
- reportJoinChannel(authInfo: AliRtcAuthInfo): void;
3680
- /**
3681
- * @method: 调用加入房间结果
3682
- * @param { rslt: 执行结果 code,0为成功,错误返回其他错误码 }
3683
- * @param { message: 执行结果,成功返回 success,失败返回失败 message }
3684
- * @param { ct: 耗时 }
3685
- * @return {*}
3686
- */
3687
- reportJoinChannelRes(rslt: number, message: string, ct: number): void;
3688
- /**
3689
- * 离会调用通知
3690
- */
3691
- reportLeaveChannel(): void;
3692
- /**
3693
- * 推流成功
3694
- * @param {string} calid(失败时为空)
3695
- * @param {boolean} isvl 是否推大流
3696
- * @param {boolean} isvs 是否推小流
3697
- * @param {boolean} isvss 是否推屏幕共享流
3698
- * @param {boolean} isaudio 是否推音频流
3699
- * @param {number} rslt 推流结果:成功0,失败错误码
3700
- * @param {string} tid 房间信令 tid
3701
- * @param {number} pubtm 执行推流到推流结束信令通知结束的耗时
3702
- * @param {number} est 开始时间
3703
- * @param {string} dctid 使用 datachannel 的 traceId
3704
- * @param {string} httptid 使用 http 建连的 traceId
3705
- * @param {string} url 推流地址
3706
- */
3707
- reportPush(calid: string, isvl: boolean, isvs: boolean, isvss: boolean, isaudio: boolean, rslt: number, tid: string, pubtm: number, est: number, dctid: string, httptid: string, url: string): void;
3708
- /**
3709
- * 拉流成功
3710
- * @param {string} calid 鉴权 callid (失败为空)
3711
- * @param {string} rmtid 远端用户 userId
3712
- * @param {boolean} isvl 是否拉视频大流
3713
- * @param {boolean} isvs 是否拉视频小流
3714
- * @param {boolean} isvss 是否拉屏幕分享流
3715
- * @param {boolean} isaudio 是否拉音频流
3716
- * @param {number} rslt 拉流结果:成功0,失败错误码
3717
- * @param {number} subtm 订阅耗时
3718
- * @param {string} dctid 使用 datachannel 的 traceId
3719
- * @param {string} httptid 使用 http 建连的 traceId
3720
- * @param {string} url 拉流地址
3721
- * @param {number} est 开始时间
3722
- */
3723
- reportPull(calid: string, rmtid: string, isvl: boolean, isvs: boolean, isvss: boolean, isaudio: boolean, rslt: number, subtm: number, dctid: string, httptid: string, url: string, est: number): void;
3724
- /**
3725
- * 上报订阅流的音频数据
3726
- * @param {string} rmtid 远端用户 userId
3727
- * @param {any} stats 流数据
3728
- */
3729
- reportSubscribeAudioStats(rmtid: string, stats: any): void;
3730
- /**
3731
- * 上报订阅流的视频数据
3732
- * @param {string} rmtid 远端用户 userId
3733
- * @param {any} stats 流数据
3734
- */
3735
- reportSubscribeVideoStats(rmtid: string, stats: any): void;
3736
- /**
3737
- * webTracking 埋点上报
3738
- * @param {string | number} msgId 事件标识
3739
- * @param {Record<string, any>} args 事件携带参数
3740
- * @param {Record<string, any>} params 单个打点携带的其他参数
3741
- */
3742
- protected report(msgId: string | number | EventId, args?: Record<string, any>, params?: Record<string, any>): void;
3743
- /**
3744
- * 上报环境监测的结果
3745
- */
3746
- static reportCheck(result: any, biz?: string): void;
3747
- }
3748
-
3749
- export { }
3793
+ export { }