aliyun-rtc-sdk 6.11.6-beta.1 → 6.11.6

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
  }
@@ -203,11 +203,10 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
203
203
  protected channelProfile: AliRtcSdkChannelProfile;
204
204
  protected clientRole: AliRtcSdkClientRole;
205
205
  protected signalingManager: SignalingManager;
206
- protected userManager: UserManager;
206
+ protected bizControl: BizControl;
207
207
  protected liveTranscoding: AliRtcLiveTranscoding;
208
208
  protected maxSignalingConnectRetryCount?: number;
209
- protected reporter: Reporter;
210
- protected webTrackingClient: WebTrackingClient;
209
+ protected slsReporter: SLSReporter;
211
210
  protected connectState: AliRtcConnectionStatus;
212
211
  protected networkError: boolean;
213
212
  private audioMixerPlugin;
@@ -249,7 +248,7 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
249
248
  /**
250
249
  * 监听 UM 事件
251
250
  */
252
- private addUserManagerListeners;
251
+ private addBizControlListeners;
253
252
  /**
254
253
  * 添加信令处理
255
254
  * @returns {void}
@@ -698,9 +697,12 @@ export declare class AliRtcEngine extends default_2<AliRtcEngineEventListener> {
698
697
  /**
699
698
  * @brief 采集偏好设置
700
699
  * @param cameraCapturerConfiguration 偏好设置
701
- * - videoProfile: videoProfileKey IProfile
702
- * - cameraDirection: 设置采集方向,前置或后置摄像头
703
- * - deviceId: 设置采集相机ID
700
+ * - width: 设置采集分辨率宽度 默认 1280
701
+ * - height: 设置采集分辨率高度 默认 720
702
+ * - frameRate: 设置采集帧率 默认 30
703
+ * - bitrate: 设置采集码率 默认 2000
704
+ * - cameraDirection: 设置采集方向,前置或后置摄像头
705
+ * - deviceId: 设置采集相机ID
704
706
  */
705
707
  setCameraCapturerConfiguration(cameraCapturerConfiguration: AliEngineCameraCapturerConfiguration): Promise<void>;
706
708
  /**
@@ -1163,6 +1165,11 @@ declare interface AliRtcEngineEventListener {
1163
1165
  * @note 应该在收到该回调时弹出弹窗引导用户点击页面进行播放,用户点击页面后 SDK 会自动尝试播放
1164
1166
  */
1165
1167
  remoteVideoAutoPlayFail: (uid: string, videoTrack: AliRtcVideoTrack) => void;
1168
+ /**
1169
+ * rtc 传输数据统计
1170
+ * @param stats 统计信息
1171
+ */
1172
+ rtcStats: (stats: any) => void;
1166
1173
  /**
1167
1174
  * 发布视频流的数据统计
1168
1175
  * @param aliRtcStats 统计信息
@@ -1476,6 +1483,8 @@ export declare enum AliRtcErrorCode {
1476
1483
 
1477
1484
  declare class AliRtcLiveTranscoding {
1478
1485
  authInfo?: AliRtcAuthInfo;
1486
+ private slsReporter;
1487
+ constructor(slsReporter: SLSReporter);
1479
1488
  private doRequest;
1480
1489
  setAuthInfo(authInfo: AliRtcAuthInfo): void;
1481
1490
  clear(): void;
@@ -1786,6 +1795,7 @@ export declare abstract class AliRtcPlugin extends default_2<AliRtcPluginListene
1786
1795
  lastOutputAudioTrack?: MediaStreamTrack;
1787
1796
  lastInputVideoTrack?: MediaStreamTrack;
1788
1797
  lastOutputVideoTrack?: MediaStreamTrack;
1798
+ private _hasCleared;
1789
1799
  constructor(name: string, streamType?: AliRtcRawDataStreamType, trackType?: AliRtcPluginTrackType);
1790
1800
  get initOptions(): {};
1791
1801
  getOptions(): any;
@@ -2097,6 +2107,182 @@ declare enum AudioStreamSource {
2097
2107
  Mixed = 2
2098
2108
  }
2099
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
+
2100
2286
  declare enum ClientEventType {
2101
2287
  PullStreamStats = "remoteStat",
2102
2288
  RtsSubscribeExceeds = "rtsSubscribeExceeds",
@@ -2153,16 +2339,6 @@ declare enum DisplayType {
2153
2339
  WHEN_NO_VIDEO = 2
2154
2340
  }
2155
2341
 
2156
- declare enum EventId {
2157
- JoinChannel = 70012,
2158
- JoinChannelRes = 70013,
2159
- LeaveChannel = 70015,
2160
- EnvCheck = 100001,
2161
- Push = 10030,
2162
- Pull = 10050,
2163
- SubscribeStats = 10080
2164
- }
2165
-
2166
2342
  declare interface ISignalingInterface {
2167
2343
  join(authInfo: AliRtcAuthInfo, userName: string, connectRetryCount?: number): Promise<JoinResult>;
2168
2344
  leave(): Promise<SignalingResult>;
@@ -2234,6 +2410,7 @@ declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
2234
2410
  */
2235
2411
  static logName: string;
2236
2412
  private pluginManager;
2413
+ private slsReporter;
2237
2414
  private publishingCameraVideoStream;
2238
2415
  private publishingScreenVideoStream;
2239
2416
  cameraStreamInfo: AliRtcLocalStreamInfo;
@@ -2244,7 +2421,7 @@ declare class LocalStreamManager extends default_2<LocalStreamManagerListener> {
2244
2421
  private _publishLocalAudioStreamEnabled;
2245
2422
  private _publishLocalVideoStreamEnabled;
2246
2423
  private _publishLocalScreenStreamEnabled;
2247
- constructor(pluginManager: PluginManager);
2424
+ constructor(pluginManager: PluginManager, slsReporter: SLSReporter);
2248
2425
  get hasCamera(): boolean;
2249
2426
  get audioCaptureDisabled(): boolean;
2250
2427
  set audioCaptureDisabled(closed: boolean);
@@ -2337,6 +2514,7 @@ declare class LocalUser extends User {
2337
2514
  */
2338
2515
  static logName: string;
2339
2516
  protected url: string;
2517
+ private joinTime;
2340
2518
  private _isPublishing;
2341
2519
  private publishPromise;
2342
2520
  private previewElements;
@@ -2347,8 +2525,11 @@ declare class LocalUser extends User {
2347
2525
  protected signalingManager: SignalingManager;
2348
2526
  traceId: string;
2349
2527
  private monitorTimerId?;
2350
- protected reporter: Reporter;
2351
- protected webTrackingClient: WebTrackingClient;
2528
+ private monitorDataCache;
2529
+ private trackTraceIdMap;
2530
+ private candidateDataCache;
2531
+ private pcMediaStatsMap;
2532
+ protected slsReporter: SLSReporter;
2352
2533
  private audioPubState;
2353
2534
  private videoPubState;
2354
2535
  private videoSmallPubState;
@@ -2442,12 +2623,15 @@ declare class LocalUser extends User {
2442
2623
  createLocalStream(params: LocalStreamConfig): Promise<LocalStream | undefined>;
2443
2624
  stopLocalStream(options: PublishOptions): Promise<void>;
2444
2625
  private compareAndPublish;
2626
+ private reportAudioProfile;
2627
+ private reportVideoProfile;
2628
+ private reportScreenProfile;
2445
2629
  /**
2446
2630
  * 开始推流
2447
2631
  * @param isResume 是否是恢复推流
2448
2632
  * @returns
2449
2633
  */
2450
- startPublish(isResume?: boolean): Promise<void>;
2634
+ startPublish(isResume?: boolean, reason?: PublishReason): Promise<void>;
2451
2635
  /**
2452
2636
  * 对比本地流和正在推流,进行推流更新
2453
2637
  * @param isResume 是否是恢复推流
@@ -2495,6 +2679,10 @@ declare class LocalUser extends User {
2495
2679
  private onTrackEnd;
2496
2680
  private resetPreviewElements;
2497
2681
  private resetSecondayPreviewElements;
2682
+ getMediaStats(id: string): any;
2683
+ private reportPublishMonitor;
2684
+ private reportNetwork;
2685
+ private startStreamMonitor;
2498
2686
  /**
2499
2687
  * 停止本地流数据采集
2500
2688
  */
@@ -2519,14 +2707,14 @@ declare class LocalUser extends User {
2519
2707
  getStats(): Promise<{
2520
2708
  audio: AliRtcLocalAudioStats[];
2521
2709
  video: AliRtcLocalVideoStats[];
2710
+ transport: any;
2522
2711
  }>;
2523
2712
  }
2524
2713
 
2525
2714
  declare interface LocalUserConfig {
2526
2715
  rtsManager: RtsManager;
2527
2716
  localStreamManager: LocalStreamManager;
2528
- reporter: Reporter;
2529
- webTrackingClient: WebTrackingClient;
2717
+ slsReporter: SLSReporter;
2530
2718
  signalingManager: SignalingManager;
2531
2719
  pluginManager: PluginManager;
2532
2720
  audioVolumeIndicationInterval: number;
@@ -2537,12 +2725,16 @@ declare interface LocalUserConfig {
2537
2725
  * 在入会之前,会将埋点缓存,入会后以每200ms一条的速度将缓存的埋点按顺序上报
2538
2726
  */
2539
2727
  declare class LogClient {
2540
- protected reporter?: LogReporter;
2728
+ protected tracker?: default_3;
2541
2729
  protected param?: any;
2542
2730
  protected msgCacheArr: any[];
2543
2731
  protected index: number;
2544
- constructor();
2732
+ protected stsOpt?: any;
2733
+ protected slsToken?: SLSSTSToken;
2734
+ protected ossToken?: OSSSTSToken;
2735
+ private createTracker;
2545
2736
  start(info: AliRtcAuthInfo): void;
2737
+ updateToken(slsToken: SLSSTSToken, ossToken?: OSSSTSToken): void;
2546
2738
  /**
2547
2739
  * 断开连接
2548
2740
  */
@@ -2556,11 +2748,10 @@ declare class LogClient {
2556
2748
  * 初始化公共参数
2557
2749
  */
2558
2750
  protected initParam(info: AliRtcAuthInfo): void;
2559
- /**
2560
- * 通过LogReporter发送日志
2561
- * @param log
2562
- */
2563
- protected realSendReport(log: any): void;
2751
+ }
2752
+
2753
+ declare interface LogInfo {
2754
+ [key: string]: string | number;
2564
2755
  }
2565
2756
 
2566
2757
  declare interface MediaTrackInfo {
@@ -2590,6 +2781,24 @@ declare enum MsidType {
2590
2781
  Screen = "sophon_video_screen_share"
2591
2782
  }
2592
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
+
2593
2802
  declare class PluginManager extends default_2<PluginManagerListener> {
2594
2803
  private plugins;
2595
2804
  add(plugin: AliRtcPlugin, options: any): void;
@@ -2624,6 +2833,7 @@ declare interface PublishExtraParams {
2624
2833
  }
2625
2834
 
2626
2835
  declare interface PublishInfo {
2836
+ type: PublishType;
2627
2837
  userid: string;
2628
2838
  sessionid: string;
2629
2839
  displayname: string;
@@ -2643,6 +2853,11 @@ declare type PublishOptions = StreamOptions & {
2643
2853
  vMsid?: string;
2644
2854
  };
2645
2855
 
2856
+ declare enum PublishReason {
2857
+ MANUAL = 0,
2858
+ JOINCHANNEL = 1
2859
+ }
2860
+
2646
2861
  declare interface PublishStreamInfo {
2647
2862
  audio?: LocalStream;
2648
2863
  video?: LocalStream;
@@ -2652,6 +2867,14 @@ declare interface PublishStreamInfo {
2652
2867
  screenProfile?: LocalProfileManager;
2653
2868
  }
2654
2869
 
2870
+ declare enum PublishType {
2871
+ Add = "add",
2872
+ Delete = "delete",
2873
+ Replace = "replace",
2874
+ Stop = "stop",
2875
+ UnPublish = "unpublish"
2876
+ }
2877
+
2655
2878
  declare interface PublishUser {
2656
2879
  callid: string;
2657
2880
  clientrole?: string;
@@ -2718,6 +2941,7 @@ declare class RemoteStreamInfo extends default_2<StreamListener> {
2718
2941
  * @returns
2719
2942
  */
2720
2943
  getScreenInfo(): RemoteMediaTrackInfo;
2944
+ get subscribingInfos(): RemoteMediaTrackInfo[];
2721
2945
  /**
2722
2946
  * 远端流是否包含音频轨道
2723
2947
  * @returns
@@ -2795,7 +3019,7 @@ declare class RemoteUser extends User {
2795
3019
  static logName: string;
2796
3020
  remoteCallid: string;
2797
3021
  remoteUserInfo: AliRtcRemoteUserInfo;
2798
- protected localUserId: string;
3022
+ protected localUser?: LocalUser;
2799
3023
  protected lastPubId: string;
2800
3024
  protected stream?: RemoteStream;
2801
3025
  protected screenStream?: RemoteStream;
@@ -2807,13 +3031,13 @@ declare class RemoteUser extends User {
2807
3031
  protected secondaryMediaStream?: MediaStream;
2808
3032
  protected prevSubConfig?: SubConfig;
2809
3033
  protected signalingManager: SignalingManager;
2810
- protected reporter: Reporter;
2811
- protected webTrackingClient: WebTrackingClient;
3034
+ protected slsReporter: SLSReporter;
2812
3035
  private wantSubAudio;
2813
3036
  private wantSubVideo;
2814
3037
  private wantSubScreen;
2815
3038
  private defaultVideoStreamType;
2816
3039
  private audioMuted;
3040
+ private playoutVolume;
2817
3041
  private audioSubState;
2818
3042
  private videoSubState;
2819
3043
  private videoLargeSubState;
@@ -2821,7 +3045,9 @@ declare class RemoteUser extends User {
2821
3045
  private screenSubState;
2822
3046
  streamInfo: RemoteStreamInfo;
2823
3047
  streamUrl: string;
2824
- private playoutVolume;
3048
+ private monitorTimerId?;
3049
+ private monitorDataCache;
3050
+ private trackTraceIdMap;
2825
3051
  constructor(config: RemoteUserConfig);
2826
3052
  isWantSubAudio(): boolean;
2827
3053
  setWantSubAudio(value: boolean): void;
@@ -2874,7 +3100,7 @@ declare class RemoteUser extends User {
2874
3100
  * @param {SubscribeOptions} options
2875
3101
  * @returns {Promise<void>} 返回可播放的 MediaStream,可能为空。如果同时订阅了主流和辅流,只会返回主流对应的 MediaStream
2876
3102
  */
2877
- subscribe(options?: SubscribeOptions): Promise<void>;
3103
+ subscribe(options?: SubscribeOptions, reason?: SubscribeReason, startTs?: number): Promise<void>;
2878
3104
  /**
2879
3105
  * 订阅远端流
2880
3106
  * @param {SubscribeOptions} options 订阅配置
@@ -2922,7 +3148,7 @@ declare class RemoteUser extends User {
2922
3148
  * 尝试更新订阅
2923
3149
  * 1. 需要新增订阅的情况:想要订阅 & 没有正在订阅 & 远端有流
2924
3150
  */
2925
- updateSubscribe(): {
3151
+ updateSubscribe(reason: SubscribeReason): {
2926
3152
  addOption: SubscribeOptions;
2927
3153
  deleteOption: SubscribeOptions;
2928
3154
  };
@@ -2963,6 +3189,12 @@ declare class RemoteUser extends User {
2963
3189
  * @param {number} interval 时间间隔
2964
3190
  */
2965
3191
  enableAudioVolumeIndication(interval: number): void;
3192
+ private reportSubscribeMonitor;
3193
+ private startStreamMonitor;
3194
+ /**
3195
+ * 停止本地流数据采集
3196
+ */
3197
+ private stopStreamMonitor;
2966
3198
  }
2967
3199
 
2968
3200
  declare interface RemoteUserConfig {
@@ -2972,10 +3204,9 @@ declare interface RemoteUserConfig {
2972
3204
  usersViewMap: {
2973
3205
  [key: string]: RemoteUserViewMap;
2974
3206
  };
2975
- reporter: Reporter;
2976
- webTrackingClient: WebTrackingClient;
3207
+ slsReporter: SLSReporter;
2977
3208
  signalingManager: SignalingManager;
2978
- localUserId: string;
3209
+ localUser?: LocalUser;
2979
3210
  audioVolumeIndicationInterval: number;
2980
3211
  playoutVolume: number;
2981
3212
  }
@@ -2995,242 +3226,71 @@ declare interface RemoteUserViewMap {
2995
3226
  }
2996
3227
 
2997
3228
  /**
2998
- * 日志埋点类
2999
- * 每个埋点暴露对应的接口
3229
+ * RoomServerMessageCenter支持的事件
3000
3230
  */
3001
- declare class Reporter {
3002
- protected logClient: LogClient;
3003
- constructor();
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> {
3004
3254
  /**
3005
- * 开始建立连接
3006
- * @param authInfo
3255
+ * @ignore
3007
3256
  */
3008
- start(info: AliRtcAuthInfo): void;
3009
- /**
3010
- * 断开连接
3011
- */
3012
- stop(): void;
3013
- /**
3014
- * 加入房间成功埋点
3015
- * @param {number} joinTime
3016
- * @param {number} result
3017
- * @param {string} tid
3018
- */
3019
- reportJoin(joinTime: number, result: number, tid: string): void;
3020
- /**
3021
- * 调用 client.join 入会上报事件及用户等信息
3022
- * @param {string} usrid 用户id
3023
- * @param {string} usrn 用户名
3024
- * @param {string} channelid 频道id
3025
- */
3026
- reportJoinInvoked(usrid: string, usrn: string, channelid: string): void;
3027
- /**
3028
- * 上报ice状态变化
3029
- * @param {string} calid
3030
- * @param {string} icestate
3031
- * @param {number} evt_seq
3032
- */
3033
- reportIceState(calid: string, icestate: string, evt_seq: number): void;
3034
- /**
3035
- * 用户离开频道事件埋点
3036
- * @param {number} leaveTime
3037
- * @param {number} result
3038
- * @param {string} tid
3039
- */
3040
- reportLeave(leaveTime: number, result: number, tid: string): void;
3041
- /**
3042
- * 调用 client.leave 离会上报事件
3043
- */
3044
- reportLeaveInvoked(): void;
3045
- /**
3046
- * 推流事件上报
3047
- * @param {string} callid
3048
- * @param {boolean} isLargeVideo
3049
- * @param {boolean} isSmallVideo
3050
- * @param {boolean} isScreenShare
3051
- * @param {boolean} isAudio
3052
- * @param {number} result
3053
- * @param {string} tid
3054
- * @param {number} pubTime
3055
- */
3056
- reportPublish(callid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number | undefined, tid: string, pubTime: number): void;
3057
- /**
3058
- * 调用 client.publish 推流上报事件及流轨道等信息
3059
- * @param {boolean} [isLargeVideo] 是否推视频大流
3060
- * @param {boolean} [isSmallVideo] 是否推视频小流
3061
- * @param {boolean} [isScreenShare] 是否推屏幕流
3062
- * @param {boolean} [isAudio] 是否推音频流
3063
- */
3064
- reportPublishInvoked(isLargeVideo?: boolean, isSmallVideo?: boolean, isScreenShare?: boolean, isAudio?: boolean): void;
3065
- /**
3066
- * republish事件上报
3067
- * @param callid
3068
- * @param islarge 是否推大流
3069
- * @param isScreenShare 是否推屏幕流
3070
- * @param isAudio 是否推音频流
3071
- * @param result 推流结果(0成功,非0失败)
3072
- * @param tid tid
3073
- * @param repubTime repub耗时
3074
- * @param msg 详情描述
3075
- */
3076
- reportRepublish(callid: string, isLarge: boolean, isScreen: boolean, isAudio: boolean, result: number, tid: string, repubTime: number, msg: string): void;
3077
- /**
3078
- * 用户调用LocalStream.addTrack 或者 LocalStream.removeTrack
3079
- * @param callid
3080
- * @param trackType
3081
- * @param state -1: remove 0: replace 1: add
3082
- */
3083
- reportRepublishInvoked(callid: string, trackType: string, state: 0 | 1 | -1): void;
3084
- /**
3085
- * 停止推流事件上报
3086
- * @param {string} callid
3087
- * @param {number} unpubTime
3088
- * @param {number} result
3089
- * @param {string} tid
3090
- */
3091
- reportUnpublish(callid: string, unpubTime: number, result: number, tid: string): void;
3092
- /**
3093
- * 调用 client.unpublish 停止推流上报事件
3094
- */
3095
- reportUnpublishInvoked(): void;
3096
- /**
3097
- * 订阅事件埋点
3098
- * @param {string} callid
3099
- * @param {string} remoteid
3100
- * @param {boolean} isLargeVideo
3101
- * @param {boolean} isSmallVideo
3102
- * @param {boolean} isScreenShare
3103
- * @param {boolean} isAudio
3104
- * @param {number} result
3105
- * @param {string} tid
3106
- * @param {number} subTime
3107
- */
3108
- reportSubscribe(callid: string, remoteid: string, isLargeVideo: boolean, isSmallVideo: boolean, isScreenShare: boolean, isAudio: boolean, result: number, tid: string, subTime: number, usrid: string): void;
3109
- /**
3110
- * 调用 client.subscribe 拉流上报事件及用户信息、流轨道等信息
3111
- * @param {string} rmtid 远程流所属的用户id
3112
- * @param {boolean} [isLargeVideo] 是否推视频大流
3113
- * @param {boolean} [isSmallVideo] 是否推视频小流
3114
- * @param {boolean} [isScreenShare] 是否推屏幕流
3115
- * @param {boolean} [isAudio] 是否推音频流
3116
- */
3117
- reportSubscribeInvoked(rmtid?: string, isLargeVideo?: boolean, isSmallVideo?: boolean, isScreenShare?: boolean, isAudio?: boolean): void;
3118
- /**
3119
- * 停止订阅事件埋点
3120
- * @param {string} callid
3121
- * @param {string} remoteid
3122
- * @param {number} unsubTime
3123
- * @param {number} result
3124
- * @param {string} tid
3125
- */
3126
- reportUnsubscribe(callid: string, remoteid: string, unsubTime: number, result: number, tid: string): void;
3127
- /**
3128
- * 调用 client.unsubscribe 停止拉流上报事件
3129
- * @param {string} rmtid 远程流所属的用户id
3130
- */
3131
- reportUnsubscribeInvoked(rmtid?: string): void;
3132
- /**
3133
- * 更新角色埋点
3134
- * @param {string|undefined} or 旧的角色
3135
- * @param {string} nr 新的角色
3136
- * @param {number} ctm 耗时
3137
- * @param {number} rslt 是否成功
3138
- */
3139
- reportRoleUpdate(or: string | undefined, nr: string, ctm: number, rslt: number): void;
3140
- /**
3141
- * 调用 client.setClientRole 更新角色上报事件
3142
- * @param {string} nr 新角色值
3143
- */
3144
- reportRoleUpdateInvoked(nr: string): void;
3145
- /**
3146
- * 设置camera videoprofile
3147
- */
3148
- reportVideoProfile(profile: string): void;
3149
- /**
3150
- * 设置screenshare videoprofile
3151
- */
3152
- reportScreenProfile(profile: string): void;
3153
- /**
3154
- * 错误事件埋点
3155
- * @param err
3156
- */
3157
- reportError(err: any): void;
3158
- /**
3159
- * 日志埋点
3160
- * 在埋点中增加tm字段,表示发生埋点的客户端本地时间
3161
- * @param {any} param 埋点内容
3162
- */
3163
- protected log(param: any): void;
3164
- /**
3165
- * 将Object转换成string
3166
- * @param {any} data
3167
- * @returns {string}
3168
- */
3169
- protected data2String(data: any): string;
3170
- }
3171
-
3172
- /**
3173
- * RoomServerMessageCenter支持的事件
3174
- */
3175
- declare interface RoomServerListener {
3176
- onJoinChannelResult: (data: any) => void;
3177
- onPublishResult: (code: number, tid: string, description: string) => void;
3178
- onNotifyJoin: (users: JoinInfo[]) => void;
3179
- onNotifyStatus: (users: RemoteUserStatus[]) => void;
3180
- onLeaveResult: (code: number, tid: string) => void;
3181
- onRoleUpdateResult: (code: number, tid: string, description: string) => void;
3182
- onRefreshUrlResult: (data: any) => void;
3183
- onNotifyLeave: (users: LeaveInfo[]) => void;
3184
- onNotifyPublish: (users: PublishUser[]) => void;
3185
- onStatusReport: (code: number, tid: string, description: string) => void;
3186
- onBye: (reason: AliRtcOnByeType, description: string) => void;
3187
- onKeepAliveRsp: () => void;
3188
- onConnectFail: (err: AliRtcError) => void;
3189
- onNetworkError: (err: AliRtcError) => void;
3190
- onAuthInvalid: () => void;
3191
- onReconnectStart: () => void;
3192
- onReconnectFail: (err: AliRtcError) => void;
3193
- onReconnectSuccess: (users: JoinInfo[]) => void;
3194
- onError: (err: AliRtcError) => void;
3195
- }
3196
-
3197
- declare class RtsManager extends default_2<RtsManagerEventListener> {
3198
- /**
3199
- * @ignore
3200
- */
3201
- static logName: string;
3202
- private rts;
3203
- private encodedInsertableStreams;
3204
- private audioRedEnabled;
3205
- private localStreamManager;
3206
- private connecting;
3207
- private connected;
3208
- private connectionResolve?;
3209
- connectingPromise?: Promise<unknown>;
3210
- private dcResolve?;
3211
- dcConnectingPromise?: Promise<unknown>;
3212
- private _publishingTracks;
3213
- constructor(localStreamManager: LocalStreamManager);
3214
- setEncodedInsertableStreams(enable: boolean): void;
3215
- setAudioRedEnabled(enable: boolean): void;
3216
- destroy(): void;
3217
- private startConnect;
3218
- private setConnected;
3219
- get isConnecting(): boolean;
3220
- get isConnected(): boolean;
3221
- get publishingTracks(): TrackInfo[];
3222
- private getPubMsid;
3223
- private updatePublishingTracks;
3224
- private httpPublish;
3225
- private waitPublishSender;
3226
- private checkSubscribeStats;
3227
- getPublishVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3228
- getPublishAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3229
- publishAdd(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams, isResume?: boolean, retryTimes?: number, waitSender?: boolean): Promise<string>;
3230
- publishDelete(streamUrl: string, options: PublishOptions): Promise<string>;
3231
- publishReplace(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams): Promise<string>;
3232
- publishStop(streamUrl: string): Promise<string>;
3233
- unpublish(): Promise<void>;
3257
+ static logName: string;
3258
+ private rts;
3259
+ private encodedInsertableStreams;
3260
+ private audioRedEnabled;
3261
+ private localStreamManager;
3262
+ private slsReporter;
3263
+ private connecting;
3264
+ private connected;
3265
+ private _pcTraceId;
3266
+ private _localJoinTime;
3267
+ private connectionResolve?;
3268
+ connectingPromise?: Promise<unknown>;
3269
+ private dcResolve?;
3270
+ dcConnectingPromise?: Promise<unknown>;
3271
+ private _publishingTracks;
3272
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter);
3273
+ get pcTraceId(): string;
3274
+ set localJoinTime(time: number);
3275
+ setEncodedInsertableStreams(enable: boolean): void;
3276
+ setAudioRedEnabled(enable: boolean): void;
3277
+ destroy(): void;
3278
+ private startConnect;
3279
+ private setConnected;
3280
+ get isConnecting(): boolean;
3281
+ get isConnected(): boolean;
3282
+ get publishingTracks(): TrackInfo[];
3283
+ private getPubMsid;
3284
+ private updatePublishingTracks;
3285
+ private httpPublish;
3286
+ private waitPublishSender;
3287
+ getPublishVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3288
+ getPublishAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3289
+ publishAdd(streamUrl: string, stream: LocalStream, callId: string, extra?: PublishExtraParams, isResume?: boolean, retryTimes?: number, waitSender?: boolean, reason?: PublishReason): Promise<string>;
3290
+ publishDelete(streamUrl: string, options: PublishOptions): Promise<string>;
3291
+ publishReplace(streamUrl: string, stream: LocalStream, extra?: PublishExtraParams): Promise<string>;
3292
+ publishStop(streamUrl: string): Promise<string>;
3293
+ unpublish(): Promise<void>;
3234
3294
  /**
3235
3295
  * 获取 sub/subAdd config
3236
3296
  * @param {ISubscribeConfig | ISubConfigItem} options
@@ -3244,17 +3304,12 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3244
3304
  stream: any;
3245
3305
  } | undefined>;
3246
3306
  subscibeStop(streamUrl: string): Promise<void>;
3247
- publish(streamUrl: string, isResume?: boolean): Promise<string>;
3248
- subscribe(remoteSubscribeOptions: RemoteSubscribeOptions): Promise<{
3249
- traceId: string;
3250
- stream: RemoteStream;
3251
- } | {
3252
- url: string;
3253
- stream: RemoteStream;
3254
- traceId?: string | undefined;
3255
- } | 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>;
3256
3309
  getSubscribeVideoStats(streamUrl: string, msid?: string): Promise<unknown>;
3257
3310
  getSubscribeAudioStats(streamUrl: string, msid?: string): Promise<unknown>;
3311
+ getStreamByMsid(config: any): LocalStream | RemoteStream;
3312
+ getPCStats(): Promise<any>;
3258
3313
  sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
3259
3314
  }
3260
3315
 
@@ -3274,14 +3329,16 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3274
3329
  protected clientRole: AliRtcSdkClientRole;
3275
3330
  protected env: AliRtcEnv;
3276
3331
  protected maxConnectRetryCount?: number;
3277
- constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, env?: AliRtcEnv);
3332
+ stsManager: StsManager;
3333
+ private slsReporter;
3334
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
3278
3335
  reset(): void;
3279
3336
  /**
3280
3337
  * 向业务信令发送入会
3281
3338
  * @param {AliRtcAuthInfo} authInfo
3282
3339
  * @returns
3283
3340
  */
3284
- join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number): Promise<JoinResult>;
3341
+ join(authInfo: AliRtcAuthInfo, userName?: string, maxConnectRetryCount?: number, timeRecorder?: TimeRecorder): Promise<JoinResult>;
3285
3342
  retryJoin(): void;
3286
3343
  /**
3287
3344
  * 向业务信令发送离会
@@ -3390,6 +3447,186 @@ declare interface SignalingResult {
3390
3447
  message?: string;
3391
3448
  }
3392
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
+
3393
3630
  declare interface StopPreviewConfig {
3394
3631
  videoElement?: HTMLVideoElement;
3395
3632
  primary?: boolean;
@@ -3409,6 +3646,25 @@ declare interface StreamOptions {
3409
3646
  screen?: boolean;
3410
3647
  }
3411
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
+
3412
3668
  declare interface SubConfig {
3413
3669
  isAudioSubscribing: boolean;
3414
3670
  isVideoSubscribing: boolean;
@@ -3422,6 +3678,19 @@ declare type SubscribeOptions = StreamOptions & {
3422
3678
  vMsid?: string;
3423
3679
  };
3424
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
+
3425
3694
  declare enum TrackEvent_2 {
3426
3695
  VideoTrackEnded = "videoTrackEnded",
3427
3696
  AudioTrackEnded = "audioTrackEnded",
@@ -3450,12 +3719,13 @@ declare class User extends default_2<UserListener> {
3450
3719
  protected uid: string;
3451
3720
  protected name: string;
3452
3721
  protected rtsManager: RtsManager;
3453
- callid: string;
3722
+ callId: string;
3454
3723
  protected audioLevelMonitor: AudioLevelMonitor;
3455
3724
  protected audioVolumeIndicationInterval: number;
3456
3725
  constructor(userId: string, displayname: string, rtsManager: RtsManager, interval: number);
3457
3726
  get userId(): string;
3458
3727
  get displayname(): string;
3728
+ protected createCallId(): void;
3459
3729
  setUserInfo(uid: string, displayName: string): void;
3460
3730
  refreshUserInfo(uid: string): void;
3461
3731
  /**
@@ -3491,190 +3761,6 @@ declare interface UserListener {
3491
3761
  remoteSubscribeError: (error: AliRtcError) => void;
3492
3762
  }
3493
3763
 
3494
- declare class UserManager extends default_2<UserManagerListener> {
3495
- /**
3496
- * @ignore
3497
- */
3498
- static logName: string;
3499
- protected self: LocalUser | undefined;
3500
- protected userMap: RemoteUserMap;
3501
- private usersViewMap;
3502
- rtsManager: RtsManager;
3503
- protected localStreamManager: LocalStreamManager;
3504
- protected authInfo?: AliRtcAuthInfo;
3505
- protected signalingManager: SignalingManager;
3506
- pluginManager: PluginManager;
3507
- protected reporter: Reporter;
3508
- protected webTrackingClient: WebTrackingClient;
3509
- private statsMonitorId?;
3510
- private autoSubAudio;
3511
- private autoSubVideo;
3512
- private autoSubScreen;
3513
- private wantSubAudio;
3514
- private wantSubVideo;
3515
- private wantSubScreen;
3516
- private defaultStreamType;
3517
- private audioMuted;
3518
- private playoutVolume;
3519
- private audioVolumeIndicationInterval;
3520
- private indicationTimer;
3521
- constructor(config: UserManagerConfig);
3522
- private addSignalingManagerListener;
3523
- isAutoSubAudio(): boolean;
3524
- setAutoSubAudio(value: boolean): void;
3525
- isAutoSubVideo(): boolean;
3526
- setAutoSubVideo(value: boolean): void;
3527
- isAutoSubScreen(): boolean;
3528
- setAutoSubScreen(value: boolean): void;
3529
- isWantSubAudio(): boolean;
3530
- setWantSubAudio(value: boolean): void;
3531
- isWantSubVideo(): boolean;
3532
- setWantSubVideo(value: boolean): void;
3533
- isWantSubScreen(): boolean;
3534
- setWantSubScreen(value: boolean): void;
3535
- setRemoteDefaultVideoStreamType(type: AliRtcVideoStreamType): void;
3536
- setRemoteUserVideoStreamType(userId: string, type: AliRtcVideoStreamType): void;
3537
- setAudioMuted(mute: boolean): void;
3538
- setLocalViewConfig(view: AliRtcLocalView, track: AliRtcVideoTrack): void;
3539
- setRemoteViewConfig(uid: string, view: AliRtcLocalView, track: AliRtcVideoTrack): void;
3540
- get channel(): string | undefined;
3541
- get userId(): string | undefined;
3542
- get remoteUsers(): RemoteUser[];
3543
- /**
3544
- * 获取推流对象,只能是自己
3545
- */
3546
- get publisher(): LocalUser | undefined;
3547
- get isSubscribing(): boolean;
3548
- /**
3549
- * 处理远端用户推流状态变化
3550
- * @param {string} userId
3551
- * @param {string} displayname
3552
- * @param {string} callid
3553
- * @param {string} pullStreamUrl
3554
- * @param {TrackInfo[]} tracks
3555
- * @returns {void}
3556
- */
3557
- onRemotePublishStateChange(publishInfo: PublishUser): void;
3558
- /**
3559
- * 登陆成功后初始化用户管理,创建自己
3560
- * @param {AliRtcAuthInfo} authInfo
3561
- * @param {string} pushStreamUrl
3562
- * @returns {Promise<void>}
3563
- */
3564
- init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
3565
- /**
3566
- * 离会后清除所有数据
3567
- * @returns {Promise<void>}
3568
- */
3569
- clear(): Promise<void>;
3570
- private startStatsMonitor;
3571
- private stopStatsMonitor;
3572
- /**
3573
- * 根据userId获取RemoteUser
3574
- * @param {string} userId
3575
- * @param {string} displayname
3576
- * @returns {RemoteUser}
3577
- */
3578
- getUser(userId: string, displayname: string): RemoteUser;
3579
- /**
3580
- * 添加远端用户
3581
- * @param {string} userId
3582
- * @param {string} displayName
3583
- * @returns {void}
3584
- */
3585
- addUser(userId: string, displayName: string): RemoteUser;
3586
- /**
3587
- * 执行添加远端用户
3588
- * @param {string} userId
3589
- * @param {string} displayName
3590
- * @returns {RemoteUser}
3591
- */
3592
- private executeAddUser;
3593
- /**
3594
- * 远端用户设备状态变化
3595
- * @param {DeviceStatusChangeType} event
3596
- * @param {string} userId
3597
- */
3598
- private onRemoteDeviceStatusChange;
3599
- /**
3600
- * 远端流数据采集上报
3601
- * @param {any} stat
3602
- */
3603
- private onRemoteStatReport;
3604
- /**
3605
- * rts 单 PC 订阅超限
3606
- */
3607
- private onSubscribeExceeds;
3608
- /**
3609
- * 移除远端用户
3610
- * @param {LeaveInfo} user
3611
- * @returns {Promise<void>}
3612
- */
3613
- removeLeftUser(user: LeaveInfo): Promise<void>;
3614
- /**
3615
- * 更新远端用户数据
3616
- * @param {JoinInfo[]} users
3617
- * @returns {{joinList: JoinInfo[], leaveList: LeaveInfo[], presentList: JoinInfo[]}}
3618
- */
3619
- updateUsers(users: JoinInfo[]): {
3620
- joinList: JoinInfo[];
3621
- leaveList: LeaveInfo[];
3622
- presentList: JoinInfo[];
3623
- };
3624
- /**
3625
- * 根据 userId 获取 RemoteUser
3626
- * @param {string} userId
3627
- * @returns {RemoteUser | undefined}
3628
- */
3629
- getRemoteUser(userId: string): RemoteUser | undefined;
3630
- /**
3631
- * 更新远端用户设备信息
3632
- * @param {RemoteUserStatus} user
3633
- * @returns {boolean} true: 用户状态改变 false: 用户状态没有改变
3634
- */
3635
- updateRemoteUserDeviceStatus(user: RemoteUserStatus): void;
3636
- updateAudioWant(uid: string, sub: boolean): void;
3637
- updateVideoWant(uid: string, sub: boolean): void;
3638
- updateScreenWant(uid: string, sub: boolean): void;
3639
- private stopIndication;
3640
- private startIndication;
3641
- enableAudioVolumeIndication(interval: number): void;
3642
- setPlayoutVolume(volume: number): void;
3643
- refreshAuthInfo(authInfo: AliRtcRefreshAuthInfo): void;
3644
- setEnableMediaExtensionMsg(enable: boolean): void;
3645
- setAudioRedEnabled(enable: boolean): void;
3646
- }
3647
-
3648
- declare interface UserManagerConfig {
3649
- reporter: Reporter;
3650
- webTrackingClient: WebTrackingClient;
3651
- signalingManager: SignalingManager;
3652
- }
3653
-
3654
- declare interface UserManagerListener {
3655
- [ClientEventType.RtsSubscribeExceeds]: (userId: string, options?: SubscribeOptions) => void;
3656
- [DeviceStatusChange.Remote]: (event: DeviceStatusChangeType, userId: string) => void;
3657
- [ClientEventType.PullStreamStats]: (userId: string, stat: any, pullStreamUrl: string) => void;
3658
- remoteTrackAvailableChange: (uid: string, aliRtcAudioTrack: AliRtcAudioTrack, aliRtcVideoTrack: AliRtcVideoTrack) => void;
3659
- audioSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3660
- videoSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3661
- screenSubscribeStateChanged: (uid: string, oldState: AliRtcSubscribeState, newState: AliRtcSubscribeState, elapseSinceLastState: number, channel: string) => void;
3662
- userAudioMuted: (uid: string, isMute: boolean) => void;
3663
- userVideoMuted: (uid: string, isMute: boolean) => void;
3664
- userScreenMuted: (userId: string, isMute: boolean) => void;
3665
- audioVolume: (speakers: {
3666
- userId: string;
3667
- volume: number;
3668
- }[]) => void;
3669
- rtcLocalVideoStats: (stats: AliRtcLocalVideoStats[]) => void;
3670
- rtcLocalAudioStats: (stats: AliRtcLocalAudioStats[]) => void;
3671
- rtcRemoteVideoStats: (stats: AliRtcRemoteVideoStats[]) => void;
3672
- rtcRemoteAudioStats: (stats: AliRtcRemoteAudioStats[]) => void;
3673
- remoteAudioAutoPlayFail: (uid: string) => void;
3674
- remoteVideoAutoPlayFail: (uid: string, track: AliRtcVideoTrack) => void;
3675
- remoteSubscribeError: (error: AliRtcError) => void;
3676
- }
3677
-
3678
3764
  declare interface VideoScaler {
3679
3765
  getVideoTrack: () => MediaStreamTrack;
3680
3766
  updateOptions: (options: VideoScalerOptions) => void;
@@ -3704,90 +3790,4 @@ declare enum VideoStreamSource {
3704
3790
  Image = 2
3705
3791
  }
3706
3792
 
3707
- declare interface WebTrackConfig {
3708
- biz: string;
3709
- extraParams?: string;
3710
- }
3711
-
3712
- declare class WebTrackingClient {
3713
- protected index: number;
3714
- private tracker?;
3715
- private enable;
3716
- private commonParams;
3717
- constructor(config?: WebTrackConfig | boolean);
3718
- updateAuthInfo(info: AliRtcAuthInfo): void;
3719
- /**
3720
- * 调用加入房间API事件
3721
- * @param {AliRtcAuthInfo} authInfo 鉴权信息
3722
- */
3723
- reportJoinChannel(authInfo: AliRtcAuthInfo): void;
3724
- /**
3725
- * @method: 调用加入房间结果
3726
- * @param { rslt: 执行结果 code,0为成功,错误返回其他错误码 }
3727
- * @param { message: 执行结果,成功返回 success,失败返回失败 message }
3728
- * @param { ct: 耗时 }
3729
- * @return {*}
3730
- */
3731
- reportJoinChannelRes(rslt: number, message: string, ct: number): void;
3732
- /**
3733
- * 离会调用通知
3734
- */
3735
- reportLeaveChannel(): void;
3736
- /**
3737
- * 推流成功
3738
- * @param {string} calid(失败时为空)
3739
- * @param {boolean} isvl 是否推大流
3740
- * @param {boolean} isvs 是否推小流
3741
- * @param {boolean} isvss 是否推屏幕共享流
3742
- * @param {boolean} isaudio 是否推音频流
3743
- * @param {number} rslt 推流结果:成功0,失败错误码
3744
- * @param {string} tid 房间信令 tid
3745
- * @param {number} pubtm 执行推流到推流结束信令通知结束的耗时
3746
- * @param {number} est 开始时间
3747
- * @param {string} dctid 使用 datachannel 的 traceId
3748
- * @param {string} httptid 使用 http 建连的 traceId
3749
- * @param {string} url 推流地址
3750
- */
3751
- 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;
3752
- /**
3753
- * 拉流成功
3754
- * @param {string} calid 鉴权 callid (失败为空)
3755
- * @param {string} rmtid 远端用户 userId
3756
- * @param {boolean} isvl 是否拉视频大流
3757
- * @param {boolean} isvs 是否拉视频小流
3758
- * @param {boolean} isvss 是否拉屏幕分享流
3759
- * @param {boolean} isaudio 是否拉音频流
3760
- * @param {number} rslt 拉流结果:成功0,失败错误码
3761
- * @param {number} subtm 订阅耗时
3762
- * @param {string} dctid 使用 datachannel 的 traceId
3763
- * @param {string} httptid 使用 http 建连的 traceId
3764
- * @param {string} url 拉流地址
3765
- * @param {number} est 开始时间
3766
- */
3767
- 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;
3768
- /**
3769
- * 上报订阅流的音频数据
3770
- * @param {string} rmtid 远端用户 userId
3771
- * @param {any} stats 流数据
3772
- */
3773
- reportSubscribeAudioStats(rmtid: string, stats: any): void;
3774
- /**
3775
- * 上报订阅流的视频数据
3776
- * @param {string} rmtid 远端用户 userId
3777
- * @param {any} stats 流数据
3778
- */
3779
- reportSubscribeVideoStats(rmtid: string, stats: any): void;
3780
- /**
3781
- * webTracking 埋点上报
3782
- * @param {string | number} msgId 事件标识
3783
- * @param {Record<string, any>} args 事件携带参数
3784
- * @param {Record<string, any>} params 单个打点携带的其他参数
3785
- */
3786
- protected report(msgId: string | number | EventId, args?: Record<string, any>, params?: Record<string, any>): void;
3787
- /**
3788
- * 上报环境监测的结果
3789
- */
3790
- static reportCheck(result: any, biz?: string): void;
3791
- }
3792
-
3793
- export { }
3793
+ export { }