aliyun-rtc-sdk 6.13.7 → 6.14.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.
@@ -634,6 +634,11 @@ declare class AliRtcEngine_2 extends default_2<AliRtcEngineEventListener> {
634
634
  * @param {IAudioConstraints} audioConstraints 音频采集参数
635
635
  */
636
636
  startAudioCapture(audioConstraints?: IAudioConstraints): Promise<void>;
637
+ /**
638
+ * @brief 设置音频采集参数
639
+ * @param constraints 音频采集参数
640
+ */
641
+ setAudioConstraints(constraints: IAudioConstraints): Promise<void>;
637
642
  /**
638
643
  * 关闭音频采集
639
644
  * @note 调用此接口后,入会后、离会再入会,采集设备保持关闭状态
@@ -2170,7 +2175,7 @@ declare class BizControl extends default_2<BizControlListener> {
2170
2175
  * @ignore
2171
2176
  */
2172
2177
  static logName: string;
2173
- protected self: LocalUser | undefined;
2178
+ protected self: LocalUser;
2174
2179
  protected userMap: RemoteUserMap;
2175
2180
  private usersViewMap;
2176
2181
  rtsManager: RtsManager;
@@ -2192,12 +2197,11 @@ declare class BizControl extends default_2<BizControlListener> {
2192
2197
  private defaultStreamType;
2193
2198
  private audioMuted;
2194
2199
  private playoutVolume;
2200
+ private refreshUrlTimer?;
2195
2201
  private audioVolumeIndicationInterval;
2196
2202
  private indicationTimer;
2197
2203
  private parameter;
2198
2204
  constructor(config: BizControlConfig);
2199
- private publishRetryOptionsHook;
2200
- private subscribeRetryOptionsHook;
2201
2205
  private addSignalingManagerListener;
2202
2206
  isAutoSubAudio(): boolean;
2203
2207
  setAutoSubAudio(value: boolean): void;
@@ -2234,10 +2238,15 @@ declare class BizControl extends default_2<BizControlListener> {
2234
2238
  * @returns {void}
2235
2239
  */
2236
2240
  onRemotePublishStateChange(publishInfo: PublishUser): void;
2241
+ /** 定期更新所有人的推拉流地址,便于重连
2242
+ * @param pushStreamUrl 已有的推流地址,根据地址中的过期时间来设置定时器
2243
+ * @private
2244
+ */
2245
+ private setTimeoutToUpdateAllStreamUrls;
2237
2246
  /**
2238
2247
  * 登陆成功后初始化用户管理,创建自己
2239
2248
  * @param {AliRtcAuthInfo} authInfo
2240
- * @param {string} pushStreamUrl
2249
+ * @param {JoinResult} data
2241
2250
  * @returns {Promise<void>}
2242
2251
  */
2243
2252
  init(authInfo: AliRtcAuthInfo, data: JoinResult): void;
@@ -2320,7 +2329,7 @@ declare class BizControl extends default_2<BizControlListener> {
2320
2329
  setAudioRedEnabled(enable: boolean): void;
2321
2330
  setParameter(parameter: string): void;
2322
2331
  getParameter(): string;
2323
- sendDataChannelMessage(message: AliRtcDataChannelMsg): Promise<void> | undefined;
2332
+ sendDataChannelMessage(message: AliRtcDataChannelMsg): Promise<void>;
2324
2333
  }
2325
2334
 
2326
2335
  declare interface BizControlConfig {
@@ -2386,6 +2395,15 @@ declare enum CodecType {
2386
2395
  UNKNOWN = ""
2387
2396
  }
2388
2397
 
2398
+ /**
2399
+ * websocket链接状态
2400
+ */
2401
+ declare enum CONNECTSTATUS {
2402
+ DISCONNECTED = 0,
2403
+ CONNECTING = 1,
2404
+ CONNECTED = 2
2405
+ }
2406
+
2389
2407
  declare interface DeviceStatus {
2390
2408
  micOpen: boolean;
2391
2409
  micInterrupted: boolean;
@@ -2411,17 +2429,41 @@ declare enum DisplayType {
2411
2429
  WHEN_NO_VIDEO = 2
2412
2430
  }
2413
2431
 
2414
- declare interface ISignalingInterface {
2415
- join(authInfo: AliRtcAuthInfo, userName: string, connectRetryCount?: number): Promise<JoinResult>;
2416
- leave(): Promise<SignalingResult>;
2417
- publish(publishInfo: PublishInfo): Promise<SignalingResult>;
2418
- roleUpdate(role: AliRtcSdkClientRole): Promise<SignalingResult>;
2419
- setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
2420
- refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
2421
- refreshAuthInfo(authInfo: AliRtcAuthInfo): Promise<void>;
2422
- reportStatus(status: string): Promise<void>;
2423
- on(event: string, listener: Function): void;
2424
- reset(): void;
2432
+ declare interface IResponse {
2433
+ version: number;
2434
+ code: number;
2435
+ msgtype: MessageType;
2436
+ tid: string;
2437
+ isproxy?: boolean;
2438
+ }
2439
+
2440
+ declare interface ISendPackage {
2441
+ version: number;
2442
+ msgtype: MessageType;
2443
+ tid: string;
2444
+ header: {
2445
+ appid: string;
2446
+ channelid: string;
2447
+ sessionid: string;
2448
+ userid: string;
2449
+ displayName?: string;
2450
+ clientversion?: string;
2451
+ platform?: string;
2452
+ };
2453
+ data: {
2454
+ seq: number;
2455
+ l1ip?: string;
2456
+ status?: string;
2457
+ clientrole?: string;
2458
+ configure?: {
2459
+ clientrole?: AliRtcSdkClientRole;
2460
+ channelprofile: AliRtcSdkChannelProfile;
2461
+ };
2462
+ auth?: SendPackageAuthInfo;
2463
+ sessionid?: string;
2464
+ pushstreamurl?: string;
2465
+ users?: any[];
2466
+ };
2425
2467
  }
2426
2468
 
2427
2469
  /**
@@ -2585,7 +2627,7 @@ declare class LocalUser extends User {
2585
2627
  * @ignore
2586
2628
  */
2587
2629
  static logName: string;
2588
- protected url: string;
2630
+ private _url;
2589
2631
  private joinTime;
2590
2632
  private _isPublishing;
2591
2633
  private publishPromise;
@@ -2610,6 +2652,8 @@ declare class LocalUser extends User {
2610
2652
  private dataPubState;
2611
2653
  private parameter;
2612
2654
  constructor(config: LocalUserConfig);
2655
+ get url(): string;
2656
+ set url(value: string);
2613
2657
  get joined(): boolean;
2614
2658
  get isPublishing(): boolean;
2615
2659
  get publishStreams(): PublishStreamInfo;
@@ -2644,6 +2688,7 @@ declare class LocalUser extends User {
2644
2688
  muteLocalMic(mute: boolean): void;
2645
2689
  muteLocalScreen(mute: boolean): void;
2646
2690
  setMicrophoneDeviceId(deviceId: string): void;
2691
+ setMicrophoneConstraints(constraints: MediaTrackConstraints): void;
2647
2692
  updatePubId(): void;
2648
2693
  clearPublishState(): void;
2649
2694
  leave(): Promise<void>;
@@ -2856,6 +2901,23 @@ declare interface MediaTrackInfo {
2856
2901
  type?: CmdType;
2857
2902
  }
2858
2903
 
2904
+ declare enum MessageType {
2905
+ KEEPALIVE = "keepalive",
2906
+ JOINCHANNEL = "joinchannel",
2907
+ NOTIFYJOIN = "notifyjoin",
2908
+ NOTIFYSTATUS = "notifystatus",
2909
+ STATUSREPORT = "statusreport",
2910
+ LEAVECHANNEL = "leavechannel",
2911
+ NOTIFYLEAVE = "notifyleave",
2912
+ NOTIFYPUBLISH = "notifypublish",
2913
+ BYE = "bye",
2914
+ RECONNECT = "reconnect",
2915
+ PUBLISH = "publish",
2916
+ REFRESHURL = "refreshurl",
2917
+ UNSUBSCRIBE = "unsubscribe",
2918
+ ROLEUPDATE = "roleupdate"
2919
+ }
2920
+
2859
2921
  declare enum MPU_TASK_TRANSACTION_TYPE {
2860
2922
  MPU_TASK_TRANSACTION_START = 0,
2861
2923
  MPU_TASK_TRANSACTION_UPDATE = 1,
@@ -2892,6 +2954,53 @@ declare interface OSSToken {
2892
2954
  expiration: number;
2893
2955
  }
2894
2956
 
2957
+ declare class PackageCreater {
2958
+ protected authInfo: AliRtcAuthInfo;
2959
+ protected userName: string;
2960
+ protected seqIndex: number;
2961
+ constructor(authInfo: AliRtcAuthInfo, userName: string);
2962
+ get roleAuth(): SendPackageAuthInfo | undefined;
2963
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
2964
+ getSeqIndex(): number;
2965
+ /**
2966
+ * 创建一个心跳包
2967
+ * @returns
2968
+ */
2969
+ createKeepAlivePackage(): ISendPackage;
2970
+ /**
2971
+ * 创建一个用于发送入会消息的Package
2972
+ * @returns
2973
+ */
2974
+ createJoinPackage(): ISendPackage;
2975
+ /**
2976
+ * 创建一个用于发送离会消息的Package
2977
+ * @returns
2978
+ */
2979
+ crateLeavePackage(): ISendPackage;
2980
+ createStatusPackage(status: string): ISendPackage;
2981
+ /**
2982
+ * 创建一个用于发送推流消息的Package
2983
+ * @returns
2984
+ */
2985
+ createPublishPackage(): ISendPackage;
2986
+ createRoleUpdatePackage(): ISendPackage;
2987
+ createReconnectPackage(data?: ReconnectData): ISendPackage;
2988
+ createRefreshUrlPackage(): ISendPackage;
2989
+ /**
2990
+ * 创建一个Response包
2991
+ * @param {string} tid Notify消息的tid
2992
+ * @param {MessageType} msgType 消息类型
2993
+ * @returns {IResponse}
2994
+ */
2995
+ createResponsePackage(tid: string, msgType: MessageType): IResponse;
2996
+ /**
2997
+ *
2998
+ * @param messageType
2999
+ * @returns
3000
+ */
3001
+ protected createBaseSendPackage(messageType: MessageType): ISendPackage;
3002
+ }
3003
+
2895
3004
  declare type Parameter = {
2896
3005
  [key: string]: any;
2897
3006
  };
@@ -2988,6 +3097,14 @@ declare interface PublishUser {
2988
3097
  userid: string;
2989
3098
  }
2990
3099
 
3100
+ declare interface ReconnectData {
3101
+ role?: RoleForReconnectData;
3102
+ auth?: SendPackageAuthInfo;
3103
+ publish?: {
3104
+ users: [PublishInfo];
3105
+ };
3106
+ }
3107
+
2991
3108
  declare interface RefreshInfo {
2992
3109
  pushstreamurl?: string;
2993
3110
  users?: RefreshUser[];
@@ -3167,12 +3284,14 @@ declare class RemoteUser extends User {
3167
3284
  private dc;
3168
3285
  private dcMsgWaitingPieces;
3169
3286
  streamInfo: RemoteStreamInfo;
3170
- streamUrl: string;
3287
+ private _streamUrl;
3171
3288
  private parameter;
3172
3289
  private monitorTimerId?;
3173
3290
  private monitorDataCache;
3174
3291
  private trackTraceIdMap;
3175
3292
  constructor(config: RemoteUserConfig);
3293
+ get streamUrl(): string;
3294
+ set streamUrl(value: string);
3176
3295
  isWantSubAudio(): boolean;
3177
3296
  setWantSubAudio(value: boolean): void;
3178
3297
  isWantSubVideo(): boolean;
@@ -3361,6 +3480,11 @@ declare interface RemoteUserViewMap {
3361
3480
  screenViews: HTMLVideoElement[];
3362
3481
  }
3363
3482
 
3483
+ declare interface RoleForReconnectData {
3484
+ channelprofile?: AliRtcSdkChannelProfile;
3485
+ clientrole?: AliRtcSdkClientRole;
3486
+ }
3487
+
3364
3488
  /**
3365
3489
  * RoomServerMessageCenter支持的事件
3366
3490
  */
@@ -3386,6 +3510,247 @@ declare interface RoomServerListener {
3386
3510
  onError: (err: AliRtcError) => void;
3387
3511
  }
3388
3512
 
3513
+ /**
3514
+ * RoomServer消息中心
3515
+ * 负责发送和接收信令数据,消息重发、回复Response
3516
+ */
3517
+ declare class RoomServerMessageCenter extends default_2<RoomServerListener> {
3518
+ static logName: string;
3519
+ protected authInfo: AliRtcAuthInfo;
3520
+ protected userName: string;
3521
+ protected channelProfile: AliRtcSdkChannelProfile;
3522
+ protected clientRole: AliRtcSdkClientRole;
3523
+ private slsReporter;
3524
+ protected wsClient: Socket;
3525
+ protected packageCreater: PackageCreater;
3526
+ protected keepAliveTimer: number;
3527
+ protected packageCache: Map<string, ISendPackage>;
3528
+ protected isFirstConnect: boolean;
3529
+ protected aliveChecker: number;
3530
+ protected reconnectData?: ReconnectData;
3531
+ constructor(authInfo: AliRtcAuthInfo, userName: string, channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, maxConnectRetryCount?: number);
3532
+ get retryCount(): number;
3533
+ /**
3534
+ * 开始连接信令
3535
+ * @param roomserverurl
3536
+ */
3537
+ start(roomserverurl: string): void;
3538
+ /**
3539
+ * 开始心跳计时器,并自动发送心跳包
3540
+ */
3541
+ startKeepAlive(): void;
3542
+ /**
3543
+ * 停止心跳计时器
3544
+ */
3545
+ stopKeepAlive(): void;
3546
+ /**
3547
+ * 发送入会、重连前所缓存信息
3548
+ */
3549
+ sendPkgCache(): void;
3550
+ /**
3551
+ * 发送离开房间
3552
+ */
3553
+ leave(): void;
3554
+ /**
3555
+ * 透明通道消息上报
3556
+ * @param status
3557
+ */
3558
+ reportStatus(status: string): void;
3559
+ /**
3560
+ * 发送推流消息
3561
+ */
3562
+ publish(_pubInfo: PublishInfo): void;
3563
+ /**
3564
+ * 更新角色
3565
+ */
3566
+ roleUpdate(role: string): void;
3567
+ /**
3568
+ * 更新推拉流地址
3569
+ * @param {RefreshInfo} info
3570
+ */
3571
+ refreshUrl(info: RefreshInfo): void;
3572
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
3573
+ /**
3574
+ * 关闭websocket连接,并销毁
3575
+ */
3576
+ close(): void;
3577
+ /**
3578
+ * 通过此方法发送数据到业务信令
3579
+ * 此方法会自动保存发送的package,并做重发.
3580
+ * response包不要通过此方法发送
3581
+ * @param pkg
3582
+ */
3583
+ protected sendPackage(pkg: ISendPackage): void;
3584
+ /**
3585
+ * 更新重连 payload
3586
+ * @param {ReconnectData} reconnectData
3587
+ */
3588
+ updateReconnectData(reconnectData?: ReconnectData): void;
3589
+ /**
3590
+ * 收到websocket连接成功的消息
3591
+ * ws连接建立成功后立刻发送join消息
3592
+ */
3593
+ protected onOpen(): void;
3594
+ /**
3595
+ * 收到业务信令消息
3596
+ * @param event
3597
+ */
3598
+ protected onMessage(event: MessageEvent): void;
3599
+ /**
3600
+ * 收到错误消息
3601
+ * @param event
3602
+ */
3603
+ protected onError(event: Event): void;
3604
+ /**
3605
+ * 连接失败
3606
+ */
3607
+ protected onConnectFail(): void;
3608
+ /**
3609
+ * 鉴权失败
3610
+ */
3611
+ protected onAuthInvalid(): void;
3612
+ /**
3613
+ * 网络异常
3614
+ */
3615
+ protected onNetworkError(): void;
3616
+ /**
3617
+ * 收到websocket断开消息
3618
+ * @param event
3619
+ */
3620
+ protected onClose(event: CloseEvent): void;
3621
+ protected onKeepAliveRsp(): void;
3622
+ protected onReconnectStart(): void;
3623
+ protected onReconnectFail(): void;
3624
+ /**
3625
+ * 处理 Keepalive 心跳,加速判断网络异常
3626
+ */
3627
+ protected checkAlive(): void;
3628
+ /**
3629
+ * 处理收到的业务信令
3630
+ * @param response
3631
+ */
3632
+ protected onRecvMessage(response: any): void;
3633
+ /**
3634
+ * 收到入会消息的response
3635
+ * @param response
3636
+ */
3637
+ protected onJoinResult(response: any): void;
3638
+ /**
3639
+ * 收到离开消息的response
3640
+ * @param response
3641
+ */
3642
+ protected onLeaveResult(response: any): void;
3643
+ /**
3644
+ * 收到publish消息的response
3645
+ * @param response
3646
+ */
3647
+ protected onPublishResult(response: any): void;
3648
+ /**
3649
+ * 收到roleUpdate消息的response
3650
+ * @param response
3651
+ */
3652
+ protected onRoleUpdateResult(response: any): void;
3653
+ /**
3654
+ * 收到 refreshurl 消息的response
3655
+ * @param response
3656
+ */
3657
+ protected onRefreshUrlResult(response: any): void;
3658
+ /**
3659
+ * 收到重联消息的response
3660
+ * @param response
3661
+ */
3662
+ protected onReconnectResult(response: any): void;
3663
+ /**
3664
+ * 收到业务信令下发的消息
3665
+ * @param response
3666
+ */
3667
+ protected onNotifyJoin(response: any): void;
3668
+ /**
3669
+ * 收到业务信令下发的透明通道消息
3670
+ * @param response
3671
+ */
3672
+ protected onNotifyStatus(response: any): void;
3673
+ /**
3674
+ * 收到远端用户离开的通知
3675
+ * @param response
3676
+ */
3677
+ protected onNotifyLeave(response: any): void;
3678
+ /**
3679
+ * 收到远端用户推流的通知
3680
+ * @param response
3681
+ */
3682
+ protected onNotifyPublish(response: any): void;
3683
+ /**
3684
+ * 收到statusreport的response
3685
+ * @param response
3686
+ */
3687
+ protected onStatusReport(response: any): void;
3688
+ /**
3689
+ * 收到被踢出频道的消息
3690
+ * @param {any} response
3691
+ */
3692
+ protected onBye(response: any): void;
3693
+ }
3694
+
3695
+ declare class RoomServerSignaling extends default_2<RoomServerListener> {
3696
+ /**
3697
+ * @ignore
3698
+ */
3699
+ static logName: string;
3700
+ protected messageCenter?: RoomServerMessageCenter;
3701
+ protected authInfo?: AliRtcAuthInfo;
3702
+ protected userName?: string;
3703
+ protected channelProfile: AliRtcSdkChannelProfile;
3704
+ protected clientRole: AliRtcSdkClientRole;
3705
+ private slsReporter;
3706
+ protected reconnectData?: ReconnectData;
3707
+ protected roomServerUri: string;
3708
+ constructor(channelProfile: AliRtcSdkChannelProfile, clientRole: AliRtcSdkClientRole, slsReporter: SLSReporter, env?: AliRtcEnv);
3709
+ /**
3710
+ * 更新重连数据
3711
+ * @param {ReconnectData} reconnectData
3712
+ */
3713
+ private updateReconnectData;
3714
+ /**
3715
+ * 释放资源
3716
+ */
3717
+ reset(): void;
3718
+ /**
3719
+ * 加入频道
3720
+ * @param {AliRtcAuthInfo} authInfo
3721
+ * @returns
3722
+ */
3723
+ join(authInfo: AliRtcAuthInfo, userName: string, maxConnectRetryCount?: number): Promise<JoinResult>;
3724
+ /**
3725
+ * 离开频道
3726
+ * @returns
3727
+ */
3728
+ leave(): Promise<SignalingResult>;
3729
+ /**
3730
+ * 开始推流
3731
+ * @param pubInfo
3732
+ * @returns
3733
+ */
3734
+ publish(pubInfo: PublishInfo): Promise<SignalingResult>;
3735
+ roleUpdate(role: AliRtcSdkClientRole): Promise<SignalingResult>;
3736
+ setChannelProfile(channelProfile: AliRtcSdkChannelProfile): void;
3737
+ /**
3738
+ * 更新推流地址
3739
+ */
3740
+ refreshUrl(info: RefreshInfo): Promise<RefreshUrlResult>;
3741
+ /**
3742
+ * 上报设备状态
3743
+ * @param status
3744
+ */
3745
+ reportStatus(status: string): Promise<void>;
3746
+ protected handleSignalError(code: number, description: string, errorCode?: AliRtcErrorCode): AliRtcError;
3747
+ refreshAuthInfo(authInfo: AliRtcAuthInfo): Promise<void>;
3748
+ /**
3749
+ * 初始化MessageCenter,增加事件监听
3750
+ */
3751
+ protected initMessageCenter(): void;
3752
+ }
3753
+
3389
3754
  declare class RtsManager extends default_2<RtsManagerEventListener> {
3390
3755
  /**
3391
3756
  * @ignore
@@ -3402,16 +3767,19 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3402
3767
  private connected;
3403
3768
  private _pcTraceId;
3404
3769
  private _localJoinTime;
3405
- private publishRetryHook?;
3406
- private subscribeRetryOptionsHook?;
3407
3770
  private connectionResolve?;
3408
3771
  private connectingPromise?;
3409
3772
  private dcResolve?;
3410
3773
  private dcConnectingPromise?;
3411
3774
  private _publishingTracks;
3412
3775
  private parameter;
3413
- constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, publishRetryHook: () => void, subscribeRetryOptionsHook: () => RemoteSubscribeOptions | undefined, parameter: Parameter);
3776
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, parameter: Parameter);
3414
3777
  private addRTSListener;
3778
+ /**
3779
+ * 更新鉴权信息,传入一个新的带鉴权的 URL,RTS 会去除鉴权信息做更新
3780
+ * @param newUrlWithAuth
3781
+ */
3782
+ updateAuth(newUrlWithAuth: string): void;
3415
3783
  get pcTraceId(): string;
3416
3784
  set localJoinTime(time: number);
3417
3785
  setEncodedInsertableStreams(enable: boolean): void;
@@ -3443,7 +3811,7 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3443
3811
  private getSubConfig;
3444
3812
  private httpSubscribe;
3445
3813
  private subscribeAdd;
3446
- subscibeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<{
3814
+ subscribeDelete(subscribeOptions: RemoteSubscribeOptions): Promise<{
3447
3815
  url: string;
3448
3816
  stream: any;
3449
3817
  } | undefined>;
@@ -3475,12 +3843,19 @@ declare enum RtsPeerConnectionType {
3475
3843
  SUBSCRIBE = "subscribe"
3476
3844
  }
3477
3845
 
3846
+ declare interface SendPackageAuthInfo {
3847
+ timestamp: number;
3848
+ nonce?: string;
3849
+ token: string;
3850
+ tokenrole: AliRtcSdkTokenRole;
3851
+ }
3852
+
3478
3853
  declare class SignalingManager extends default_2<RoomServerListener> {
3479
3854
  /**
3480
3855
  * @ignore
3481
3856
  */
3482
3857
  static logName: string;
3483
- protected signaling?: ISignalingInterface;
3858
+ protected signaling?: RoomServerSignaling;
3484
3859
  protected authInfo?: AliRtcAuthInfo;
3485
3860
  protected userName?: string;
3486
3861
  protected channelProfile: AliRtcSdkChannelProfile;
@@ -3560,7 +3935,7 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3560
3935
  * 收到远端用户推流状态变化消息
3561
3936
  * @param {PublishInfo[]} users
3562
3937
  */
3563
- protected onNotifyPublish(users: PublishInfo[]): void;
3938
+ protected onNotifyPublish(users: PublishUser[]): void;
3564
3939
  /**
3565
3940
  * 收到被踢掉消息
3566
3941
  * @param {string} reason
@@ -3579,9 +3954,8 @@ declare class SignalingManager extends default_2<RoomServerListener> {
3579
3954
  protected onNetworkError(err: AliRtcError): void;
3580
3955
  /**
3581
3956
  * 收到网络异常消息
3582
- * @param {AliRtcError} _err
3583
3957
  */
3584
- protected onAuthInvalid(_err: AliRtcError): void;
3958
+ protected onAuthInvalid(): void;
3585
3959
  protected onReconnectStart(): void;
3586
3960
  /**
3587
3961
  * 收到重连成功消息
@@ -3785,6 +4159,91 @@ declare interface SLSToken {
3785
4159
  expiration: number;
3786
4160
  }
3787
4161
 
4162
+ /**
4163
+ * Websocket类
4164
+ */
4165
+ declare class Socket extends default_2<SocketListener> {
4166
+ /**
4167
+ * @ignore
4168
+ */
4169
+ static logName: string;
4170
+ protected ws?: WebSocket;
4171
+ protected socketStatus: CONNECTSTATUS;
4172
+ protected wsUrl: string;
4173
+ protected lastConnectStartTime: number;
4174
+ protected maxConnectRetryCount: number;
4175
+ connectRetryCount: number;
4176
+ protected gotErr: boolean;
4177
+ protected closedByInvoke: boolean;
4178
+ protected isReconnecting: boolean;
4179
+ protected networkAvailableChecked: boolean;
4180
+ private reconnectTimeoutId;
4181
+ constructor(maxConnectRetryCount?: number);
4182
+ get connectUrl(): string;
4183
+ /**
4184
+ * 返回websocket连接的状态
4185
+ */
4186
+ get connectStatus(): CONNECTSTATUS;
4187
+ /**
4188
+ * 开始连接
4189
+ * @param wsUrl
4190
+ */
4191
+ start(wsUrl: string): void;
4192
+ /**
4193
+ * 发送消息
4194
+ * @param pkg
4195
+ */
4196
+ send(pkg: ISendPackage | IResponse): boolean;
4197
+ /**
4198
+ * 主动断开连接
4199
+ */
4200
+ close(): void;
4201
+ reconnect(): void;
4202
+ /**
4203
+ * 连接成功
4204
+ * @param event
4205
+ */
4206
+ protected onOpen(event: Event): void;
4207
+ /**
4208
+ * 收到消息
4209
+ * @param event
4210
+ */
4211
+ protected onMessage(event: MessageEvent): void;
4212
+ /**
4213
+ * 收到错误
4214
+ * @param event
4215
+ */
4216
+ protected onError(event: Event): void;
4217
+ /**
4218
+ * 连接断开
4219
+ * @param event
4220
+ */
4221
+ protected onClose(event: CloseEvent): Promise<void>;
4222
+ /**
4223
+ * 初始化websocket
4224
+ */
4225
+ protected initWebSocket(): void;
4226
+ /**
4227
+ * 反初始化websocket
4228
+ */
4229
+ protected uninitWebsocket(): void;
4230
+ }
4231
+
4232
+ /**
4233
+ * Socket的支持的事件
4234
+ */
4235
+ declare interface SocketListener {
4236
+ onOpen: (event: Event) => void;
4237
+ onMessage: (event: MessageEvent) => void;
4238
+ onError: (event: Event) => void;
4239
+ onClose: (event: CloseEvent) => void;
4240
+ onConnectFail: () => void;
4241
+ onAuthInvalid: () => void;
4242
+ onNetworkError: () => void;
4243
+ onReconnectStart: () => void;
4244
+ onReconnectFail: (event: Event) => void;
4245
+ }
4246
+
3788
4247
  declare interface StopPreviewConfig {
3789
4248
  videoElement?: HTMLVideoElement;
3790
4249
  primary?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliyun-rtc-sdk",
3
- "version": "6.13.7",
3
+ "version": "6.14.0",
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.3",
13
- "aliyun-rts-sdk": "2.9.3-beta.0",
13
+ "aliyun-rts-sdk": "^2.10.2",
14
14
  "crypto-js": "^4.1.1",
15
15
  "dateformat": "^5.0.3",
16
16
  "eventemitter3": "^5.0.1",