trtc-sdk-v5
Version:
Tencent Cloud RTC SDK for Web
1 lines • 41.5 kB
JavaScript
var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__objRest=(e,t)=>{var i={};for(var s in e)__hasOwnProp.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&__getOwnPropSymbols)for(var s of __getOwnPropSymbols(e))t.indexOf(s)<0&&__propIsEnum.call(e,s)&&(i[s]=e[s]);return i},__publicField=(e,t,i)=>__defNormalProp(e,"symbol"!=typeof t?t+"":t,i),TARGET_SAMPLE_RATE=48e3;function isValidAudioUrl(e){var t;const i=e.split("?")[0],s=null==(t=i.split(".").pop())?void 0:t.toLowerCase(),l=!!s&&["mp3","ogg","wav","flac"].includes(s),r=i.startsWith("blob"),a=i.startsWith("data");return l||r||a}var pcmPlayerWorkletString='class PCMPlayerWorklet extends AudioWorkletProcessor{constructor(){super(),this.capacity=480000,this.ringBuf=new Float32Array(this.capacity),this.writePos=0,this.readPos=0,this.buffered=0,this.isStop=!1,this.isPause=!1,this.playedSamples=0,this.totalSamples=0,this.msgCounter=0,this.isRealtime=!0,this.dataStart=0,this.port.onmessage=e=>{var t=e.data;switch(t.name){case"input":{var p=t.pcm,l=p.length;if(this.buffered+l>this.capacity){if(this.isRealtime){var c=Math.max(this.capacity*2,this.buffered+l),n=new Float32Array(c);for(var i=0;i<this.buffered;i++)n[i]=this.ringBuf[(this.readPos+i)%this.capacity];this.ringBuf=n,this.readPos=0,this.writePos=this.buffered,this.dataStart=0,this.capacity=c}else{var c=Math.max(this.capacity*2,this.totalSamples+l),n=new Float32Array(c);for(var i=0;i<this.totalSamples;i++)n[i]=this.ringBuf[(this.dataStart+i)%this.capacity];this.readPos=this.playedSamples,this.writePos=this.totalSamples,this.dataStart=0,this.ringBuf=n,this.capacity=c}}for(i=0;i<l;i++)this.ringBuf[this.writePos]=p[i],this.writePos=(this.writePos+1)%this.capacity;this.buffered+=l,this.totalSamples+=l;break}case"clear":{var s=this.buffered;this.readPos=0,this.writePos=0,this.buffered=0,this.playedSamples=0,this.totalSamples=0,this.dataStart=0,this.port.postMessage({type:"cleared",length:s});break}case"pause":this.isPause=!0;break;case"resume":this.isPause=!1;break;case"discard":this.readPos=0,this.writePos=0,this.buffered=0,this.playedSamples=0,this.totalSamples=0,this.dataStart=0;break;case"reset-playback":this.readPos=this.dataStart,this.playedSamples=0,this.buffered=this.totalSamples;break;case"set-mode":this.isRealtime=!!t.realtime;break;case"stop":this.isStop=!0}}}process(e,t){if(this.isStop)return!1;var s=t[0];if(!s||!s[0])return!0;var o=s[0];if(this.isPause)return o.fill(0),!0;var a=o.length;if(this.buffered>=a){for(var i=0;i<a;i++)o[i]=this.ringBuf[this.readPos],this.readPos=(this.readPos+1)%this.capacity;return this.buffered-=a,this.playedSamples+=a,this.msgCounter++,this.msgCounter>=8&&(this.msgCounter=0,this.port.postMessage({type:"played",playedSamples:this.playedSamples,bufferLength:this.buffered})),!0}if(this.buffered>0){var n=this.buffered;for(i=0;i<n;i++)o[i]=this.ringBuf[this.readPos],this.readPos=(this.readPos+1)%this.capacity;for(i=n;i<a;i++)o[i]=0;return this.buffered=0,this.playedSamples+=n,this.port.postMessage({type:"played",playedSamples:this.playedSamples,bufferLength:0}),!0}return o.fill(0),this.port.postMessage({type:"starving",playedSamples:this.playedSamples,bufferLength:0}),!0}}registerProcessor("pcm-player",PCMPlayerWorklet);';function startValidateRule(e){return{type:"object",required:!0,properties:{id:{type:"string",required:!0},sourceType:{type:"string",required:!0,values:["pcm","url","track"]},url:{type:"string"},loop:{type:"boolean"},volume:{type:"number"},playbackRate:{type:"number"},publish:{type:"boolean"},realtime:{type:["boolean","object"],properties:{maxDelay:{type:"number"},discardAll:{type:"boolean"}}},onInputError:{type:"function"},onDurationChange:{type:"function"},onTimeUpdate:{type:"function"},onEnded:{type:"function"}},validate(t,i,s){const{RtcError:l,ErrorCode:r}=e.errorModule,{sourceType:a,url:o,track:n}=t;if("url"===a){if(!o)throw new l({code:r.INVALID_PARAMETER,message:`${s}: url is required when sourceType is 'url'.`});if("*"!==o&&!isValidAudioUrl(o))throw new l({code:r.INVALID_PARAMETER,message:`${s}: audio url is invalid, supported formats: mp3, ogg, wav, flac, blob, data.`})}if("track"===a&&!n)throw new l({code:r.INVALID_PARAMETER,message:`${s}: track is required when sourceType is 'track'.`})}}}function updateValidateRule(e){return{type:"object",required:!0,properties:{id:{type:"string",required:!0},publish:{type:"boolean"},realtime:{type:["boolean","object"],properties:{maxDelay:{type:"number"},discardAll:{type:"boolean"}}},loop:{type:"boolean"},volume:{type:"number"},playbackRate:{type:"number"},seekFrom:{type:"number"},operation:{type:"string",values:["pause","resume","stop"]},onInputError:{type:"function"},onDurationChange:{type:"function"},onTimeUpdate:{type:"function"},onEnded:{type:"function"}}}}function stopValidateRule(e){return{type:"object",required:!0,properties:{id:{type:"string",required:!0}}}}var MAX_DELAY_MS=300,workletReady=null,PCMPlayer=class{constructor(e,t){__publicField(this,"_ctx"),__publicField(this,"_options"),__publicField(this,"_workletNode",null),__publicField(this,"_pcmInitialized",!1),__publicField(this,"_pcmState","idle"),__publicField(this,"_pendingInputs",[]),__publicField(this,"_processQueue",Promise.resolve()),__publicField(this,"_playedSamples",0),__publicField(this,"_totalInputSamples",0),__publicField(this,"_isPlayEnd",!1),__publicField(this,"_playEndStartTime",0),__publicField(this,"_resampleState",{lastSample:0,nextInputIndex:0}),__publicField(this,"_channels",1),__publicField(this,"_mediaDestination",null),__publicField(this,"_audioElement",null),this._ctx=e,this._options=__spreadValues({},t),void 0===this._options.realtime&&(this._options.realtime=!0),this._channels=this._options.channels&&this._options.channels>0?this._options.channels:1}get currentTime(){return Math.round(this._playedSamples/TARGET_SAMPLE_RATE*100)/100}get duration(){return Math.round(this._totalInputSamples/TARGET_SAMPLE_RATE*100)/100}get isStop(){return"stopped"===this._pcmState||"idle"===this._pcmState}get isPause(){return"paused"===this._pcmState}get isPlayEnd(){return this._isPlayEnd}get state(){return this._pcmState}getWorkletNode(){return this._workletNode}updateOptions(e){void 0!==e.realtime&&(this._options.realtime=e.realtime,this._workletNode&&this._workletNode.port.postMessage({name:"set-mode",realtime:!!e.realtime})),void 0!==e.channels&&e.channels>0&&(this._channels=e.channels),e.onInputError&&(this._options.onInputError=e.onInputError),e.onTimeUpdate&&(this._options.onTimeUpdate=e.onTimeUpdate),e.onEnded&&(this._options.onEnded=e.onEnded),e.onDurationChange&&(this._options.onDurationChange=e.onDurationChange)}async init(){const e=this._ctx._audioContext;"suspended"===e.state&&await e.resume(),workletReady||(workletReady=e.audioWorklet.addModule(URL.createObjectURL(new Blob([pcmPlayerWorkletString],{type:"application/javascript"})))),await workletReady,this._workletNode=new AudioWorkletNode(e,"pcm-player",{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[1]}),this._workletNode.port.postMessage({name:"set-mode",realtime:!!this._options.realtime}),this._workletNode.port.postMessage({name:"pause"}),this._workletNode.port.onmessage=e=>{var t,i,s,l,r,a;const{data:o}=e;switch(o.type){case"played":this._playedSamples=o.playedSamples,this._isPlayEnd=!1,this._playEndStartTime=0,null==(i=(t=this._options).onTimeUpdate)||i.call(t,this.currentTime,this.duration);break;case"starving":this._playedSamples=o.playedSamples,this._handlePlayEnd();break;case"cleared":this._totalInputSamples-=o.length,this._totalInputSamples<0&&(this._totalInputSamples=0),null==(l=(s=this._options).onDurationChange)||l.call(s,this.duration),null==(a=(r=this._options).onTimeUpdate)||a.call(r,this.currentTime,this.duration)}},this._pcmInitialized=!0,this._pcmState="idle",this._resetResampleState(),this._ctx._log.info("PCM engine initialized")}input(e,t){var i,s,l,r;if("destroyed"===this._pcmState)return this._ctx._log.warn("player is destroyed"),void(null==(s=(i=this._options).onInputError)||s.call(i,"player is destroyed",0));if(!t||t<=0)return this._ctx._log.warn("invalid sampleRate"),void(null==(r=(l=this._options).onInputError)||r.call(l,"invalid sampleRate",0));let a;if(e instanceof Int16Array){a=new Float32Array(e.length);for(let t=0;t<e.length;t++)a[t]=e[t]/32767}else a=e;this._channels>1&&(a=this._downmixToMono(a,this._channels)),this._processQueue=this._processQueue.then(async()=>{"destroyed"!==this._pcmState&&(this._workletNode?this._sendToWorklet(a,t):this._pendingInputs.push({pcm:a,sampleRate:t}))}).catch(e=>{var t,i;this._ctx._log.error("input error:",e),null==(i=(t=this._options).onInputError)||i.call(t,e instanceof Error?e.message:String(e),0)})}clearInput(){var e,t,i,s;this._workletNode&&(this._workletNode.port.postMessage({name:"clear"}),this._resetResampleState(),this._pendingInputs=[],this._playedSamples=0,this._totalInputSamples=0,null==(t=(e=this._options).onDurationChange)||t.call(e,0),null==(s=(i=this._options).onTimeUpdate)||s.call(i,0,0))}async start(){if(!this._pcmInitialized)return void this._ctx._log.warn("PCM not initialized");if("playing"===this._pcmState)return void this._ctx._log.debug("PCM already playing");const e=this._ctx._audioContext;if("suspended"===e.state&&await e.resume(),"stopped"===this._pcmState||"paused"===this._pcmState)this._workletNode&&("stopped"===this._pcmState&&this._workletNode.port.postMessage({name:"reset-playback"}),this._workletNode.port.postMessage({name:"resume"})),"stopped"===this._pcmState&&(this._playedSamples=0);else{if(!this._workletNode)return void this._ctx._log.warn("worklet not available");if(this._ctx._core.environment.IS_IOS){this._mediaDestination=e.createMediaStreamDestination(),this._workletNode.connect(this._mediaDestination);const t=new Audio;t.srcObject=this._mediaDestination.stream,t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this._audioElement=t;try{await t.play()}catch(e){this._ctx._log.warn("iOS audio element play failed:",e)}}else this._workletNode.connect(e.destination);this._workletNode.port.postMessage({name:"resume"})}this._pcmState="playing",this._isPlayEnd=!1,this._playEndStartTime=0,this._resetResampleState(),this._processQueue=this._processQueue.then(async()=>{for(const e of this._pendingInputs)this._sendToWorklet(e.pcm,e.sampleRate);this._pendingInputs=[]}),this._ctx._log.info("PCM playback started")}pause(){var e,t,i,s;"playing"===this._pcmState&&(this._pcmState="paused",this._workletNode&&(this._workletNode.port.postMessage({name:"pause"}),this._options.realtime&&(this._workletNode.port.postMessage({name:"discard"}),this._pendingInputs=[],this._totalInputSamples=0,this._playedSamples=0,null==(t=(e=this._options).onDurationChange)||t.call(e,0))),null==(s=(i=this._options).onTimeUpdate)||s.call(i,this.currentTime,this.duration))}resume(){var e,t;"paused"===this._pcmState&&(this._pcmState="playing",this._workletNode&&this._workletNode.port.postMessage({name:"resume"}),"suspended"===this._ctx._audioContext.state&&this._ctx._audioContext.resume().catch(e=>this._ctx._log.warn("AudioContext resume failed:",e)),null==(t=(e=this._options).onTimeUpdate)||t.call(e,this.currentTime,this.duration))}stop(){var e,t,i,s,l,r;this._pcmInitialized&&("playing"!==this._pcmState&&"paused"!==this._pcmState||(this._workletNode&&(this._workletNode.port.postMessage({name:"pause"}),this._options.realtime?(this._workletNode.port.postMessage({name:"discard"}),this._totalInputSamples=0,this._playedSamples=0,null==(t=(e=this._options).onDurationChange)||t.call(e,0)):this._playedSamples=0),this._pcmState="stopped",this._pendingInputs=[],this._processQueue=Promise.resolve(),this._resetResampleState(),this._isPlayEnd=!0,this._playEndStartTime=0,null==(s=(i=this._options).onEnded)||s.call(i),null==(r=(l=this._options).onTimeUpdate)||r.call(l,this.currentTime,this.duration),this._ctx._log.info("PCM playback stopped")))}destroy(){var e,t;null==(t=(e=this._options).onDurationChange)||t.call(e,0),this._pendingInputs=[],this._processQueue=Promise.resolve(),this._resetResampleState(),this._playedSamples=0,this._totalInputSamples=0,this._workletNode&&(this._workletNode.port.postMessage({name:"stop"}),this._workletNode.disconnect(),this._workletNode.port.onmessage=null,this._workletNode=null),this._audioElement&&(this._audioElement.pause(),this._audioElement.srcObject=null,this._audioElement=null),this._mediaDestination&&(this._mediaDestination.disconnect(),this._mediaDestination=null),this._isPlayEnd=!0,this._playEndStartTime=0,this._pcmState="destroyed",this._pcmInitialized=!1}_resetResampleState(){this._resampleState={lastSample:0,nextInputIndex:0}}_downmixToMono(e,t){const i=Math.floor(e.length/t),s=new Float32Array(i);for(let l=0;l<i;l++){let i=0;for(let s=0;s<t;s++)i+=e[l*t+s];s[l]=i/t}return s}_resampleStream(e,t,i){if(t===i)return this._resampleState.lastSample=e[e.length-1],this._resampleState.nextInputIndex=0,e;const s=t/i,l=[];let r=this._resampleState.nextInputIndex;const a=e.length;for(;;){const t=Math.floor(r);if(t>=a-1)break;const i=r-t;let o,n;-1===t?(o=this._resampleState.lastSample,n=e[0]):(o=e[t],n=e[t+1]),l.push(o+(n-o)*i),r+=s}return this._resampleState.lastSample=e[a-1],this._resampleState.nextInputIndex=r-a,new Float32Array(l)}_sendToWorklet(e,t){var i,s,l,r,a,o;if(!this._workletNode||"destroyed"===this._pcmState)return;if("paused"===this._pcmState&&this._options.realtime)return;const n=this._resampleStream(e,t,TARGET_SAMPLE_RATE);if(this._options.realtime){const e="object"==typeof this._options.realtime?this._options.realtime:{},t=(e.maxDelay||MAX_DELAY_MS)/1e3*TARGET_SAMPLE_RATE;this._totalInputSamples-this._playedSamples>t&&e.discardAll&&(this._workletNode.port.postMessage({name:"discard"}),this._totalInputSamples=this._playedSamples,null==(s=(i=this._options).onDurationChange)||s.call(i,this.duration))}this._totalInputSamples+=n.length,this._isPlayEnd=!1,this._playEndStartTime=0,this._workletNode.port.postMessage({name:"input",pcm:n}),null==(r=(l=this._options).onDurationChange)||r.call(l,this.duration),null==(o=(a=this._options).onTimeUpdate)||o.call(a,this.currentTime,this.duration)}_handlePlayEnd(){var e,t,i,s;"paused"===this._pcmState||this._isPlayEnd||(this._playEndStartTime?Date.now()-this._playEndStartTime>500&&(this._playEndStartTime=0,this._isPlayEnd=!0,null==(t=(e=this._options).onEnded)||t.call(e),null==(s=(i=this._options).onTimeUpdate)||s.call(i,this.currentTime,this.duration)):this._playEndStartTime=Date.now())}},ErrorCode=(e=>(e[e.INVALID_PARAMETER=4096]="INVALID_PARAMETER",e[e.INVALID_OPERATION=4097]="INVALID_OPERATION",e[e.NOT_SUPPORTED=4098]="NOT_SUPPORTED",e[e.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",e[e.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",e[e.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",e[e.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",e[e.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",e[e.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",e[e.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",e[e.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",e[e.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",e[e.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",e[e.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",e[e.CLIENT_BANNED=16448]="CLIENT_BANNED",e[e.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",e[e.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",e[e.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",e[e.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",e[e.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",e[e.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",e[e.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",e[e.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",e[e.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",e[e.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",e[e.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",e[e.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",e[e.API_CALL_ABORTED=16461]="API_CALL_ABORTED",e[e.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",e[e.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",e[e.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",e[e.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",e[e.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",e[e.WHIP_REQUEST_FAILED=16467]="WHIP_REQUEST_FAILED",e[e.UNKNOWN=65535]="UNKNOWN",e))(ErrorCode||{}),error_code_default=ErrorCode;function isAutoPlayBlockedError(e){var t;return"NotAllowedError"===e.name||(e.code===error_code_default.PLAY_NOT_ALLOWED||!!(null==(t=e.message)?void 0:t.includes("NotAllowedError")))}var URLPlayer=class{constructor(e,t){__publicField(this,"_ctx"),__publicField(this,"_options"),__publicField(this,"_urlPlayer",null),__publicField(this,"_urlPublisher",null),__publicField(this,"_audioObjectURL",null),__publicField(this,"_urlInitSettings",{}),__publicField(this,"_urlEventsBound",!1),__publicField(this,"_destroyed",!1),__publicField(this,"_localGainNode",null),__publicField(this,"_localSourceNode",null),__publicField(this,"_isLocalPipelineActive",!1),__publicField(this,"_localPipelineFailed",!1),this._ctx=e,this._options=__spreadValues({},t)}get volume(){var e,t;return this._isLocalPipelineActive&&this._localGainNode?this._localGainNode.gain.value:(null==(e=this._urlPlayer)?void 0:e.element)?this._urlPlayer.element.volume:null!=(t=this._options.volume)?t:1}set volume(e){this._options.volume=e,this._setVolume(e)}get loop(){var e,t;return(null==(e=this._urlPlayer)?void 0:e.element)?this._urlPlayer.element.loop:null!=(t=this._options.loop)&&t}set loop(e){this._options.loop=e,this._setLoop(e)}get playbackRate(){var e,t;return(null==(e=this._urlPlayer)?void 0:e.element)?this._urlPlayer.element.playbackRate:null!=(t=this._options.playbackRate)?t:1}set playbackRate(e){this._options.playbackRate=e,this._setPlaybackRate(e)}get currentTime(){return this._urlPlayer?Math.round(this._urlPlayer.currentTime/10)/100:0}get duration(){if(this._urlPlayer){const e=this._urlPlayer.duration;return Number.isFinite(e)?Math.round(e/10)/100:0}return 0}get isStop(){var e;return!(null==(e=this._urlPlayer)?void 0:e.element)||this._urlPlayer.element.paused&&0===this._urlPlayer.element.currentTime}get isPause(){var e;return!!(null==(e=this._urlPlayer)?void 0:e.element)&&this._urlPlayer.element.paused}get isPlayEnd(){var e;return!!(null==(e=this._urlPlayer)?void 0:e.element)&&this._urlPlayer.element.ended}getPublisherElement(){var e;return(null==(e=this._urlPublisher)?void 0:e.element)||null}getPublisher(){return this._urlPublisher}updateOptions(e){void 0!==e.volume&&this._setVolume(e.volume),void 0!==e.loop&&this._setLoop(e.loop),void 0!==e.playbackRate&&this._setPlaybackRate(e.playbackRate),void 0!==e.seekFrom&&this.seek(e.seekFrom),e.operation&&this._setOperation(e.operation),e.onDurationChange&&(this._options.onDurationChange=e.onDurationChange,this._bindDurationChange(e.onDurationChange)),e.onTimeUpdate&&(this._options.onTimeUpdate=e.onTimeUpdate,this._bindTimeUpdate(e.onTimeUpdate)),e.onEnded&&(this._options.onEnded=e.onEnded,this._bindEnded(e.onEnded))}async init(){const{url:e,loop:t,volume:i,playbackRate:s,publish:l}=this._options;if(!e)return;let r=e;if(l)try{r=await this._preloadURL(e)}catch(t){this._ctx._log.warn(`preload failed, falling back to original URL: ${t}`),r=e}this._urlPlayer=new this._ctx._core.AudioPlayer({id:`${this._ctx._id}-player`,url:r,track:null,container:null,muted:!1,log:this._ctx._log,enableTimeupdateEvent:!0}),l&&(this._urlPublisher=new this._ctx._core.AudioPlayer({id:`${this._ctx._id}-publisher`,url:r,track:null,container:null,muted:!1,log:this._ctx._log,enableTimeupdateEvent:!1})),this._urlInitSettings={loop:t,volume:i,playbackRate:s},this._destroyed=!1,this._ctx._log.info(`URL engine initialized, publish=${l}`)}async start(){if(this._urlPlayer)try{const e=[this._urlPlayer.play()];this._urlPublisher&&e.push(this._urlPublisher.play()),await Promise.all(e),this._ctx._core.environment.isRealIOS()&&this._urlPlayer.element&&this._setupLocalPipeline(),this._applyURLSettings(),this._bindURLEvents(),this._ctx._log.info("URL playback started")}catch(e){await this._handleAutoPlayFailed(e)}}pause(){var e,t;null==(e=this._urlPlayer)||e.pause(),null==(t=this._urlPublisher)||t.pause()}resume(){var e,t;null==(e=this._urlPlayer)||e.play(),null==(t=this._urlPublisher)||t.play()}stop(){this._urlPlayer&&(this._urlPlayer.pause(),this._urlPlayer.currentTime=0,this._urlPublisher&&(this._urlPublisher.pause(),this._urlPublisher.currentTime=0),this._ctx._log.info("URL playback stopped"))}seek(e){if(!this._urlPlayer)return;const t=1e3*e;t<0||t>this._urlPlayer.duration||(this._urlPlayer.currentTime=t,this._urlPublisher&&(this._urlPublisher.currentTime=t))}async createPublisher(e){if(this._urlPublisher)return this._urlPublisher.element;if(!this._urlPlayer)return null;let t=e||this._audioObjectURL||this._options.url||"";if(!e&&!this._audioObjectURL&&this._options.url)try{t=await this._preloadURL(this._options.url)}catch(e){this._ctx._log.warn(`preload for publish toggle failed, using original URL: ${e}`),t=this._options.url}if(this._urlPublisher=new this._ctx._core.AudioPlayer({id:`${this._ctx._id}-publisher`,url:t,track:null,container:null,muted:!1,log:this._ctx._log,enableTimeupdateEvent:!1}),this._urlPlayer.element&&!this._urlPlayer.element.paused)try{await this._urlPublisher.play(),this._urlPublisher.element&&this._urlPlayer.element&&(this._urlPublisher.element.loop=this._urlPlayer.element.loop,this._urlPublisher.element.playbackRate=this._urlPlayer.element.playbackRate,this._urlPublisher.element.currentTime=this._urlPlayer.element.currentTime)}catch(e){this._ctx._log.warn(`publisher play failed during publish toggle: ${e}`)}return this._urlPublisher.element}destroyPublisher(){this._urlPublisher&&(this._urlPublisher.stop(),this._urlPublisher=null)}destroy(){this._destroyLocalPipeline(),this._urlPlayer&&(this._urlPlayer.stop(),this._urlPlayer=null),this._urlPublisher&&(this._urlPublisher.stop(),this._urlPublisher=null),this._audioObjectURL&&(URL.revokeObjectURL(this._audioObjectURL),this._audioObjectURL=null),this._urlEventsBound=!1,this._destroyed=!0}_applyURLSettings(){const{loop:e,volume:t,playbackRate:i}=this._urlInitSettings;void 0!==e&&this._setLoop(e),void 0!==t&&this._setVolume(t),void 0!==i&&this._setPlaybackRate(i),this._urlInitSettings={}}_bindURLEvents(){this._urlEventsBound||(this._urlEventsBound=!0,this._options.onDurationChange&&this._bindDurationChange(this._options.onDurationChange),this._options.onTimeUpdate&&this._bindTimeUpdate(this._options.onTimeUpdate),this._options.onEnded&&this._bindEnded(this._options.onEnded),this._bindErrorHandlers())}async _handleAutoPlayFailed(e){var t;if("NotSupportedError"===e.name)this._ctx._log.warn(`play failed, try to reload source. error: ${e}`),await this._reloadURL(),await(null==(t=this._urlPlayer)?void 0:t.play()),this._urlPublisher&&await this._urlPublisher.play();else{if(!isAutoPlayBlockedError(e))throw e;{this._ctx._log.warn("autoplay blocked by browser policy, user interaction required");const e=this._ctx._core.room;if(null==e?void 0:e.enableAutoPlayDialog)this._ctx._core.showAutoPlayDialog();else{const e=async()=>{var e,t;if(this._destroyed)return;const i=[];this._urlPlayer&&i.push(this._urlPlayer.play()),this._urlPublisher&&i.push(this._urlPublisher.play()),await Promise.all(i),null==(t=(e=this._options).onAutoPlayResume)||t.call(e)};this._ctx._core.trtc.emit("autoplay-failed",{userId:"",mediaType:"audio",resume:e})}}}}async _preloadURL(e){var t,i;this._ctx._log.info(`preloading URL resource: ${e}`);try{const t=await this._ctx._core.fileDownloader.download(e,{retries:3,type:"blob"});if(!t||0===t.size)throw new Error(`Downloaded resource is empty (size=0), url: ${e}`);return this._audioObjectURL&&URL.revokeObjectURL(this._audioObjectURL),this._audioObjectURL=URL.createObjectURL(t),this._ctx._log.info(`preload complete, blobUrl created, size=${t.size}`),this._audioObjectURL}catch(s){if(s instanceof TypeError&&(null==(t=s.message)?void 0:t.includes("Failed to fetch")))throw this._ctx._log.error(`CORS error detected when loading audio resource: ${e}. Please check the server's CORS configuration (Access-Control-Allow-Origin header).`),new Error(`CORS error: Failed to fetch audio resource. Ensure the server allows cross-origin requests for: ${e}`);const l=null==(i=s.message)?void 0:i.match(/(\d{3})/);if(l){const t=parseInt(l[1]);if(t>=400&&t<600)throw this._ctx._log.error(`HTTP ${t} error when loading audio resource: ${e}`),new Error(`HTTP ${t}: Failed to load audio resource: ${e}`)}throw this._ctx._log.error(`Failed to preload audio resource after retries: ${e}, error: ${s.message||s}`),s}}async _reloadURL(){var e,t;const{url:i}=this._options;if(!i)return;const s=await this._preloadURL(i);(null==(e=this._urlPlayer)?void 0:e.element)&&(this._urlPlayer.element.src=s),(null==(t=this._urlPublisher)?void 0:t.element)&&(this._urlPublisher.element.src=s)}_setVolume(e){this._urlPlayer&&(this._ctx._core.environment.isRealIOS()?this._localPipelineFailed?this._urlPlayer.setVolume(e):(!this._isLocalPipelineActive&&this._urlPlayer.element&&this._setupLocalPipeline(),this._localGainNode&&(this._localGainNode.gain.value=e)):this._urlPlayer.setVolume(e))}_setLoop(e){this._urlPlayer&&this._urlPlayer.setLoop(e),this._urlPublisher&&this._urlPublisher.setLoop(e)}_setPlaybackRate(e){var t,i;(null==(t=this._urlPlayer)?void 0:t.element)&&(this._urlPlayer.element.playbackRate=e),(null==(i=this._urlPublisher)?void 0:i.element)&&(this._urlPublisher.element.playbackRate=e)}_setOperation(e){"pause"===e&&this.pause(),"resume"===e&&this.resume(),"stop"===e&&this.stop()}_bindDurationChange(e){var t;(null==(t=this._urlPlayer)?void 0:t.element)&&(this._urlPlayer.element.ondurationchange=()=>e(this.duration))}_bindTimeUpdate(e){var t;(null==(t=this._urlPlayer)?void 0:t.element)&&(this._urlPlayer.element.ontimeupdate=()=>e(this.currentTime,this.duration))}_bindEnded(e){var t;(null==(t=this._urlPlayer)?void 0:t.element)&&(this._urlPlayer.element.onended=e)}_setupLocalPipeline(){var e,t,i;if(this._localPipelineFailed)return;const s=this._ctx._audioContext;if(this._isLocalPipelineActive)return void("suspended"===s.state&&s.resume().catch(e=>{this._ctx._log.warn(`AudioContext resume failed: ${e}`)}));const l=null==(e=this._urlPlayer)?void 0:e.element;if(l)try{"suspended"===s.state&&s.resume().catch(e=>{this._ctx._log.warn(`AudioContext resume failed during local pipeline setup: ${e}`)});const e=this._ctx._core.createAudioNode(l);this._localSourceNode=e;const i=s.createGain();i.gain.value=null!=(t=this._options.volume)?t:1,this._localGainNode=i,e.connect(i),i.connect(s.destination),this._isLocalPipelineActive=!0,this._ctx._log.info("iOS local playback pipeline established")}catch(e){this._localPipelineFailed=!0,this._ctx._log.warn(`Failed to setup iOS local playback pipeline, falling back to element.volume: ${e.message||e}`),this._urlPlayer&&this._urlPlayer.setVolume(null!=(i=this._options.volume)?i:1)}}_destroyLocalPipeline(){if(this._localGainNode){try{this._localGainNode.disconnect()}catch(e){}this._localGainNode=null}if(this._localSourceNode){try{this._localSourceNode.disconnect()}catch(e){}this._localSourceNode=null}this._isLocalPipelineActive=!1,this._localPipelineFailed=!1}_bindErrorHandlers(){var e,t;(null==(e=this._urlPlayer)?void 0:e.element)&&(this._urlPlayer.element.onerror=()=>{var e,t;const i=null==(t=null==(e=this._urlPlayer)?void 0:e.element)?void 0:t.error;(null==i?void 0:i.code)===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED?(this._ctx._log.warn("player source not supported, triggering reload"),this._reloadURL().catch(e=>this._ctx._log.error("reload after player error failed:",e))):i&&this._ctx._log.error(`player media error: code=${i.code}, message=${i.message}`)}),(null==(t=this._urlPublisher)?void 0:t.element)&&(this._urlPublisher.element.onerror=()=>{var e,t;const i=null==(t=null==(e=this._urlPublisher)?void 0:e.element)?void 0:t.error;(null==i?void 0:i.code)===MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED?(this._ctx._log.warn("publisher source not supported, triggering reload"),this._reloadURL().catch(e=>this._ctx._log.warn("reload after publisher error failed:",e))):i&&this._ctx._log.warn(`publisher media error (non-fatal): code=${i.code}, message=${i.message}`)})}},TrackPlayer=class{constructor(e,t){__publicField(this,"_ctx"),__publicField(this,"_options"),__publicField(this,"_trackSource",null),__publicField(this,"_trackPlaying",!1),this._ctx=e,this._options=__spreadValues({},t)}get isPlaying(){return this._trackPlaying}get isStop(){return!this._trackPlaying}get isPause(){return!!this._options.track&&!this._options.track.enabled}get track(){return this._options.track||null}init(){this._ctx._log.info("Track engine initialized")}async start(){const{track:e}=this._options;if(!e)return;if(this._trackPlaying)return void this._ctx._log.warn("Track already playing");const t=this._ctx._audioContext;"suspended"===t.state&&await t.resume(),this._trackSource=t.createMediaStreamSource(new MediaStream([e])),this._trackSource.connect(t.destination),this._trackPlaying=!0,this._ctx._log.info("Track playback started")}pause(){this._options.track&&(this._options.track.enabled=!1)}resume(){this._options.track&&(this._options.track.enabled=!0)}stop(){this._trackPlaying&&(this._trackSource&&(this._trackSource.disconnect(),this._trackSource=null),this._trackPlaying=!1,this._ctx._log.info("Track playback stopped"))}destroy(){this.stop(),this._trackSource=null}},AudioRefChangeType={ADD:"add",REMOVE:"remove"},AUDIO_PLAYER_REF_PREFIX="aup",AudioPlayerContext=class{constructor(e,t,i,s,l,r){__publicField(this,"_id"),__publicField(this,"_sourceType"),__publicField(this,"_log"),__publicField(this,"_core"),__publicField(this,"_audioContext"),__publicField(this,"_options"),__publicField(this,"_destroyed",!1),__publicField(this,"_pcmPlayer",null),__publicField(this,"_urlPlayer",null),__publicField(this,"_trackPlayer",null),__publicField(this,"_mixPipeline",null),__publicField(this,"_publish",!1),this._id=e,this._sourceType=t,this._audioContext=i,this._core=s,this._log=l,this._options=__spreadValues({},r),this._publish=r.publish||!1}get id(){return this._id}get sourceType(){return this._sourceType}get volume(){var e;return"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.volume:null!=(e=this._options.volume)?e:1}set volume(e){"url"===this._sourceType&&(this._options.volume=e,this._urlPlayer&&(this._urlPlayer.volume=e),this._mixPipeline&&this._mixPipeline.setVolume(e))}get loop(){var e;return"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.loop:null!=(e=this._options.loop)&&e}set loop(e){"url"===this._sourceType&&(this._options.loop=e,this._urlPlayer&&(this._urlPlayer.loop=e))}get playbackRate(){var e;return"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.playbackRate:null!=(e=this._options.playbackRate)?e:1}set playbackRate(e){"url"===this._sourceType&&(this._options.playbackRate=e,this._urlPlayer&&(this._urlPlayer.playbackRate=e))}get publish(){return this._publish}set publish(e){e!==this._publish&&this.updateOptions({publish:e})}get currentTime(){return"pcm"===this._sourceType&&this._pcmPlayer?this._pcmPlayer.currentTime:"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.currentTime:0}get duration(){return"pcm"===this._sourceType&&this._pcmPlayer?this._pcmPlayer.duration:"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.duration:0}get isStop(){return"pcm"===this._sourceType&&this._pcmPlayer?this._pcmPlayer.isStop:"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.isStop:"track"!==this._sourceType||!this._trackPlayer||this._trackPlayer.isStop}get isPause(){return"pcm"===this._sourceType&&this._pcmPlayer?this._pcmPlayer.isPause:"url"===this._sourceType&&this._urlPlayer?this._urlPlayer.isPause:!("track"!==this._sourceType||!this._trackPlayer)&&this._trackPlayer.isPause}get isPlayEnd(){return"pcm"===this._sourceType&&this._pcmPlayer?this._pcmPlayer.isPlayEnd:!("url"!==this._sourceType||!this._urlPlayer)&&this._urlPlayer.isPlayEnd}input(e,t){var i,s,l;if("pcm"===this._sourceType)return this._destroyed?(this._log.warn("player is destroyed"),void(null==(s=(i=this._options).onInputError)||s.call(i,"player is destroyed",0))):void(null==(l=this._pcmPlayer)||l.input(e,t));this._log.warn("input() is only available for PCM source type")}clearInput(){var e;"pcm"===this._sourceType&&(this._destroyed||null==(e=this._pcmPlayer)||e.clearInput())}async start(){var e,t,i,s;if(this._destroyed)this._log.warn("player is destroyed");else switch(this._sourceType){case"pcm":await(null==(e=this._pcmPlayer)?void 0:e.start()),this._publish&&this._connectMixPipeline();break;case"url":await(null==(t=this._urlPlayer)?void 0:t.start()),this._publish&&(null==(i=this._urlPlayer)?void 0:i.getPublisherElement())&&(this._connectMixPipeline(),this._mixPipeline&&void 0!==this._options.volume&&this._mixPipeline.setVolume(this._options.volume));break;case"track":await(null==(s=this._trackPlayer)?void 0:s.start()),this._publish&&this._connectMixPipeline()}}pause(){var e,t,i;switch(this._sourceType){case"pcm":null==(e=this._pcmPlayer)||e.pause();break;case"url":null==(t=this._urlPlayer)||t.pause();break;case"track":null==(i=this._trackPlayer)||i.pause()}}resume(){var e,t,i,s,l;switch(this._sourceType){case"pcm":if(null==(e=this._pcmPlayer)||e.resume(),this._publish&&!this._mixPipeline){(null==(t=this._pcmPlayer)?void 0:t.getWorkletNode())&&this._connectMixPipeline()}break;case"url":null==(i=this._urlPlayer)||i.resume(),this._publish&&!this._mixPipeline&&(null==(s=this._urlPlayer)?void 0:s.getPublisherElement())&&(this._connectMixPipeline(),this._mixPipeline&&void 0!==this._options.volume&&this._mixPipeline.setVolume(this._options.volume));break;case"track":null==(l=this._trackPlayer)||l.resume(),this._publish&&!this._mixPipeline&&this._connectMixPipeline()}}stop(){var e,t,i;switch(this._sourceType){case"pcm":null==(e=this._pcmPlayer)||e.stop(),this._publish&&this._disconnectMixPipeline();break;case"url":null==(t=this._urlPlayer)||t.stop(),this._disconnectMixPipeline();break;case"track":null==(i=this._trackPlayer)||i.stop(),this._disconnectMixPipeline()}}seek(e){var t;"url"===this._sourceType&&(null==(t=this._urlPlayer)||t.seek(e))}async init(){var e;switch(this._log.info(`init: sourceType=${this._sourceType}, id=${this._id}, publish=${this._publish}`),this._sourceType){case"pcm":this._pcmPlayer=new PCMPlayer(this,{channels:this._options.channels,realtime:null==(e=this._options.realtime)||e,onInputError:this._options.onInputError,onDurationChange:this._options.onDurationChange,onTimeUpdate:this._options.onTimeUpdate,onEnded:this._options.onEnded}),await this._pcmPlayer.init();break;case"url":this._urlPlayer=new URLPlayer(this,{url:this._options.url||"",publish:this._publish,loop:this._options.loop,volume:this._options.volume,playbackRate:this._options.playbackRate,onDurationChange:this._options.onDurationChange,onTimeUpdate:this._options.onTimeUpdate,onEnded:this._options.onEnded,onAutoPlayResume:()=>{var e;this._publish&&(null==(e=this._urlPlayer)?void 0:e.getPublisher())&&this._connectMixPipeline()}}),await this._urlPlayer.init();break;case"track":this._trackPlayer=new TrackPlayer(this,{track:this._options.track,onEnded:this._options.onEnded}),this._trackPlayer.init()}this._destroyed=!1}async updateOptions(e){if(this._log.info(`update: ${JSON.stringify(e)}`),void 0!==e.publish&&e.publish!==this._publish){this._publish;this._publish=e.publish,this._publish?"url"===this._sourceType&&this._urlPlayer?(await this._urlPlayer.createPublisher(),this._urlPlayer.isStop||this._urlPlayer.isPause||this._connectMixPipeline()):"url"!==this._sourceType&&this._connectMixPipeline():(this._disconnectMixPipeline(),"url"===this._sourceType&&this._urlPlayer&&this._urlPlayer.destroyPublisher())}if("url"===this._sourceType&&this._urlPlayer){const t={};void 0!==e.volume&&(t.volume=e.volume),void 0!==e.loop&&(t.loop=e.loop),void 0!==e.playbackRate&&(t.playbackRate=e.playbackRate),void 0!==e.seekFrom&&(t.seekFrom=e.seekFrom),e.operation&&(t.operation=e.operation),e.onDurationChange&&(t.onDurationChange=e.onDurationChange),e.onTimeUpdate&&(t.onTimeUpdate=e.onTimeUpdate),e.onEnded&&(t.onEnded=e.onEnded),Object.keys(t).length>0&&this._urlPlayer.updateOptions(t),void 0!==e.volume&&this._mixPipeline&&this._mixPipeline.setVolume(e.volume)}if("pcm"===this._sourceType&&this._pcmPlayer){const t={};void 0!==e.realtime&&(t.realtime=e.realtime),void 0!==e.channels&&(t.channels=e.channels),e.onInputError&&(t.onInputError=e.onInputError),e.onTimeUpdate&&(t.onTimeUpdate=e.onTimeUpdate),e.onEnded&&(t.onEnded=e.onEnded),e.onDurationChange&&(t.onDurationChange=e.onDurationChange),Object.keys(t).length>0&&this._pcmPlayer.updateOptions(t)}}destroy(){var e,t,i;if(!this._destroyed){switch(this._log.info(`destroy: id=${this._id}`),this._disconnectMixPipeline(),this._sourceType){case"pcm":null==(e=this._pcmPlayer)||e.destroy(),this._pcmPlayer=null;break;case"url":null==(t=this._urlPlayer)||t.destroy(),this._urlPlayer=null;break;case"track":null==(i=this._trackPlayer)||i.destroy(),this._trackPlayer=null}this._destroyed=!0}}_connectMixPipeline(){var e;if(!this._mixPipeline)try{const t=this._core.room;if(!(null==t?void 0:t.audioManager))return void this._log.warn("cannot connect mix pipeline: room or audioManager not available");this._core.validateSourceNode();const i=t.audioManager;if(this._mixPipeline=new this._core.MixAudioPipeline(i),"url"===this._sourceType&&this._urlPlayer){const e=this._urlPlayer.getPublisherElement();e?this._mixPipeline.replaceSource(e):this._log.warn("publisher element not available, mix pipeline source not connected")}else if("track"===this._sourceType&&(null==(e=this._trackPlayer)?void 0:e.track))this._mixPipeline.replaceSource(this._trackPlayer.track);else if("pcm"===this._sourceType&&this._pcmPlayer){const e=this._pcmPlayer.getWorkletNode();e&&this._mixPipeline.source.replaceNode(e)}this._mixPipeline.connect(),this._mixPipeline.source.node&&t.audioManager.updateAudioReference({type:AudioRefChangeType.ADD,audioReference:this._mixPipeline.source.node,refId:`${AUDIO_PLAYER_REF_PREFIX}-${this._id}`}),this._log.info("mix pipeline connected")}catch(e){this._log.error("failed to connect mix pipeline:",e)}}_disconnectMixPipeline(){if(this._mixPipeline){try{const e=this._core.room;(null==e?void 0:e.audioManager)&&this._mixPipeline.source.node&&e.audioManager.updateAudioReference({type:AudioRefChangeType.REMOVE,audioReference:this._mixPipeline.source.node,refId:`${AUDIO_PLAYER_REF_PREFIX}-${this._id}`})}catch(e){this._log.warn("failed to remove audio reference:",e)}this._mixPipeline.disconnect(),this._mixPipeline=null,this._log.info("mix pipeline disconnected")}}},contextSeqId=0,_AudioPlayer=class e{constructor(e){this.core=e,__publicField(this,"_core"),__publicField(this,"_log"),__publicField(this,"_audioContext"),__publicField(this,"_instances",new Map),this._core=e,this._log=e.log.createChild({id:"aup"}),this._audioContext=e.audioContext,this._log.info("plugin registered")}getName(){return e.Name}getAlias(){return"aup-"}getGroup(e){return(null==e?void 0:e.id)||"*"}getValidateRule(e){switch(e){case"start":return startValidateRule(this._core);case"update":return updateValidateRule(this._core);case"stop":return stopValidateRule(this._core)}}async start(e){const{id:t,sourceType:i}=e;if(this._instances.has(t)){this._log.warn(`instance with id=${t} already exists, destroying old instance`);this._instances.get(t).destroy(),this._instances.delete(t)}const s="aup-"+ ++contextSeqId,l=this._core.log.createChild({id:s}),r=i,a=new AudioPlayerContext(t,r,this._audioContext,this._core,l,e);return await a.init(),this._instances.set(t,a),this._log.info(`player created id=${t}, total=${this._instances.size}`),"url"===r&&e.publish&&this._core.kvStatManager.addEnum({key:502700,value:3}),"pcm"===r&&e.publish&&this._core.kvStatManager.addEnum({key:502700,value:4}),a}async update(e){const{id:t}=e,i=this._instances.get(t);if(!i)return void this._log.warn(`update: instance not found id=${t}`);const s=e,{id:l}=s,r=__objRest(s,["id"]);return await i.updateOptions(r),"url"===i.sourceType&&e.publish&&this._core.kvStatManager.addEnum({key:502700,value:3}),"pcm"===i.sourceType&&e.publish&&this._core.kvStatManager.addEnum({key:502700,value:4}),i}async stop(e){const{id:t}=e;if("*"===t)return void this._destroyAll();const i=this._instances.get(t);i?(i.destroy(),this._instances.delete(t),this._log.info(`instance destroyed id=${t}, remaining=${this._instances.size}`)):this._log.warn(`stop: instance not found id=${t}`)}destroy(){this._destroyAll(),this._log.info("all instances destroyed")}_destroyAll(){for(const[e,t]of this._instances)t.destroy(),this._log.info(`instance destroyed id=${e}`);this._instances.clear()}};__publicField(_AudioPlayer,"TYPE",{}),__publicField(_AudioPlayer,"Name","AudioPlayer");var AudioPlayer=_AudioPlayer,index_default=AudioPlayer;export{index_default as default};export{AudioPlayer};