aliyun-rtc-sdk 6.12.1-beta.3 → 6.12.1-beta.5

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 +1 @@
1
- (function(a,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("eventemitter3"),require("aliyun-queen-engine")):typeof define=="function"&&define.amd?define(["eventemitter3","aliyun-queen-engine"],u):(a=typeof globalThis<"u"?globalThis:a||self,a.AliRtcBeautyPlugin=u(a.n,a.aliyunQueenEngine))})(this,function(a,u){"use strict";var c;(function(t){t[t.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",t[t.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen"})(c||(c={}));var h=c,p=Object.defineProperty,l=(t,e,i)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,n=(t,e,i)=>(l(t,typeof e!="symbol"?e+"":e,i),i),d;(function(t){t[t.PRE_PROCESSOR=0]="PRE_PROCESSOR",t[t.POST_PROCESSOR=1]="POST_PROCESSOR"})(d||(d={}));var r;(function(t){t[t.AUDIO=0]="AUDIO",t[t.VIDEO=1]="VIDEO",t[t.BOTH=2]="BOTH"})(r||(r={}));class T extends a{constructor(e,i=h.AliRtcSdkStreamTypeCapture,s=r.VIDEO){super(),n(this,"name"),n(this,"options"),n(this,"type",d.PRE_PROCESSOR),n(this,"streamType"),n(this,"trackType"),n(this,"zIndex",1),n(this,"_isEnable",!0),n(this,"lastInputAudioTrack"),n(this,"lastOutputAudioTrack"),n(this,"lastInputVideoTrack"),n(this,"lastOutputVideoTrack"),n(this,"_hasCleared",!0),this.name=e,this.streamType=i,this.trackType=s,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}async init(){}enable(){this._isEnable||(this._isEnable=!0,this.init(),this.emit("enabled"))}disable(){this._isEnable&&(this._isEnable=!1,this.clear(),this.emit("disabled"))}get isEnable(){return this._isEnable}audioUpdated(e){return this.lastInputAudioTrack?.id!==e.currentAudioTrack?.id}videoUpdated(e){return this.lastInputVideoTrack?.id!==e.currentVideoTrack?.id}async execute(e,i){const s=this.shouldUpdate(e,i);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,this._hasCleared||s?(await this.process(e,i),this._hasCleared=!1):(this.lastOutputAudioTrack&&(this.trackType===r.BOTH||this.trackType===r.AUDIO)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===r.BOTH||this.trackType===r.VIDEO)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack}clear(e){this._hasCleared=!0,this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}var k=Object.defineProperty,y=(t,e,i)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,o=(t,e,i)=>(y(t,typeof e!="symbol"?e+"":e,i),i);class g extends T{constructor(){super("AliRtcBeauty"),o(this,"engineReady",!1),o(this,"_queenEngine"),o(this,"canvas"),o(this,"dirty",!1),o(this,"lastFrameTimestamp",0),o(this,"continuousStuckCount",0),this.zIndex=0}get initOptions(){return{licenseKey:""}}setOptions(e){const i=!!e.segmentBackgroundProcess?.enable,s=!!e.setSegmentBackgroundImage?.backgroundImgUrl;this.options={...this.options,...e},s?delete this.options.segmentBackgroundProcess:i&&delete this.options.setSegmentBackgroundImage,this.engineReady&&this.queenEngine?.setEngineParams(this.options)}async init(){await this.initQueen()}isSupported(){const e=!(typeof TransformStream>"u"||typeof MediaStreamTrackProcessor>"u"||typeof MediaStreamTrackGenerator>"u"),i=!(typeof OffscreenCanvas>"u"||typeof WebGL2RenderingContext>"u"),s=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));return e&&i&&s}async initQueen(){this.canvas=document.createElement("canvas");const{licenseKey:e=""}=this.options,i=new u.QueenEngineWorker(u.kQueenVersion.Pro);return this._queenEngine=i,await new Promise(s=>{i.init(e,()=>{this.engineReady=!0,this.emit("ready"),i.setEngineParams(this.options),s(i)},function(){},this.canvas)}),i}shouldUpdate(e){return this.videoUpdated(e)||this.dirty}async process(e){if(!e.originVideoTrack){this.clear(e),e.updateVideoTrack();return}if(!this.queenEngine||!this.engineReady)return;this.dirty=!1;const i=this.queenEngine.renderMediaStreamTrack(e.originVideoTrack);i&&e.updateVideoTrack(i)}get queenEngine(){return this._queenEngine}clear(e){this.canvas=void 0,this.engineReady=!1,this._queenEngine=void 0,this.queenEngine?.engineDestory(),super.clear(e)}}return g});
1
+ (function(a,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("eventemitter3"),require("aliyun-queen-engine")):typeof define=="function"&&define.amd?define(["eventemitter3","aliyun-queen-engine"],u):(a=typeof globalThis<"u"?globalThis:a||self,a.AliRtcBeautyPlugin=u(a.n,a.aliyunQueenEngine))})(this,function(a,u){"use strict";var c;(function(t){t[t.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",t[t.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen"})(c||(c={}));var h=c,p=Object.defineProperty,l=(t,e,i)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,n=(t,e,i)=>l(t,typeof e!="symbol"?e+"":e,i),d;(function(t){t[t.PRE_PROCESSOR=0]="PRE_PROCESSOR",t[t.POST_PROCESSOR=1]="POST_PROCESSOR"})(d||(d={}));var r;(function(t){t[t.AUDIO=0]="AUDIO",t[t.VIDEO=1]="VIDEO",t[t.BOTH=2]="BOTH"})(r||(r={}));class T extends a{constructor(e,i=h.AliRtcSdkStreamTypeCapture,s=r.VIDEO){super(),n(this,"name"),n(this,"options"),n(this,"type",d.PRE_PROCESSOR),n(this,"streamType"),n(this,"trackType"),n(this,"zIndex",1),n(this,"_isEnable",!0),n(this,"lastInputAudioTrack"),n(this,"lastOutputAudioTrack"),n(this,"lastInputVideoTrack"),n(this,"lastOutputVideoTrack"),n(this,"_hasCleared",!0),this.name=e,this.streamType=i,this.trackType=s,this.options=this.initOptions}get initOptions(){return{}}getOptions(){return this.options}async init(){}enable(){this._isEnable||(this._isEnable=!0,this.init(),this.emit("enabled"))}disable(){this._isEnable&&(this._isEnable=!1,this.clear(),this.emit("disabled"))}get isEnable(){return this._isEnable}audioUpdated(e){return this.lastInputAudioTrack?.id!==e.currentAudioTrack?.id}videoUpdated(e){return this.lastInputVideoTrack?.id!==e.currentVideoTrack?.id}async execute(e,i){const s=this.shouldUpdate(e,i);this.lastInputAudioTrack=e.currentAudioTrack,this.lastInputVideoTrack=e.currentVideoTrack,this._hasCleared||s?(await this.process(e,i),this._hasCleared=!1):(this.lastOutputAudioTrack&&(this.trackType===r.BOTH||this.trackType===r.AUDIO)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===r.BOTH||this.trackType===r.VIDEO)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack}clear(e){this._hasCleared=!0,this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}var k=Object.defineProperty,y=(t,e,i)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,o=(t,e,i)=>y(t,typeof e!="symbol"?e+"":e,i);class g extends T{constructor(){super("AliRtcBeauty"),o(this,"engineReady",!1),o(this,"_queenEngine"),o(this,"canvas"),o(this,"dirty",!1),o(this,"lastFrameTimestamp",0),o(this,"continuousStuckCount",0),this.zIndex=0}get initOptions(){return{licenseKey:""}}setOptions(e){const i=!!e.segmentBackgroundProcess?.enable,s=!!e.setSegmentBackgroundImage?.backgroundImgUrl;this.options={...this.options,...e},s?delete this.options.segmentBackgroundProcess:i&&delete this.options.setSegmentBackgroundImage,this.engineReady&&this.queenEngine?.setEngineParams(this.options)}async init(){await this.initQueen()}isSupported(){const e=!(typeof TransformStream>"u"||typeof MediaStreamTrackProcessor>"u"||typeof MediaStreamTrackGenerator>"u"),i=!(typeof OffscreenCanvas>"u"||typeof WebGL2RenderingContext>"u"),s=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));return e&&i&&s}async initQueen(){this.canvas=document.createElement("canvas");const{licenseKey:e=""}=this.options,i=new u.QueenEngineWorker(u.kQueenVersion.Pro);return this._queenEngine=i,await new Promise(s=>{i.init(e,()=>{this.engineReady=!0,this.emit("ready"),i.setEngineParams(this.options),s(i)},function(){},this.canvas)}),i}shouldUpdate(e){return this.videoUpdated(e)||this.dirty}async process(e){if(!e.originVideoTrack){this.clear(e),e.updateVideoTrack();return}if(!this.queenEngine||!this.engineReady)return;this.dirty=!1;const i=this.queenEngine.renderMediaStreamTrack(e.originVideoTrack);i&&e.updateVideoTrack(i)}get queenEngine(){return this._queenEngine}clear(e){this.canvas=void 0,this.engineReady=!1,this._queenEngine=void 0,this.queenEngine?.engineDestory(),super.clear(e)}}return g});
@@ -386,10 +386,9 @@ declare class AliRtcEngine_2 extends default_2<AliRtcEngineEventListener> {
386
386
  joinChannel(authInfoOrToken: AliRtcAuthInfo | string, userName?: string): Promise<void>;
387
387
  /**
388
388
  * 离开频道
389
- * @param {boolean} bye 是否因为被挤占而离开房间
390
389
  * @note 如果当前不在频道内,调用 leaveChannel 不会对实例产生任何影响,但会产生消息,通知频道内其他用户
391
390
  */
392
- leaveChannel(bye?: boolean): Promise<void>;
391
+ leaveChannel(): Promise<void>;
393
392
  /**
394
393
  * 检查当前是否在频道中
395
394
  * @returns {boolean}
@@ -2201,6 +2200,8 @@ declare class BizControl extends default_2<BizControlListener> {
2201
2200
  private indicationTimer;
2202
2201
  private parameter;
2203
2202
  constructor(config: BizControlConfig);
2203
+ private publishRetryOptionsHook;
2204
+ private subscribeRetryOptionsHook;
2204
2205
  private addSignalingManagerListener;
2205
2206
  isAutoSubAudio(): boolean;
2206
2207
  setAutoSubAudio(value: boolean): void;
@@ -3263,6 +3264,7 @@ declare class RemoteUser extends User {
3263
3264
  private onDataChannelMessage;
3264
3265
  private subscribeDataChannel;
3265
3266
  private subscribeStopDataChannel;
3267
+ getRetryOptions(): RemoteSubscribeOptions | undefined;
3266
3268
  /**
3267
3269
  * 尝试更新订阅
3268
3270
  * 1. 需要新增订阅的情况:想要订阅 & 没有正在订阅 & 远端有流
@@ -3383,16 +3385,20 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3383
3385
  private audioRedEnabled;
3384
3386
  private localStreamManager;
3385
3387
  private slsReporter;
3388
+ private _rtsReconnecting;
3389
+ private _rtsPeerConnectionType;
3386
3390
  private connecting;
3387
3391
  private connected;
3388
3392
  private _pcTraceId;
3389
3393
  private _localJoinTime;
3394
+ private publishRetryHook?;
3395
+ private subscribeRetryOptionsHook?;
3390
3396
  private connectionResolve?;
3391
- connectingPromise?: Promise<unknown>;
3397
+ private connectingPromise?;
3392
3398
  private dcResolve?;
3393
- dcConnectingPromise?: Promise<unknown>;
3399
+ private dcConnectingPromise?;
3394
3400
  private _publishingTracks;
3395
- constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter);
3401
+ constructor(localStreamManager: LocalStreamManager, slsReporter: SLSReporter, publishRetryHook: () => void, subscribeRetryOptionsHook: () => RemoteSubscribeOptions | undefined);
3396
3402
  private addRTSListener;
3397
3403
  get pcTraceId(): string;
3398
3404
  set localJoinTime(time: number);
@@ -3442,13 +3448,18 @@ declare class RtsManager extends default_2<RtsManagerEventListener> {
3442
3448
  }
3443
3449
 
3444
3450
  declare interface RtsManagerEventListener {
3445
- reconnecting: () => {};
3451
+ reconnecting: (type: RtsPeerConnectionType) => {};
3446
3452
  disconnected: () => {};
3447
- connected: () => {};
3453
+ connected: (isReconnected: boolean, type: RtsPeerConnectionType) => {};
3448
3454
  subscribeexceeds: () => {};
3449
3455
  seimessage: (url: string, payloadType: number, data: ArrayBuffer) => {};
3450
3456
  }
3451
3457
 
3458
+ declare enum RtsPeerConnectionType {
3459
+ PUBLISH = "publish",
3460
+ SUBSCRIBE = "subscribe"
3461
+ }
3462
+
3452
3463
  declare class SignalingManager extends default_2<RoomServerListener> {
3453
3464
  /**
3454
3465
  * @ignore
@@ -3720,7 +3731,7 @@ declare class SLSReporter {
3720
3731
  reportSDKCreated(startTs: number): void;
3721
3732
  reportJoinInvoked(authInfo: AliRtcAuthInfo): void;
3722
3733
  reportJoinResult(error: any): void;
3723
- reportSTSResult(code: number): void;
3734
+ reportSTSResult(code: number, startTs: number): void;
3724
3735
  reportLeaveInvoked(): void;
3725
3736
  reportSEIMessage(payloadType: number, length: number, repeatCount: number, delay: number, isKey: boolean): void;
3726
3737
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliyun-rtc-sdk",
3
- "version": "6.12.1-beta.3",
3
+ "version": "6.12.1-beta.5",
4
4
  "type": "module",
5
5
  "description": "rtc web sdk of aliyun",
6
6
  "main": "dist/aliyun-rtc-sdk.js",
@@ -9,7 +9,7 @@
9
9
  "@aliyun-sls/web-sts-plugin": "^0.3.5",
10
10
  "@aliyun-sls/web-track-browser": "^0.3.5",
11
11
  "aliyun-queen-engine": "^6.3.3",
12
- "aliyun-rts-sdk": "2.9.1",
12
+ "aliyun-rts-sdk": "2.9.2-beta.2",
13
13
  "crypto-js": "^4.1.1",
14
14
  "dateformat": "^5.0.3",
15
15
  "eventemitter3": "^5.0.1",