aliyun-rtc-sdk 7.0.0 → 7.0.2

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),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});
1
+ import{h as r}from"./index-BGdMdvjC.js";import{QueenEngineWorker as a,kQueenVersion as o}from"aliyun-queen-engine";import"eventemitter3";var u=Object.defineProperty,c=(t,e,n)=>e in t?u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,i=(t,e,n)=>c(t,typeof e!="symbol"?e+"":e,n);class d extends r{constructor(){super("AliRtcBeauty"),i(this,"engineReady",!1),i(this,"_queenEngine"),i(this,"canvas"),i(this,"dirty",!1),i(this,"lastFrameTimestamp",0),i(this,"continuousStuckCount",0),this.zIndex=0}get initOptions(){return{licenseKey:""}}setOptions(e){const n=!!e.segmentBackgroundProcess?.enable,s=!!e.setSegmentBackgroundImage?.backgroundImgUrl;this.options={...this.options,...e},s?delete this.options.segmentBackgroundProcess:n&&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"),n=!(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&&n&&s}async initQueen(){this.canvas=document.createElement("canvas");const{licenseKey:e=""}=this.options,n=new a(o.Pro);return this._queenEngine=n,await new Promise(s=>{n.init(e,()=>{this.engineReady=!0,this.emit("ready"),n.setEngineParams(this.options),s(n)},function(){},this.canvas)}),n}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 n=this.queenEngine.renderMediaStreamTrack(e.originVideoTrack);n&&e.updateVideoTrack(n)}get queenEngine(){return this._queenEngine}clear(e){this.canvas=void 0,this.engineReady=!1,this._queenEngine=void 0,this.queenEngine?.engineDestory(),super.clear(e)}}export{d as default};
@@ -0,0 +1 @@
1
+ import n from"eventemitter3";var u;(function(t){t[t.AliRtcSdkStreamTypeCapture=0]="AliRtcSdkStreamTypeCapture",t[t.AliRtcSdkStreamTypeScreen=1]="AliRtcSdkStreamTypeScreen"})(u||(u={}));var d=u,h=Object.defineProperty,o=(t,i,a)=>i in t?h(t,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[i]=a,e=(t,i,a)=>o(t,typeof i!="symbol"?i+"":i,a),c;(function(t){t[t.PRE_PROCESSOR=0]="PRE_PROCESSOR",t[t.POST_PROCESSOR=1]="POST_PROCESSOR"})(c||(c={}));var s;(function(t){t[t.AUDIO=0]="AUDIO",t[t.VIDEO=1]="VIDEO",t[t.BOTH=2]="BOTH"})(s||(s={}));class p extends n{constructor(i,a=d.AliRtcSdkStreamTypeCapture,r=s.VIDEO){super(),e(this,"name"),e(this,"options"),e(this,"type",c.PRE_PROCESSOR),e(this,"streamType"),e(this,"trackType"),e(this,"zIndex",1),e(this,"_isEnable",!0),e(this,"lastInputAudioTrack"),e(this,"lastOutputAudioTrack"),e(this,"lastInputVideoTrack"),e(this,"lastOutputVideoTrack"),e(this,"_hasCleared",!0),this.name=i,this.streamType=a,this.trackType=r,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(i){return this.lastInputAudioTrack?.id!==i.currentAudioTrack?.id}videoUpdated(i){return this.lastInputVideoTrack?.id!==i.currentVideoTrack?.id}async execute(i,a){const r=this.shouldUpdate(i,a);this.lastInputAudioTrack=i.currentAudioTrack,this.lastInputVideoTrack=i.currentVideoTrack,this._hasCleared||r?(await this.process(i,a),this._hasCleared=!1):(this.lastOutputAudioTrack&&(this.trackType===s.BOTH||this.trackType===s.AUDIO)&&this.lastOutputAudioTrack&&i.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===s.BOTH||this.trackType===s.VIDEO)&&this.lastOutputVideoTrack&&i.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=i.currentAudioTrack,this.lastOutputVideoTrack=i.currentVideoTrack}clear(i){this._hasCleared=!0,this.lastInputAudioTrack=void 0,this.lastInputVideoTrack=void 0,this.lastOutputAudioTrack=void 0,this.lastOutputVideoTrack=void 0}}export{s as A,d as C,p as h};
@@ -948,6 +948,7 @@ declare class AliRtcEngine_2 extends default_2<AliRtcEngineEventListener> {
948
948
  * @param option 插件初始化参数值,请阅读插件库接入文档
949
949
  */
950
950
  setPluginOption(name: string, option: any): void;
951
+ getPluginByName(name: string): any;
951
952
  /**
952
953
  * @brief 根据插件ID获取插件内部信息
953
954
  * @param name 插件名称,通过 plugin.name 获取
@@ -2245,6 +2246,7 @@ declare class BizControl extends default_2<BizControlListener> {
2245
2246
  private audioMixerPlugin?;
2246
2247
  private dualVideoPlugin?;
2247
2248
  private blankAudioPlugin?;
2249
+ private audioProcessorPlugin?;
2248
2250
  protected slsReporter: SLSReporter;
2249
2251
  private statsMonitorId?;
2250
2252
  private autoSubAudio;
@@ -2260,6 +2262,7 @@ declare class BizControl extends default_2<BizControlListener> {
2260
2262
  private audioVolumeIndicationInterval;
2261
2263
  private indicationTimer;
2262
2264
  private parameter;
2265
+ private audio3AConfig;
2263
2266
  private dcReadyHelper?;
2264
2267
  constructor(config: BizControlConfig);
2265
2268
  private addSignalingManagerListener;
@@ -2388,6 +2391,7 @@ declare class BizControl extends default_2<BizControlListener> {
2388
2391
  setEnableMediaExtensionMsg(enable: boolean): void;
2389
2392
  setAudioRedEnabled(enable: boolean): void;
2390
2393
  setParameter(parameter: string): void;
2394
+ private setupAudioProcessingPluginIfNeeded;
2391
2395
  getParameter(): string;
2392
2396
  sendDataChannelMessage(message: AliRtcDataChannelMsg): void;
2393
2397
  }
@@ -2544,6 +2548,7 @@ declare interface ISendPackage {
2544
2548
  channelprofile: AliRtcSdkChannelProfile;
2545
2549
  };
2546
2550
  auth?: SendPackageAuthInfo;
2551
+ adapt?: PackageAdaptInfo;
2547
2552
  sessionid?: string;
2548
2553
  pushstreamurl?: string;
2549
2554
  users?: any[];
@@ -2570,6 +2575,7 @@ declare interface JoinResult {
2570
2575
  tid: string;
2571
2576
  users: JoinInfo[];
2572
2577
  timestamp: number;
2578
+ config: any;
2573
2579
  }
2574
2580
 
2575
2581
  declare interface LeaveInfo {
@@ -3051,12 +3057,23 @@ declare interface OSSToken {
3051
3057
  expiration: number;
3052
3058
  }
3053
3059
 
3060
+ declare interface PackageAdaptInfo {
3061
+ os_name: string;
3062
+ device_name: string;
3063
+ brand_name: string;
3064
+ device_key: string;
3065
+ os_version: string;
3066
+ sdk_version: string;
3067
+ version: string;
3068
+ }
3069
+
3054
3070
  declare class PackageCreater {
3055
3071
  protected authInfo: AliRtcAuthInfo;
3056
3072
  protected userName: string;
3057
3073
  protected seqIndex: number;
3058
3074
  constructor(authInfo: AliRtcAuthInfo, userName: string);
3059
3075
  get roleAuth(): SendPackageAuthInfo | undefined;
3076
+ get adaptInfo(): PackageAdaptInfo | undefined;
3060
3077
  refreshAuthInfo(authInfo: AliRtcAuthInfo): void;
3061
3078
  getSeqIndex(): number;
3062
3079
  /**
@@ -4125,6 +4142,7 @@ declare class SLSReporter {
4125
4142
  * 断开连接
4126
4143
  */
4127
4144
  stop(): void;
4145
+ reportPublishAudio3A(callId: string, msid: string, traceId: string, apmJson: string): void;
4128
4146
  reportPublishMonitor(callId: string, traceId: string, msid: string, track: MediaStreamTrack | undefined, stats: any[]): void;
4129
4147
  reportSubscribeMonitor(callId: string, remoteId: string, traceId: string, msid: string, stats: any[]): void;
4130
4148
  reportNetworkMonitor(candidates: any[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliyun-rtc-sdk",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "type": "module",
5
5
  "description": "rtc web sdk of aliyun",
6
6
  "main": "dist/aliyun-rtc-sdk.umd.js",
@@ -14,6 +14,7 @@
14
14
  "crypto-js": "^4.1.1",
15
15
  "dateformat": "^5.0.3",
16
16
  "eventemitter3": "^5.0.1",
17
+ "ua-parser-js": "1.0.40",
17
18
  "uuid": "^10.0.0"
18
19
  },
19
20
  "homepage": "https://help.aliyun.com/zh/live/user-guide/quick-use",