aliyun-rtc-sdk 6.11.6-beta.1 → 6.11.6

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.
@@ -2,7 +2,13 @@ import EventEmitter from 'eventemitter3';
2
2
  import { LocalStream, IProfile } from 'aliyun-rts-sdk';
3
3
  import { IVideoConstraints, IAudioConstraints } from 'media-device';
4
4
  import { QueenEngineWorker } from 'aliyun-queen-engine';
5
- import { BeautyParams } from 'aliyun-queen-engine/dist/QueenTypes';
5
+
6
+ declare enum AliRtcRawDataStreamType {
7
+ /** 相机流 */
8
+ AliRtcSdkStreamTypeCapture = 0,
9
+ /** 屏幕共享流 */
10
+ AliRtcSdkStreamTypeScreen = 1
11
+ }
6
12
 
7
13
  declare enum VideoStreamSource {
8
14
  Camera = 0,
@@ -27,13 +33,6 @@ declare enum AudioStreamSource {
27
33
  */
28
34
  type AudioProfileKey = 'standard' | 'high' | 'standard-stereo' | 'high-stereo';
29
35
 
30
- declare enum AliRtcRawDataStreamType {
31
- /** 相机流 */
32
- AliRtcSdkStreamTypeCapture = 0,
33
- /** 屏幕共享流 */
34
- AliRtcSdkStreamTypeScreen = 1
35
- }
36
-
37
36
  interface AliRtcLocalStreamListener {
38
37
  videotrackended: () => void;
39
38
  audiotrackended: () => void;
@@ -164,6 +163,7 @@ declare abstract class AliRtcPlugin extends EventEmitter<AliRtcPluginListener> {
164
163
  lastOutputAudioTrack?: MediaStreamTrack;
165
164
  lastInputVideoTrack?: MediaStreamTrack;
166
165
  lastOutputVideoTrack?: MediaStreamTrack;
166
+ private _hasCleared;
167
167
  constructor(name: string, streamType?: AliRtcRawDataStreamType, trackType?: AliRtcPluginTrackType);
168
168
  get initOptions(): {};
169
169
  getOptions(): any;
@@ -183,7 +183,7 @@ declare abstract class AliRtcPlugin extends EventEmitter<AliRtcPluginListener> {
183
183
 
184
184
  type AliRtcBeautyPluginOptions = {
185
185
  licenseKey?: string;
186
- } & BeautyParams;
186
+ } & any;
187
187
  declare class AliRtcBeautyPlugin extends AliRtcPlugin {
188
188
  engineReady: boolean;
189
189
  _queenEngine?: QueenEngineWorker;
@@ -1 +1 @@
1
- (function(r,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):(r=typeof globalThis<"u"?globalThis:r||self,r.AliRtcBeautyPlugin=u(r.n,r.aliyunQueenEngine))})(this,function(r,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 a;(function(t){t[t.AUDIO=0]="AUDIO",t[t.VIDEO=1]="VIDEO",t[t.BOTH=2]="BOTH"})(a||(a={}));class T extends r{constructor(e,i=h.AliRtcSdkStreamTypeCapture,s=a.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"),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,s?await this.process(e,i):(this.lastOutputAudioTrack&&(this.trackType===a.BOTH||this.trackType===a.AUDIO)&&this.lastOutputAudioTrack&&e.updateAudioTrack(this.lastOutputAudioTrack),this.lastOutputVideoTrack&&(this.trackType===a.BOTH||this.trackType===a.VIDEO)&&this.lastOutputVideoTrack&&e.updateVideoTrack(this.lastOutputVideoTrack)),this.lastOutputAudioTrack=e.currentAudioTrack,this.lastOutputVideoTrack=e.currentVideoTrack}clear(e){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),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});