aliyun-rtc-sdk 7.2.2 → 7.2.4

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.
@@ -1027,6 +1027,11 @@ declare class AliRtcLocalStreamInfo extends EventEmitter$1<AliRtcLocalStreamList
1027
1027
  * @param publishStream
1028
1028
  */
1029
1029
  cloneVideoProfile(publishStream: LocalStream): Promise<void>;
1030
+ /**
1031
+ * 复制音频 profile 到指定 LocalStream
1032
+ * @param publishStream
1033
+ */
1034
+ cloneAudioProfile(publishStream: LocalStream): Promise<void>;
1030
1035
  addPlugin(plugin: AliRtcPlugin): void;
1031
1036
  removePlugin(plugin: AliRtcPlugin): boolean;
1032
1037
  }
@@ -1028,6 +1028,11 @@ declare class AliRtcLocalStreamInfo extends EventEmitter$1<AliRtcLocalStreamList
1028
1028
  * @param publishStream
1029
1029
  */
1030
1030
  cloneVideoProfile(publishStream: LocalStream): Promise<void>;
1031
+ /**
1032
+ * 复制音频 profile 到指定 LocalStream
1033
+ * @param publishStream
1034
+ */
1035
+ cloneAudioProfile(publishStream: LocalStream): Promise<void>;
1031
1036
  addPlugin(plugin: AliRtcPlugin): void;
1032
1037
  removePlugin(plugin: AliRtcPlugin): boolean;
1033
1038
  }
@@ -1022,10 +1022,17 @@ declare class AliRtcEngine_2 extends default_2<AliRtcEngineEventListener> {
1022
1022
  * @param dataChannelMsg 伴奏控制消息
1023
1023
  */
1024
1024
  sendDataChannelMessage(dataChannelMsg: AliRtcDataChannelMsg): void;
1025
+ /**
1026
+ * @brief 不依赖入会,直接订阅远程流
1027
+ * @param config 订阅配置对象
1028
+ * @returns RemoteStreamHandler 远端流处理器实例
1029
+ */
1030
+ subscribeRemoteStream(config: SubscribeRemoteStreamConfig): RemoteStreamHandler;
1025
1031
  }
1026
1032
 
1027
1033
  declare interface AliRtcEngineConfig {
1028
1034
  env?: AliRtcEnv;
1035
+ globalEnv?: 'DEFAULT' | 'SEA';
1029
1036
  webTrack?: boolean | AliRtcWebTrackConfig;
1030
1037
  maxSignalingReconnectDuration?: number;
1031
1038
  parameter?: Parameter;
@@ -1918,6 +1925,11 @@ export declare class AliRtcLocalStreamInfo extends default_2<AliRtcLocalStreamLi
1918
1925
  * @param publishStream
1919
1926
  */
1920
1927
  cloneVideoProfile(publishStream: LocalStream): Promise<void>;
1928
+ /**
1929
+ * 复制音频 profile 到指定 LocalStream
1930
+ * @param publishStream
1931
+ */
1932
+ cloneAudioProfile(publishStream: LocalStream): Promise<void>;
1921
1933
  addPlugin(plugin: AliRtcPlugin): void;
1922
1934
  removePlugin(plugin: AliRtcPlugin): boolean;
1923
1935
  }
@@ -1947,7 +1959,7 @@ export declare enum AliRtcLogLevel {
1947
1959
  /**
1948
1960
  * @brief 网络质量类型
1949
1961
  */
1950
- declare enum AliRtcNetworkQuality {
1962
+ export declare enum AliRtcNetworkQuality {
1951
1963
  /** 网络极好 */
1952
1964
  AliRtcNetworkExcellent = 0,
1953
1965
  /** 网络好 */
@@ -3061,14 +3073,18 @@ declare class LogClient {
3061
3073
  protected param?: any;
3062
3074
  protected msgCacheArr: any[];
3063
3075
  protected index: number;
3064
- protected stsOpt?: any;
3065
- protected slsToken?: SLSSTSToken;
3066
- protected ossToken?: OSSSTSToken;
3067
3076
  protected ntpClock: NTPClient;
3068
- constructor();
3077
+ private clientId;
3078
+ private stsData?;
3079
+ private stsExpiration;
3080
+ private updateTaskTimer?;
3081
+ private globalEnv;
3082
+ constructor(globalEnv?: 'DEFAULT' | 'SEA');
3069
3083
  private createTracker;
3084
+ private startSTSUpdateTask;
3085
+ private refreshSTSToken;
3086
+ private requestSTSToken;
3070
3087
  start(info: AliRtcAuthInfo): void;
3071
- updateToken(slsToken: SLSSTSToken, ossToken?: OSSSTSToken): void;
3072
3088
  /**
3073
3089
  * 断开连接
3074
3090
  */
@@ -3141,24 +3157,6 @@ declare class NTPClient {
3141
3157
  now(): number;
3142
3158
  }
3143
3159
 
3144
- declare interface OSSSTSToken {
3145
- access_key_id: string;
3146
- access_key_secret: string;
3147
- security_token: string;
3148
- region_endpoint: string;
3149
- bucket_name: string;
3150
- expiration: number;
3151
- }
3152
-
3153
- declare interface OSSToken {
3154
- access_key_id: string;
3155
- access_key_secret: string;
3156
- security_token: string;
3157
- region_endpoint: string;
3158
- bucket_name: string;
3159
- expiration: number;
3160
- }
3161
-
3162
3160
  declare interface PackageAdaptInfo {
3163
3161
  os_name: string;
3164
3162
  device_name: string;
@@ -3420,6 +3418,87 @@ declare interface RemoteMediaTrackInfo extends MediaTrackInfo {
3420
3418
  subscribeState?: RemoteTrackSubscribeState;
3421
3419
  }
3422
3420
 
3421
+ /**
3422
+ * 远端流订阅失败原因
3423
+ */
3424
+ declare enum RemoteStreamErrorReason {
3425
+ /** 无法获取播放地址 */
3426
+ FETCH_STREAM_URL_FAILED = "FETCH_STREAM_URL_FAILED",
3427
+ /** 目标用户没有可用的流 */
3428
+ NO_STREAM_AVAILABLE = "NO_STREAM_AVAILABLE",
3429
+ /** 无效的播放元素 */
3430
+ INVALID_VIEW_ELEMENT = "INVALID_VIEW_ELEMENT",
3431
+ /** 订阅失败 */
3432
+ SUBSCRIBE_FAILED = "SUBSCRIBE_FAILED"
3433
+ }
3434
+
3435
+ declare class RemoteStreamHandler extends default_2<RemoteStreamHandlerEvents> {
3436
+ private config;
3437
+ private static logName;
3438
+ private get logName();
3439
+ private readonly roomServerUrl;
3440
+ private readonly label;
3441
+ private rtsInstance?;
3442
+ private currentStatus;
3443
+ private latestStreamInfo?;
3444
+ private preferredL1Ip?;
3445
+ private usePreferredL1InRetry;
3446
+ private _remoteStream?;
3447
+ /**
3448
+ * 获取代理后的 remoteStream,调用方法时会打印日志
3449
+ */
3450
+ remoteStream?: RemoteStream;
3451
+ private _prevDownlinkStat?;
3452
+ private networkQualityTimer?;
3453
+ constructor(config: SubscribeRemoteStreamConfig);
3454
+ /**
3455
+ * 更新连接状态,只有当状态发生变化时才触发事件
3456
+ */
3457
+ private updateConnectionStatus;
3458
+ /**
3459
+ * 处理错误,使实例进入不可恢复状态,业务侧应销毁实例
3460
+ */
3461
+ private handleError;
3462
+ private fetchStreamUrlAndPlay;
3463
+ /**
3464
+ * 订阅时支持 prefer media server 超时降级
3465
+ * 优先使用 window.__ali_prefer_media_server(测试用),其次使用 l1ip
3466
+ * 如果存在 prefer media server,则设置 3 秒超时,超时后降级到 DNS 解析的 L1 节点
3467
+ */
3468
+ private subscribeWithPreferredL1Fallback;
3469
+ /**
3470
+ * 打印 candidate 协议类型
3471
+ */
3472
+ private logCandidateProtocol;
3473
+ /**
3474
+ * 创建 RemoteStream 的代理,用于拦截方法调用并打印日志
3475
+ */
3476
+ private createRemoteStreamProxy;
3477
+ /**
3478
+ * 启动网络质量检测定时器
3479
+ */
3480
+ private startNetworkQualityTimer;
3481
+ /**
3482
+ * 停止网络质量检测定时器
3483
+ */
3484
+ private stopNetworkQualityTimer;
3485
+ /**
3486
+ * 获取下行网络质量
3487
+ */
3488
+ private getNetworkQuality;
3489
+ dispose(): void;
3490
+ }
3491
+
3492
+ declare interface RemoteStreamHandlerEvents {
3493
+ connectionStatusChange: (status: AliRtcConnectionStatus) => void;
3494
+ networkQuality: (data: {
3495
+ rtt: number;
3496
+ loss: number;
3497
+ quality: AliRtcNetworkQuality;
3498
+ }) => void;
3499
+ error: (reason: RemoteStreamErrorReason, detail: string) => void;
3500
+ }
3501
+
3423
3502
  declare class RemoteStreamInfo extends default_2<StreamListener> {
3424
3503
  /**
3425
3504
  * @ignore
@@ -4078,6 +4157,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
4078
4157
  private dcResolve?;
4079
4158
  private dcReject?;
4080
4159
  private dcConnectingPromise?;
4160
+ private _dcReady;
4081
4161
  private _prevDownlinkStat?;
4082
4162
  private _publishingTracks;
4083
4163
  private parameter;
@@ -4086,6 +4166,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
4086
4166
  private httpPublishUrlMap;
4087
4167
  private httpSubscribeUrlMap;
4088
4168
  private traceIdMap;
4169
+ private subUrlMap;
4089
4170
  constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, parameter: Parameter);
4090
4171
  private createRtsInstance;
4091
4172
  private addRTSListener;
@@ -4136,6 +4217,16 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
4136
4217
  private getSubConfig;
4137
4218
  private handleHTTPConfig;
4138
4219
  private httpSubscribe;
4220
+ /**
4221
+ * 订阅时支持 preferredSubL1Ip 超时降级
4222
+ * 如果存在 preferredSubL1Ip,则设置 3 秒超时,超时后清除 preferredSubL1Ip,降级到 DNS 解析的 L1 节点
4223
+ */
4224
+ private subscribeWithPreferredL1Fallback;
4225
+ /**
4226
+ * 推流时支持 preferredPubL1Ip 超时降级
4227
+ * 如果存在 preferredPubL1Ip,则设置 3 秒超时,超时后清除 preferredPubL1Ip,降级到 DNS 解析的 L1 节点
4228
+ */
4229
+ private publishWithPreferredL1Fallback;
4139
4230
  private subscribeAdd;
4140
4231
  subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<ISubDeleteResult | undefined>;
4141
4232
  subscribeAddDataChannel(streamUrl: string): Promise<any>;
@@ -4154,6 +4245,10 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
4154
4245
  msid?: string;
4155
4246
  }): any;
4156
4247
  getPCStats(): Promise<any>;
4248
+ /**
4249
+ * 获取当前使用的 candidate 协议类型(udp/tcp)
4250
+ */
4251
+ private logCandidateProtocol;
4157
4252
  sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
4158
4253
  }
4159
4254
 
@@ -4194,7 +4289,6 @@ declare class SignalingManager extends default_2<RoomServerListener> {
4194
4289
  protected clientRole: AliRtcSdkClientRole;
4195
4290
  protected env: AliRtcEnv;
4196
4291
  protected maxSignalingReconnectDuration?: number;
4197
- stsManager: StsManager;
4198
4292
  private slsReporter;
4199
4293
  constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
4200
4294
  reset(): void;
@@ -4321,10 +4415,7 @@ declare class SLSReporter {
4321
4415
  protected logClient: LogClient;
4322
4416
  protected authInfo?: AliRtcAuthInfo;
4323
4417
  private ntpClock;
4324
- private static staticClient;
4325
- private static getLogClient;
4326
- static reportOSSUpload(sessionId: string, date: string, responseCode?: number): void;
4327
- constructor(engine: WrappedAliRtcEngine);
4418
+ constructor(engine: WrappedAliRtcEngine, globalEnv?: 'DEFAULT' | 'SEA');
4328
4419
  private customFields;
4329
4420
  /**
4330
4421
  * 设置通用字段
@@ -4344,7 +4435,6 @@ declare class SLSReporter {
4344
4435
  * @param authInfo
4345
4436
  */
4346
4437
  start(info: AliRtcAuthInfo): void;
4347
- updateToken(token: SLSSTSToken, ossToken?: OSSSTSToken): void;
4348
4438
  /**
4349
4439
  * 断开连接
4350
4440
  */
@@ -4498,28 +4588,6 @@ declare class SLSReporter {
4498
4588
  protected data2String(data: any): string;
4499
4589
  }
4500
4590
 
4501
- declare interface SLSSTSToken {
4502
- access_key_id: string;
4503
- access_key_secret: string;
4504
- expiration: number;
4505
- log_store_debug: string;
4506
- log_store_stats: string;
4507
- project: string;
4508
- region_endpoint: string;
4509
- security_token: string;
4510
- }
4511
-
4512
- declare interface SLSToken {
4513
- access_key_id: string;
4514
- access_key_secret: string;
4515
- security_token: string;
4516
- region_endpoint: string;
4517
- project: string;
4518
- log_store_stats: string;
4519
- log_store_debug: string;
4520
- expiration: number;
4521
- }
4522
-
4523
4591
  /**
4524
4592
  * Websocket类
4525
4593
  */
@@ -4628,25 +4696,6 @@ declare interface StreamOptions {
4628
4696
  data?: boolean;
4629
4697
  }
4630
4698
 
4631
- declare class StsManager extends default_2<StsManagerListener> {
4632
- static logName: string;
4633
- private env;
4634
- private authInfo?;
4635
- private timer?;
4636
- private slsReporter;
4637
- private expiration;
4638
- private skipTime;
4639
- constructor(slsReporter: SLSReporter, env: AliRtcEnv);
4640
- refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
4641
- private requestToken;
4642
- startSTSUpdate(authInfo: AliRtcAuthInfo): void;
4643
- clear(): void;
4644
- }
4645
-
4646
- declare interface StsManagerListener {
4647
- onTokenUpdate: (ossToken: OSSToken, slsToken: SLSToken) => void;
4648
- }
4649
-
4650
4699
  declare interface SubConfig {
4651
4700
  isAudioSubscribing: boolean;
4652
4701
  isVideoSubscribing: boolean;
@@ -4671,6 +4720,18 @@ declare enum SubscribeReason {
4671
4720
  Reconnect = "reconnect"
4672
4721
  }
4673
4722
 
4723
+ declare interface SubscribeRemoteStreamConfig {
4724
+ env?: AliRtcEnv;
4725
+ appId: string;
4726
+ currentUserId: string;
4727
+ targetChannelId: string;
4728
+ targetUserId: string;
4729
+ token: string;
4730
+ nonce?: string;
4731
+ timestamp: number;
4732
+ view?: string | HTMLVideoElement;
4733
+ }
4734
+
4674
4735
  declare interface TimeRecorder {
4675
4736
  start: number;
4676
4737
  [key: string]: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliyun-rtc-sdk",
3
- "version": "7.2.2",
3
+ "version": "7.2.4",
4
4
  "type": "module",
5
5
  "description": "rtc web sdk of aliyun",
6
6
  "main": "dist/aliyun-rtc-sdk.umd.js",
@@ -10,7 +10,7 @@
10
10
  "@aliyun-sls/web-sts-plugin": "^0.3.5",
11
11
  "@aliyun-sls/web-track-browser": "^0.3.5",
12
12
  "aliyun-queen-engine": "^6.3.14",
13
- "aliyun-rts-sdk": "2.13.8",
13
+ "aliyun-rts-sdk": "2.14.6",
14
14
  "crypto-js": "^4.1.1",
15
15
  "dateformat": "^5.0.3",
16
16
  "eventemitter3": "^5.0.1",