aliyun-rtc-sdk 7.2.2 → 7.2.3

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,46 @@ 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 readonly roomServerUrl;
3439
+ private readonly label;
3440
+ private rtsInstance?;
3441
+ private currentStatus;
3442
+ private latestStreamInfo?;
3443
+ constructor(config: SubscribeRemoteStreamConfig);
3444
+ /**
3445
+ * 更新连接状态,只有当状态发生变化时才触发事件
3446
+ */
3447
+ private updateConnectionStatus;
3448
+ /**
3449
+ * 处理错误,使实例进入不可恢复状态,业务侧应销毁实例
3450
+ */
3451
+ private handleError;
3452
+ private fetchStreamUrlAndPlay;
3453
+ dispose(): void;
3454
+ }
3455
+
3456
+ declare interface RemoteStreamHandlerEvents {
3457
+ connectionStatusChange: (status: AliRtcConnectionStatus) => void;
3458
+ error: (reason: RemoteStreamErrorReason, detail: string) => void;
3459
+ }
3460
+
3423
3461
  declare class RemoteStreamInfo extends default_2<StreamListener> {
3424
3462
  /**
3425
3463
  * @ignore
@@ -4136,6 +4174,16 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
4136
4174
  private getSubConfig;
4137
4175
  private handleHTTPConfig;
4138
4176
  private httpSubscribe;
4177
+ /**
4178
+ * 订阅时支持 preferredSubL1Ip 超时降级
4179
+ * 如果存在 preferredSubL1Ip,则设置 3 秒超时,超时后清除 preferredSubL1Ip,降级到 DNS 解析的 L1 节点
4180
+ */
4181
+ private subscribeWithPreferredL1Fallback;
4182
+ /**
4183
+ * 推流时支持 preferredPubL1Ip 超时降级
4184
+ * 如果存在 preferredPubL1Ip,则设置 3 秒超时,超时后清除 preferredPubL1Ip,降级到 DNS 解析的 L1 节点
4185
+ */
4186
+ private publishWithPreferredL1Fallback;
4139
4187
  private subscribeAdd;
4140
4188
  subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<ISubDeleteResult | undefined>;
4141
4189
  subscribeAddDataChannel(streamUrl: string): Promise<any>;
@@ -4154,6 +4202,10 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
4154
4202
  msid?: string;
4155
4203
  }): any;
4156
4204
  getPCStats(): Promise<any>;
4205
+ /**
4206
+ * 获取当前使用的 candidate 协议类型(udp/tcp)
4207
+ */
4208
+ private logCandidateProtocol;
4157
4209
  sendSEI(streamUrl: string, data: ArrayBuffer, repeatCount: number, payloadType: number): Promise<void>;
4158
4210
  }
4159
4211
 
@@ -4194,7 +4246,6 @@ declare class SignalingManager extends default_2<RoomServerListener> {
4194
4246
  protected clientRole: AliRtcSdkClientRole;
4195
4247
  protected env: AliRtcEnv;
4196
4248
  protected maxSignalingReconnectDuration?: number;
4197
- stsManager: StsManager;
4198
4249
  private slsReporter;
4199
4250
  constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
4200
4251
  reset(): void;
@@ -4321,10 +4372,7 @@ declare class SLSReporter {
4321
4372
  protected logClient: LogClient;
4322
4373
  protected authInfo?: AliRtcAuthInfo;
4323
4374
  private ntpClock;
4324
- private static staticClient;
4325
- private static getLogClient;
4326
- static reportOSSUpload(sessionId: string, date: string, responseCode?: number): void;
4327
- constructor(engine: WrappedAliRtcEngine);
4375
+ constructor(engine: WrappedAliRtcEngine, globalEnv?: 'DEFAULT' | 'SEA');
4328
4376
  private customFields;
4329
4377
  /**
4330
4378
  * 设置通用字段
@@ -4344,7 +4392,6 @@ declare class SLSReporter {
4344
4392
  * @param authInfo
4345
4393
  */
4346
4394
  start(info: AliRtcAuthInfo): void;
4347
- updateToken(token: SLSSTSToken, ossToken?: OSSSTSToken): void;
4348
4395
  /**
4349
4396
  * 断开连接
4350
4397
  */
@@ -4498,28 +4545,6 @@ declare class SLSReporter {
4498
4545
  protected data2String(data: any): string;
4499
4546
  }
4500
4547
 
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
4548
  /**
4524
4549
  * Websocket类
4525
4550
  */
@@ -4628,25 +4653,6 @@ declare interface StreamOptions {
4628
4653
  data?: boolean;
4629
4654
  }
4630
4655
 
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
4656
  declare interface SubConfig {
4651
4657
  isAudioSubscribing: boolean;
4652
4658
  isVideoSubscribing: boolean;
@@ -4671,6 +4677,18 @@ declare enum SubscribeReason {
4671
4677
  Reconnect = "reconnect"
4672
4678
  }
4673
4679
 
4680
+ declare interface SubscribeRemoteStreamConfig {
4681
+ env?: AliRtcEnv;
4682
+ appId: string;
4683
+ currentUserId: string;
4684
+ targetChannelId: string;
4685
+ targetUserId: string;
4686
+ token: string;
4687
+ nonce?: string;
4688
+ timestamp: number;
4689
+ view?: string | HTMLVideoElement;
4690
+ }
4691
+
4674
4692
  declare interface TimeRecorder {
4675
4693
  start: number;
4676
4694
  [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.3",
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.4",
14
14
  "crypto-js": "^4.1.1",
15
15
  "dateformat": "^5.0.3",
16
16
  "eventemitter3": "^5.0.1",