aliyun-rtc-sdk 6.11.5 → 6.11.7-beta.0

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
  *
@@ -1124,6 +1162,11 @@ declare interface AliRtcEngineEventListener {
1124
1162
  * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
1125
1163
  */
1126
1164
  remoteVideoAutoPlayFail: (uid: string, videoTrack: AliRtcVideoTrack) => void;
1165
+ /**
1166
+ * rtc 传输数据统计
1167
+ * @param stats 统计信息
1168
+ */
1169
+ rtcStats: (stats: any) => void;
1127
1170
  /**
1128
1171
  * 发布视频流的数据统计
1129
1172
  * @param aliRtcStats 统计信息
@@ -1437,6 +1480,8 @@ export declare enum AliRtcErrorCode {
1437
1480
 
1438
1481
  declare class AliRtcLiveTranscoding {
1439
1482
  authInfo?: AliRtcAuthInfo;
1483
+ private slsReporter;
1484
+ constructor(slsReporter: SLSReporter);
1440
1485
  private doRequest;
1441
1486
  setAuthInfo(authInfo: AliRtcAuthInfo): void;
1442
1487
  clear(): void;
@@ -1747,6 +1792,7 @@ export declare abstract class AliRtcPlugin extends default_2<AliRtcPluginListene
1747
1792
  lastOutputAudioTrack?: MediaStreamTrack;
1748
1793
  lastInputVideoTrack?: MediaStreamTrack;
1749
1794
  lastOutputVideoTrack?: MediaStreamTrack;
1795
+ private _hasCleared;
1750
1796
  constructor(name: string, streamType?: AliRtcRawDataStreamType, trackType?: AliRtcPluginTrackType);
1751
1797
  get initOptions(): {};
1752
1798
  getOptions(): any;
@@ -2058,6 +2104,182 @@ declare enum AudioStreamSource {
2058
2104
  Mixed = 2
2059
2105
  }
2060
2106
 
2107
+ declare class BizControl extends default_2<BizControlListener> {
2108
+ /**
2109
+ * @ignore
2110
+ */
2111
+ static logName: string;
2112
+ protected self: LocalUser | undefined;
2113
+ protected userMap: RemoteUserMap;
2114
+ private usersViewMap;
2115
+ rtsManager: RtsManager;
2116
+ protected localStreamManager: LocalStreamManager;
2117
+ protected authInfo?: AliRtcAuthInfo;
2118
+ protected signalingManager: SignalingManager;
2119
+ pluginManager: PluginManager;
2120
+ protected slsReporter: SLSReporter;
2121
+ private statsMonitorId?;
2122
+ private autoSubAudio;
2123
+ private autoSubVideo;
2124
+ private autoSubScreen;
2125
+ private wantSubAudio;
2126
+ private wantSubVideo;
2127
+ private wantSubScreen;
2128
+ private defaultStreamType;
2129
+ private audioMuted;
2130
+ private playoutVolume;
2131
+ private audioVolumeIndicationInterval;
2132
+ private indicationTimer;
2133
+ constructor(config: BizControlConfig);
2134
+ private addSignalingManagerListener;
2135
+ isAutoSubAudio(): boolean;
2136
+ setAutoSubAudio(value: boolean): void;
2137
+ isAutoSubVideo(): boolean;
2138
+ setAutoSubVideo(value: boolean): void;
2139
+ isAutoSubScreen(): boolean;
2140
+ setAutoSubScreen(value: boolean): void;
2141
+ isWantSubAudio(): boolean;
2142
+ setWantSubAudio(value: boolean): void;
2143
+ isWantSubVideo(): boolean;
2144
+ setWantSubVideo(value: boolean): void;
2145
+ isWantSubScreen(): boolean;
2146
+ setWantSubScreen(value: boolean): void;
2147
+ setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
2148
+ setRemoteUserVideoStreamType(userId: string, type: AliRtcVideoStreamType): void;
2149
+ setAudioMuted(mute: boolean): void;
2150
+ setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2151
+ setRemoteViewConfig(uid: string, view: AliRtcLocalView, track: AliRtcVideoTrack): void;
2152
+ get channel(): string | undefined;
2153
+ get userId(): string | undefined;
2154
+ get remoteUsers(): RemoteUser[];
2155
+ /**
2156
+ * 获取推流对象,只能是自己
2157
+ */
2158
+ get publisher(): LocalUser | undefined;
2159
+ get isSubscribing(): boolean;
2160
+ /**
2161
+ * 处理远端用户推流状态变化
2162
+ * @param {string} userId
2163
+ * @param {string} displayname
2164
+ * @param {string} callid
2165
+ * @param {string} pullStreamUrl
2166
+ * @param {TrackInfo[]} tracks
2167
+ * @returns {void}
2168
+ */
2169
+ onRemotePublishStateChange(publishInfo: PublishUser): void;
2170
+ /**
2171
+ * 登陆成功后初始化用户管理,创建自己
2172
+ * @param {AliRtcAuthInfo} authInfo
2173
+ * @param {string} pushStreamUrl
2174
+ * @returns {Promise<void>}
2175
+ */
2176
+ init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
2177
+ /**
2178
+ * 离会后清除所有数据
2179
+ * @returns {Promise<void>}
2180
+ */
2181
+ clear(): Promise<void>;
2182
+ private startStatsMonitor;
2183
+ private stopStatsMonitor;
2184
+ /**
2185
+ * 添加远端用户
2186
+ * @param {string} userId
2187
+ * @param {string} displayName
2188
+ * @returns {void}
2189
+ */
2190
+ addUser(userId: string, displayName: string, reason: SubscribeReason): RemoteUser;
2191
+ /**
2192
+ * 执行添加远端用户
2193
+ * @param {string} userId
2194
+ * @param {string} displayName
2195
+ * @returns {RemoteUser}
2196
+ */
2197
+ private executeAddUser;
2198
+ /**
2199
+ * 远端用户设备状态变化
2200
+ * @param {DeviceStatusChangeType} event
2201
+ * @param {string} userId
2202
+ */
2203
+ private onRemoteDeviceStatusChange;
2204
+ /**
2205
+ * 远端流数据采集上报
2206
+ * @param {any} stat
2207
+ */
2208
+ private onRemoteStatReport;
2209
+ /**
2210
+ * rts 单 PC 订阅超限
2211
+ */
2212
+ private onSubscribeExceeds;
2213
+ /**
2214
+ * 移除远端用户
2215
+ * @param {LeaveInfo} user
2216
+ * @returns {Promise<void>}
2217
+ */
2218
+ removeLeftUser(user: LeaveInfo): Promise<void>;
2219
+ /**
2220
+ * 更新远端用户数据
2221
+ * @param {JoinInfo[]} users
2222
+ * @returns {{joinList: JoinInfo[], leaveList: LeaveInfo[], presentList: JoinInfo[]}}
2223
+ */
2224
+ updateUsers(users: JoinInfo[]): {
2225
+ joinList: JoinInfo[];
2226
+ leaveList: LeaveInfo[];
2227
+ presentList: JoinInfo[];
2228
+ };
2229
+ /**
2230
+ * 根据 userId 获取 RemoteUser
2231
+ * @param {string} userId
2232
+ * @returns {RemoteUser | undefined}
2233
+ */
2234
+ getRemoteUser(userId: string): RemoteUser | undefined;
2235
+ /**
2236
+ * 更新远端用户设备信息
2237
+ * @param {RemoteUserStatus} user
2238
+ * @returns {boolean} true: 用户状态改变 false: 用户状态没有改变
2239
+ */
2240
+ updateRemoteUserDeviceStatus(user: RemoteUserStatus): void;
2241
+ updateAudioWant(uid: string, sub: boolean): void;
2242
+ updateVideoWant(uid: string, sub: boolean): void;
2243
+ updateScreenWant(uid: string, sub: boolean): void;
2244
+ private stopIndication;
2245
+ private startIndication;
2246
+ enableAudioVolumeIndication(interval: number): void;
2247
+ setPlayoutVolume(volume: number): void;
2248
+ refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
2249
+ setEnableMediaExtensionMsg(enable: boolean): void;
2250
+ setAudioRedEnabled(enable: boolean): void;
2251
+ }
2252
+
2253
+ declare interface BizControlConfig {
2254
+ slsReporter: SLSReporter;
2255
+ signalingManager: SignalingManager;
2256
+ }
2257
+
2258
+ declare interface BizControlListener {
2259
+ [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
2260
+ [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
2261
+ [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
2262
+ remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
2263
+ audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
2264
+ videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
2265
+ screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
2266
+ userAudioMuted: (uid: string, isMute: boolean) => void;
2267
+ userVideoMuted: (uid: string, isMute: boolean) => void;
2268
+ userScreenMuted: (userId: string, isMute: boolean) => void;
2269
+ audioVolume: (speakers: {
2270
+ userId: string;
2271
+ volume: number;
2272
+ }[]) => void;
2273
+ rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
2274
+ rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
2275
+ rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
2276
+ rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
2277
+ rtcStats: (stats: any) => void;
2278
+ remoteAudioAutoPlayFail: (uid: string) => void;
2279
+ remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
2280
+ remoteSubscribeError: (error: AliRtcError) => void;
2281
+ }
2282
+
2061
2283
  declare enum ClientEventType {
2062
2284
  PullStreamStats = "remoteStat",
2063
2285
  RtsSubscribeExceeds = "rtsSubscribeExceeds",
@@ -2114,16 +2336,6 @@ declare enum DisplayType {
2114
2336
  WHEN_NO_VIDEO = 2
2115
2337
  }
2116
2338
 
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
2339
  declare interface ISignalingInterface {
2128
2340
  join(authInfo: AliRtcAuthInfo, userName: string, connectRetryCount?: number): Promise<JoinResult>;
2129
2341
  leave(): Promise<SignalingResult>;
@@ -2195,6 +2407,7 @@ declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
2195
2407
  */
2196
2408
  static logName: string;
2197
2409
  private pluginManager;
2410
+ private slsReporter;
2198
2411
  private publishingCameraVideoStream;
2199
2412
  private publishingScreenVideoStream;
2200
2413
  cameraStreamInfo: AliRtcLocalStreamInfo;
@@ -2205,7 +2418,7 @@ declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
2205
2418
  private _publishLocalAudioStreamEnabled;
2206
2419
  private _publishLocalVideoStreamEnabled;
2207
2420
  private _publishLocalScreenStreamEnabled;
2208
- constructor(pluginManager: PluginManager);
2421
+ constructor(pluginManager: PluginManager, slsReporter: SLSReporter);
2209
2422
  get hasCamera(): boolean;
2210
2423
  get audioCaptureDisabled(): boolean;
2211
2424
  set audioCaptureDisabled(closed: boolean);
@@ -2298,6 +2511,7 @@ declare class LocalUser extends User {
2298
2511
  */
2299
2512
  static logName: string;
2300
2513
  protected url: string;
2514
+ private joinTime;
2301
2515
  private _isPublishing;
2302
2516
  private publishPromise;
2303
2517
  private previewElements;
@@ -2308,8 +2522,11 @@ declare class LocalUser extends User {
2308
2522
  protected signalingManager: SignalingManager;
2309
2523
  traceId: string;
2310
2524
  private monitorTimerId?;
2311
- protected reporter: Reporter;
2312
- protected webTrackingClient: WebTrackingClient;
2525
+ private monitorDataCache;
2526
+ private trackTraceIdMap;
2527
+ private candidateDataCache;
2528
+ private pcMediaStatsMap;
2529
+ protected slsReporter: SLSReporter;
2313
2530
  private audioPubState;
2314
2531
  private videoPubState;
2315
2532
  private videoSmallPubState;
@@ -2403,12 +2620,15 @@ declare class LocalUser extends User {
2403
2620
  createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
2404
2621
  stopLocalStream(options: PublishOptions): Promise<void>;
2405
2622
  private compareAndPublish;
2623
+ private reportAudioProfile;
2624
+ private reportVideoProfile;
2625
+ private reportScreenProfile;
2406
2626
  /**
2407
2627
  * 开始推流
2408
2628
  * @param isResume 是否是恢复推流
2409
2629
  * @returns
2410
2630
  */
2411
- startPublish(isResume?: boolean): Promise<void>;
2631
+ startPublish(isResume?: boolean, reason?: PublishReason): Promise<void>;
2412
2632
  /**
2413
2633
  * 对比本地流和正在推流,进行推流更新
2414
2634
  * @param isResume 是否是恢复推流
@@ -2456,6 +2676,10 @@ declare class LocalUser extends User {
2456
2676
  private onTrackEnd;
2457
2677
  private resetPreviewElements;
2458
2678
  private resetSecondayPreviewElements;
2679
+ getMediaStats(id: string): any;
2680
+ private reportPublishMonitor;
2681
+ private reportNetwork;
2682
+ private startStreamMonitor;
2459
2683
  /**
2460
2684
  * 停止本地流数据采集
2461
2685
  */
@@ -2480,14 +2704,14 @@ declare class LocalUser extends User {
2480
2704
  getStats(): Promise<{
2481
2705
  audio: AliRtcLocalAudioStats[];
2482
2706
  video: AliRtcLocalVideoStats[];
2707
+ transport: any;
2483
2708
  }>;
2484
2709
  }
2485
2710
 
2486
2711
  declare interface LocalUserConfig {
2487
2712
  rtsManager: RtsManager;
2488
2713
  localStreamManager: LocalStreamManager;
2489
- reporter: Reporter;
2490
- webTrackingClient: WebTrackingClient;
2714
+ slsReporter: SLSReporter;
2491
2715
  signalingManager: SignalingManager;
2492
2716
  pluginManager: PluginManager;
2493
2717
  audioVolumeIndicationInterval: number;
@@ -2498,12 +2722,18 @@ declare interface LocalUserConfig {
2498
2722
  * 在入会之前,会将埋点缓存,入会后以每200ms一条的速度将缓存的埋点按顺序上报
2499
2723
  */
2500
2724
  declare class LogClient {
2501
- protected reporter?: LogReporter;
2725
+ protected tracker?: default_3;
2502
2726
  protected param?: any;
2503
2727
  protected msgCacheArr: any[];
2504
2728
  protected index: number;
2729
+ protected stsOpt?: any;
2730
+ protected slsToken?: SLSSTSToken;
2731
+ protected ossToken?: OSSSTSToken;
2732
+ protected uaParserResult: UAParser.IResult;
2505
2733
  constructor();
2734
+ private createTracker;
2506
2735
  start(info: AliRtcAuthInfo): void;
2736
+ updateToken(slsToken: SLSSTSToken, ossToken?: OSSSTSToken): void;
2507
2737
  /**
2508
2738
  * 断开连接
2509
2739
  */
@@ -2517,11 +2747,10 @@ declare class LogClient {
2517
2747
  * 初始化公共参数
2518
2748
  */
2519
2749
  protected initParam(info: AliRtcAuthInfo): void;
2520
- /**
2521
- * 通过LogReporter发送日志
2522
- * @param log
2523
- */
2524
- protected realSendReport(log: any): void;
2750
+ }
2751
+
2752
+ declare interface LogInfo {
2753
+ [key: string]: string | number;
2525
2754
  }
2526
2755
 
2527
2756
  declare interface MediaTrackInfo {
@@ -2551,6 +2780,24 @@ declare enum MsidType {
2551
2780
  Screen = "sophon_video_screen_share"
2552
2781
  }
2553
2782
 
2783
+ declare interface OSSSTSToken {
2784
+ access_key_id: string;
2785
+ access_key_secret: string;
2786
+ security_token: string;
2787
+ region_endpoint: string;
2788
+ bucket_name: string;
2789
+ expiration: number;
2790
+ }
2791
+
2792
+ declare interface OSSToken {
2793
+ access_key_id: string;
2794
+ access_key_secret: string;
2795
+ security_token: string;
2796
+ region_endpoint: string;
2797
+ bucket_name: string;
2798
+ expiration: number;
2799
+ }
2800
+
2554
2801
  declare class PluginManager extends default_2<PluginManagerListener> {
2555
2802
  private plugins;
2556
2803
  add(plugin: AliRtcPlugin, options: any): void;
@@ -2585,6 +2832,7 @@ declare interface PublishExtraParams {
2585
2832
  }
2586
2833
 
2587
2834
  declare interface PublishInfo {
2835
+ type: PublishType;
2588
2836
  userid: string;
2589
2837
  sessionid: string;
2590
2838
  displayname: string;
@@ -2604,6 +2852,11 @@ declare type PublishOptions = StreamOptions & {
2604
2852
  vMsid?: string;
2605
2853
  };
2606
2854
 
2855
+ declare enum PublishReason {
2856
+ MANUAL = 0,
2857
+ JOINCHANNEL = 1
2858
+ }
2859
+
2607
2860
  declare interface PublishStreamInfo {
2608
2861
  audio?: LocalStream;
2609
2862
  video?: LocalStream;
@@ -2613,6 +2866,14 @@ declare interface PublishStreamInfo {
2613
2866
  screenProfile?: LocalProfileManager;
2614
2867
  }
2615
2868
 
2869
+ declare enum PublishType {
2870
+ Add = "add",
2871
+ Delete = "delete",
2872
+ Replace = "replace",
2873
+ Stop = "stop",
2874
+ UnPublish = "unpublish"
2875
+ }
2876
+
2616
2877
  declare interface PublishUser {
2617
2878
  callid: string;
2618
2879
  clientrole?: string;
@@ -2679,6 +2940,7 @@ declare class RemoteStreamInfo extends default_2<StreamListener> {
2679
2940
  * @returns
2680
2941
  */
2681
2942
  getScreenInfo(): RemoteMediaTrackInfo;
2943
+ get subscribingInfos(): RemoteMediaTrackInfo[];
2682
2944
  /**
2683
2945
  * 远端流是否包含音频轨道
2684
2946
  * @returns
@@ -2756,7 +3018,7 @@ declare class RemoteUser extends User {
2756
3018
  static logName: string;
2757
3019
  remoteCallid: string;
2758
3020
  remoteUserInfo: AliRtcRemoteUserInfo;
2759
- protected localUserId: string;
3021
+ protected localUser?: LocalUser;
2760
3022
  protected lastPubId: string;
2761
3023
  protected stream?: RemoteStream;
2762
3024
  protected screenStream?: RemoteStream;
@@ -2768,13 +3030,13 @@ declare class RemoteUser extends User {
2768
3030
  protected secondaryMediaStream?: MediaStream;
2769
3031
  protected prevSubConfig?: SubConfig;
2770
3032
  protected signalingManager: SignalingManager;
2771
- protected reporter: Reporter;
2772
- protected webTrackingClient: WebTrackingClient;
3033
+ protected slsReporter: SLSReporter;
2773
3034
  private wantSubAudio;
2774
3035
  private wantSubVideo;
2775
3036
  private wantSubScreen;
2776
3037
  private defaultVideoStreamType;
2777
3038
  private audioMuted;
3039
+ private playoutVolume;
2778
3040
  private audioSubState;
2779
3041
  private videoSubState;
2780
3042
  private videoLargeSubState;
@@ -2782,6 +3044,9 @@ declare class RemoteUser extends User {
2782
3044
  private screenSubState;
2783
3045
  streamInfo: RemoteStreamInfo;
2784
3046
  streamUrl: string;
3047
+ private monitorTimerId?;
3048
+ private monitorDataCache;
3049
+ private trackTraceIdMap;
2785
3050
  constructor(config: RemoteUserConfig);
2786
3051
  isWantSubAudio(): boolean;
2787
3052
  setWantSubAudio(value: boolean): void;
@@ -2791,6 +3056,7 @@ declare class RemoteUser extends User {
2791
3056
  setWantSubScreen(value: boolean): void;
2792
3057
  setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
2793
3058
  setAudioMuted(value: boolean): void;
3059
+ setPlayoutVolume(value: number): void;
2794
3060
  getAudioMuted(): boolean;
2795
3061
  get hasAudioTrack(): boolean;
2796
3062
  get hasVideoTrack(): boolean;
@@ -2833,7 +3099,7 @@ declare class RemoteUser extends User {
2833
3099
  * @param {SubscribeOptions} options
2834
3100
  * @returns {Promise<void>} 返回可播放的 MediaStream,可能为空。如果同时订阅了主流和辅流,只会返回主流对应的 MediaStream
2835
3101
  */
2836
- subscribe(options?: SubscribeOptions): Promise<void>;
3102
+ subscribe(options?: SubscribeOptions, reason?: SubscribeReason, startTs?: number): Promise<void>;
2837
3103
  /**
2838
3104
  * 订阅远端流
2839
3105
  * @param {SubscribeOptions} options 订阅配置
@@ -2881,7 +3147,7 @@ declare class RemoteUser extends User {
2881
3147
  * 尝试更新订阅
2882
3148
  * 1. 需要新增订阅的情况:想要订阅 & 没有正在订阅 & 远端有流
2883
3149
  */
2884
- updateSubscribe(): {
3150
+ updateSubscribe(reason: SubscribeReason): {
2885
3151
  addOption: SubscribeOptions;
2886
3152
  deleteOption: SubscribeOptions;
2887
3153
  };
@@ -2922,6 +3188,12 @@ declare class RemoteUser extends User {
2922
3188
  * @param {number} interval 时间间隔
2923
3189
  */
2924
3190
  enableAudioVolumeIndication(interval: number): void;
3191
+ private reportSubscribeMonitor;
3192
+ private startStreamMonitor;
3193
+ /**
3194
+ * 停止本地流数据采集
3195
+ */
3196
+ private stopStreamMonitor;
2925
3197
  }
2926
3198
 
2927
3199
  declare interface RemoteUserConfig {
@@ -2931,11 +3203,11 @@ declare interface RemoteUserConfig {
2931
3203
  usersViewMap: {
2932
3204
  [key: string]: RemoteUserViewMap;
2933
3205
  };
2934
- reporter: Reporter;
2935
- webTrackingClient: WebTrackingClient;
3206
+ slsReporter: SLSReporter;
2936
3207
  signalingManager: SignalingManager;
2937
- localUserId: string;
3208
+ localUser?: LocalUser;
2938
3209
  audioVolumeIndicationInterval: number;
3210
+ playoutVolume: number;
2939
3211
  }
2940
3212
 
2941
3213
  declare interface RemoteUserMap {
@@ -2953,222 +3225,52 @@ declare interface RemoteUserViewMap {
2953
3225
  }
2954
3226
 
2955
3227
  /**
2956
- * 日志埋点类
2957
- * 每个埋点暴露对应的接口
3228
+ * RoomServerMessageCenter支持的事件
2958
3229
  */
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;
3230
+ declare interface RoomServerListener {
3231
+ onJoinChannelResult: (data: any) => void;
3232
+ onPublishResult: (code: number, tid: string, description: string) => void;
3233
+ onNotifyJoin: (users: JoinInfo[]) => void;
3234
+ onNotifyStatus: (users: RemoteUserStatus[]) => void;
3235
+ onLeaveResult: (code: number, tid: string) => void;
3236
+ onRoleUpdateResult: (code: number, tid: string, description: string) => void;
3237
+ onRefreshUrlResult: (data: any) => void;
3238
+ onNotifyLeave: (users: LeaveInfo[]) => void;
3239
+ onNotifyPublish: (users: PublishUser[]) => void;
3240
+ onStatusReport: (code: number, tid: string, description: string) => void;
3241
+ onBye: (reason: AliRtcOnByeType, description: string) => void;
3242
+ onKeepAliveRsp: () => void;
3243
+ onConnectFail: (err: AliRtcError) => void;
3244
+ onNetworkError: (err: AliRtcError) => void;
3245
+ onAuthInvalid: () => void;
3246
+ onReconnectStart: () => void;
3247
+ onReconnectFail: (err: AliRtcError) => void;
3248
+ onReconnectSuccess: (users: JoinInfo[]) => void;
3249
+ onError: (err: AliRtcError) => void;
3250
+ }
3251
+
3252
+ declare class RtsManager extends default_2<RtsManagerEventListener> {
2978
3253
  /**
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
3254
+ * @ignore
3158
3255
  */
3159
3256
  static logName: string;
3160
3257
  private rts;
3161
3258
  private encodedInsertableStreams;
3162
3259
  private audioRedEnabled;
3163
3260
  private localStreamManager;
3261
+ private slsReporter;
3164
3262
  private connecting;
3165
3263
  private connected;
3264
+ private _pcTraceId;
3265
+ private _localJoinTime;
3166
3266
  private connectionResolve?;
3167
3267
  connectingPromise?: Promise<unknown>;
3168
3268
  private dcResolve?;
3169
3269
  dcConnectingPromise?: Promise<unknown>;
3170
3270
  private _publishingTracks;
3171
- constructor(localStreamManager: LocalStreamManager);
3271
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter);
3272
+ get pcTraceId(): string;
3273
+ set localJoinTime(time: number);
3172
3274
  setEncodedInsertableStreams(enable: boolean): void;
3173
3275
  setAudioRedEnabled(enable: boolean): void;
3174
3276
  destroy(): void;
@@ -3181,10 +3283,9 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3181
3283
  private updatePublishingTracks;
3182
3284
  private httpPublish;
3183
3285
  private waitPublishSender;
3184
- private checkSubscribeStats;
3185
3286
  getPublishVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3186
3287
  getPublishAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3187
- publishAdd(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams, isResume?: boolean, retryTimes?: number, waitSender?: boolean): Promise<string>;
3288
+ publishAdd(streamUrl: string, stream: LocalStream, callId: string, extra?: PublishExtraParams, isResume?: boolean, retryTimes?: number, waitSender?: boolean, reason?: PublishReason): Promise<string>;
3188
3289
  publishDelete(streamUrl: string, options: PublishOptions): Promise<string>;
3189
3290
  publishReplace(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams): Promise<string>;
3190
3291
  publishStop(streamUrl: string): Promise<string>;
@@ -3202,17 +3303,12 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3202
3303
  stream: any;
3203
3304
  } | undefined>;
3204
3305
  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>;
3306
+ publish(streamUrl: string, callId: string, isResume?: boolean, reason?: PublishReason): Promise<string>;
3307
+ subscribe(remoteSubscribeOptions: RemoteSubscribeOptions, reason: SubscribeReason, callId: string, remoteCallId: string, startTs: number): Promise<any>;
3214
3308
  getSubscribeVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3215
3309
  getSubscribeAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3310
+ getStreamByMsid(config: any): LocalStream | RemoteStream;
3311
+ getPCStats(): Promise<any>;
3216
3312
  sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
3217
3313
  }
3218
3314
 
@@ -3232,14 +3328,16 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3232
3328
  protected clientRole: AliRtcSdkClientRole;
3233
3329
  protected env: AliRtcEnv;
3234
3330
  protected maxConnectRetryCount?: number;
3235
- constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, env?: AliRtcEnv);
3331
+ stsManager: StsManager;
3332
+ private slsReporter;
3333
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
3236
3334
  reset(): void;
3237
3335
  /**
3238
3336
  * 向业务信令发送入会
3239
3337
  * @param {AliRtcAuthInfo} authInfo
3240
3338
  * @returns
3241
3339
  */
3242
- join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number): Promise<JoinResult>;
3340
+ join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number, timeRecorder?: TimeRecorder): Promise<JoinResult>;
3243
3341
  retryJoin(): void;
3244
3342
  /**
3245
3343
  * 向业务信令发送离会
@@ -3348,6 +3446,186 @@ declare interface SignalingResult {
3348
3446
  message?: string;
3349
3447
  }
3350
3448
 
3449
+ /**
3450
+ * 日志埋点类
3451
+ * 每个埋点暴露对应的接口
3452
+ */
3453
+ declare class SLSReporter {
3454
+ private engine;
3455
+ protected logClient: LogClient;
3456
+ protected authInfo?: AliRtcAuthInfo;
3457
+ private static staticClient;
3458
+ private static getLogClient;
3459
+ static reportOSSUpload(sessionId: string, date: string, responseCode?: number): void;
3460
+ constructor(engine: AliRtcEngine);
3461
+ /**
3462
+ * 开始建立连接
3463
+ * @param authInfo
3464
+ */
3465
+ start(info: AliRtcAuthInfo): void;
3466
+ updateToken(token: SLSSTSToken, ossToken?: OSSSTSToken): void;
3467
+ /**
3468
+ * 断开连接
3469
+ */
3470
+ stop(): void;
3471
+ reportPublishMonitor(callId: string, traceId: string, trackInfo: TrackInfo, track: MediaStreamTrack | undefined, stats: any[]): void;
3472
+ reportSubscribeMonitor(callId: string, remoteId: string, traceId: string, trackInfo: RemoteMediaTrackInfo, stats: any[]): void;
3473
+ reportNetworkMonitor(candidates: any[]): void;
3474
+ /**
3475
+ * 加入房间成功埋点
3476
+ * @param {number} joinTime
3477
+ * @param {number} result
3478
+ * @param {string} tid
3479
+ */
3480
+ reportJoin(result: number, timeRecord: TimeRecorder, tid?: string): void;
3481
+ /**
3482
+ * Join 链接细节
3483
+ */
3484
+ reportJoinConnection(logInfo: LogInfo): void;
3485
+ /**
3486
+ * 用户离开频道事件埋点
3487
+ * @param {number} leaveTime
3488
+ * @param {number} result
3489
+ * @param {string} tid
3490
+ */
3491
+ reportLeave(leaveTime: number, result: number, tid: string): void;
3492
+ /**
3493
+ * 推流事件上报
3494
+ * @param {string} callid
3495
+ * @param {boolean} isLargeVideo
3496
+ * @param {boolean} isSmallVideo
3497
+ * @param {boolean} isScreenShare
3498
+ * @param {boolean} isAudio
3499
+ * @param {number} result
3500
+ * @param {string} tid
3501
+ * @param {number} pubTime
3502
+ */
3503
+ 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;
3504
+ /**
3505
+ * 首包上报
3506
+ * @param {string} callid
3507
+ * @param {number} startTime
3508
+ * @param {number} publishTime
3509
+ * @param {number} joinTime
3510
+ * @param {string} tckid
3511
+ * @param {string} pcTraceId
3512
+ * @param {string} traceId
3513
+ * @param {PublishReason} reason
3514
+ */
3515
+ reportPublishFirstPacket(isRepublish: boolean, callid: string, startTime: number, publishTime: number, joinTime: number, tckid: string, pcTraceId: string, traceId: string, reason: PublishReason): void;
3516
+ /**
3517
+ * 停止推流事件上报
3518
+ * @param {string} callid
3519
+ * @param {number} unpubTime
3520
+ * @param {number} result
3521
+ * @param {string} tid
3522
+ */
3523
+ reportUnpublish(callid: string, unpubTime: number, result: number, tid: string): void;
3524
+ /**
3525
+ * 订阅事件埋点
3526
+ * @param {string} callid
3527
+ * @param {string} remoteid
3528
+ * @param {boolean} isLargeVideo
3529
+ * @param {boolean} isSmallVideo
3530
+ * @param {boolean} isScreenShare
3531
+ * @param {boolean} isAudio
3532
+ * @param {number} result
3533
+ * @param {string} tid
3534
+ * @param {number} subTime
3535
+ */
3536
+ reportSubscribe(callid: string, remoteid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number, tid: string, subTime: number, logInfo: LogInfo): void;
3537
+ reportSubscribeFirstPacket(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
3538
+ reportSubscribeFirstFrame(isResume: boolean, callid: string, remoteid: string, trackId: string, logInfo: LogInfo): void;
3539
+ /**
3540
+ * 停止订阅事件埋点
3541
+ * @param {string} callid
3542
+ * @param {string} remoteid
3543
+ * @param {number} unsubTime
3544
+ * @param {number} result
3545
+ * @param {string} tid
3546
+ */
3547
+ reportUnsubscribe(callid: string, remoteid: string, unsubTime: number, result: number, tid: string): void;
3548
+ reportMute(callid: string, enable: boolean, type: 'audio' | 'video' | 'screen'): void;
3549
+ /**
3550
+ * 更新角色埋点
3551
+ * @param {string|undefined} or 旧的角色
3552
+ * @param {string} nr 新的角色
3553
+ */
3554
+ reportRoleUpdate(or: string | undefined, nr: string): void;
3555
+ /**
3556
+ * 更新角色埋点
3557
+ * @param {string|undefined} or 旧的角色
3558
+ * @param {string} nr 新的角色
3559
+ */
3560
+ reportRoleUpdateResult(or: string | undefined, nr: string, ctm: number, result: number): void;
3561
+ /**
3562
+ * 设置camera videoprofile
3563
+ */
3564
+ reportVideoProfile(profile: string): void;
3565
+ /**
3566
+ * 设置screenshare videoprofile
3567
+ */
3568
+ reportScreenProfile(profile: string): void;
3569
+ /**
3570
+ * 错误事件埋点
3571
+ * @param err
3572
+ */
3573
+ reportError(err: any): void;
3574
+ /**
3575
+ * 错误事件埋点
3576
+ * @param err
3577
+ */
3578
+ reportWarning(msg: string): void;
3579
+ reportRoomServerEvent(isRequest: boolean, type: string, requestId: string, content: any): void;
3580
+ reportTranscodingError(result: number, taskid: string): void;
3581
+ reportBye(result: number): void;
3582
+ reportAudio(error: any, cost: number, deviceName: string): void;
3583
+ reportScreen(error: any, cost: number): void;
3584
+ reportScreenStop(error: any): void;
3585
+ reportSwitchCamera(deviceId: string): void;
3586
+ reportPublishProfile(trackId: string, logInfo: LogInfo): void;
3587
+ reportSDKCreated(startTs: number): void;
3588
+ reportJoinInvoked(authInfo: AliRtcAuthInfo): void;
3589
+ reportJoinResult(error: any): void;
3590
+ reportSTSResult(code: number): void;
3591
+ reportLeaveInvoked(): void;
3592
+ reportSEIMessage(payloadType: number, length: number, repeatCount: number, delay: number, isKey: boolean): void;
3593
+ /**
3594
+ * 日志埋点
3595
+ * 在埋点中增加tm字段,表示发生埋点的客户端本地时间
3596
+ * @param {any} param 埋点内容
3597
+ */
3598
+ protected log(param: any): void;
3599
+ /**
3600
+ * 将Object转换成string
3601
+ * @param {any} data
3602
+ * @returns {string}
3603
+ */
3604
+ protected data2String(data: any): string;
3605
+ }
3606
+
3607
+ declare interface SLSSTSToken {
3608
+ access_key_id: string;
3609
+ access_key_secret: string;
3610
+ expiration: number;
3611
+ log_store_debug: string;
3612
+ log_store_stats: string;
3613
+ project: string;
3614
+ region_endpoint: string;
3615
+ security_token: string;
3616
+ }
3617
+
3618
+ declare interface SLSToken {
3619
+ access_key_id: string;
3620
+ access_key_secret: string;
3621
+ security_token: string;
3622
+ region_endpoint: string;
3623
+ project: string;
3624
+ log_store_stats: string;
3625
+ log_store_debug: string;
3626
+ expiration: number;
3627
+ }
3628
+
3351
3629
  declare interface StopPreviewConfig {
3352
3630
  videoElement?: HTMLVideoElement;
3353
3631
  primary?: boolean;
@@ -3367,6 +3645,23 @@ declare interface StreamOptions {
3367
3645
  screen?: boolean;
3368
3646
  }
3369
3647
 
3648
+ declare class StsManager extends default_2<StsManagerListener> {
3649
+ static logName: string;
3650
+ private env;
3651
+ private authInfo?;
3652
+ private timer?;
3653
+ private slsReporter;
3654
+ constructor(slsReporter: SLSReporter, env: AliRtcEnv);
3655
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
3656
+ private requestToken;
3657
+ startSTSUpdate(authInfo: AliRtcAuthInfo): void;
3658
+ clear(): void;
3659
+ }
3660
+
3661
+ declare interface StsManagerListener {
3662
+ onTokenUpdate: (ossToken: OSSToken, slsToken: SLSToken) => void;
3663
+ }
3664
+
3370
3665
  declare interface SubConfig {
3371
3666
  isAudioSubscribing: boolean;
3372
3667
  isVideoSubscribing: boolean;
@@ -3380,6 +3675,19 @@ declare type SubscribeOptions = StreamOptions & {
3380
3675
  vMsid?: string;
3381
3676
  };
3382
3677
 
3678
+ declare enum SubscribeReason {
3679
+ InRoom = "inRoom",
3680
+ Join = "join",
3681
+ Publish = "publish",
3682
+ User = "user",
3683
+ Resume = "resume"
3684
+ }
3685
+
3686
+ declare interface TimeRecorder {
3687
+ start: number;
3688
+ [key: string]: number;
3689
+ }
3690
+
3383
3691
  declare enum TrackEvent_2 {
3384
3692
  VideoTrackEnded = "videoTrackEnded",
3385
3693
  AudioTrackEnded = "audioTrackEnded",
@@ -3408,12 +3716,13 @@ declare class User extends default_2<UserListener> {
3408
3716
  protected uid: string;
3409
3717
  protected name: string;
3410
3718
  protected rtsManager: RtsManager;
3411
- callid: string;
3719
+ callId: string;
3412
3720
  protected audioLevelMonitor: AudioLevelMonitor;
3413
3721
  protected audioVolumeIndicationInterval: number;
3414
3722
  constructor(userId: string, displayname: string, rtsManager: RtsManager, interval: number);
3415
3723
  get userId(): string;
3416
3724
  get displayname(): string;
3725
+ protected createCallId(): void;
3417
3726
  setUserInfo(uid: string, displayName: string): void;
3418
3727
  refreshUserInfo(uid: string): void;
3419
3728
  /**
@@ -3449,188 +3758,6 @@ declare interface UserListener {
3449
3758
  remoteSubscribeError: (error: AliRtcError) => void;
3450
3759
  }
3451
3760
 
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
3761
  declare interface VideoScaler {
3635
3762
  getVideoTrack: () => MediaStreamTrack;
3636
3763
  updateOptions: (options: VideoScalerOptions) => void;
@@ -3660,90 +3787,4 @@ declare enum VideoStreamSource {
3660
3787
  Image = 2
3661
3788
  }
3662
3789
 
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 { }
3790
+ export { }