icecast-metadata-player
Version:
Simple to use Javascript class that plays an Icecast stream with real-time metadata updates
22 lines (21 loc) • 7.64 kB
JavaScript
/*!
* Copyright 2021-2024 Ethan Halsall
* https://github.com/eshaz/icecast-metadata-js
*
* This file is part of icecast-metadata-player.
*
* icecast-metadata-player free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* icecast-metadata-player distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>
*/
;(self.webpackChunkIcecastMetadataPlayer=self.webpackChunkIcecastMetadataPlayer||[]).push([[385],{0:(H,i,e)=>{e.d(i,{A:()=>t});const t=(H,i)=>{Object.defineProperty(H,"name",{value:i})}},209:(H,i,e)=>{e.d(i,{A:()=>h});var t=e(178);function h(){const H=Uint8Array,i=Float32Array;h.modules||Object.defineProperties(h,{modules:{value:new WeakMap},setModule:{value(H,i){h.modules.set(H,Promise.resolve(i))}},getModule:{value(H,i){let e=h.modules.get(H);return e||(i?e=WebAssembly.compile((0,t.D4)(i)):(i=H.wasm,e=h.inflateDynEncodeString(i).then(H=>WebAssembly.compile(H))),h.modules.set(H,e)),e}},concatFloat32:{value(H,e){let t=new i(e),h=0,I=0;for(;h<H.length;)t.set(H[h],I),I+=H[h++].length;return t}},getDecodedAudio:{value:(H,i,e,t,h)=>({errors:H,channelData:i,samplesDecoded:e,sampleRate:t,bitDepth:h})},getDecodedAudioMultiChannel:{value(H,i,e,t,I,s){let n,r,a=[];for(n=0;n<e;n++){const H=[];for(r=0;r<i.length;)H.push(i[r++][n]||[]);a.push(h.concatFloat32(H,t))}return h.getDecodedAudio(H,a,t,I,s)}},inflateDynEncodeString:{value:i=>(i=(0,t.D4)(i),new Promise(e=>{const t=String.raw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1m,hiI*4,3H,iø-H,i¸)H,i-H18)J(,hi¡I*H(i(p5,H1H,V)ú-H,V)ø-o5,3H,i(H,iXH,i-H1i)H08)J(,hi I*H(i(p5,H0H,V)H,V)o5,3H,H,iPH,iH8+I*4+3(3(3H,i$6i¬78+I*3H*H3m5(3i)I-H*i(r5)3H)H,P*0^*(H+H,P*<^*(H*I-3H,i2L(H-33Á)+(i¨03b+(,(-(.(/(0(1(2(3(5(7(9(;(?(C(G(K(S([(c(k({(((«(Ë(ë((*)(iø03O)()()()(*(*(*(*(+(+(+(+(,(,(,(,(-(-(-(-(i¨13M8(9(:(((0(/(1(.(2(-(3(,(4(+(5(*(6()(7(T7*S7US0U `;h.getModule(h,t).then(H=>WebAssembly.instantiate(H,{})).then(({exports:t})=>{const h=new Map(Object.entries(t)),I=h.get("puff"),s=h.get("memory").buffer,n=new H(s),r=new DataView(s);let a=h.get("__heap_base");const o=i.length,c=a;a+=4,r.setInt32(c,o,!0);const l=a;a+=o,n.set(i,l);const u=a;a+=4,r.setInt32(u,n.byteLength-a,!0),I(a,u,l,c),e(n.slice(a,a+r.getInt32(u,!0)))})}))}}),Object.defineProperty(this,"wasm",{enumerable:!0,get:()=>this.H}),this.getOutputChannels=(H,i,e)=>{let t=[],h=0;for(;h<i;)t.push(H.slice(h*e,h++*e+e));return t},this.allocateTypedArray=(H,i,e=!0)=>{const t=this.H.malloc(i.BYTES_PER_ELEMENT*H);return e&&this.i.add(t),{ptr:t,len:H,buf:new i(this.H.HEAP,t,H)}},this.free=()=>{this.i.forEach(H=>{this.H.free(H)}),this.i.clear()},this.codeToString=H=>{const i=[],e=new Uint8Array(this.H.HEAP);for(let t=e[H];0!==t;t=e[++H])i.push(t);return String.fromCharCode.apply(null,i)},this.addError=(H,i,e,t,h,I)=>{H.push({message:i,frameLength:e,frameNumber:t,inputBytes:h,outputSamples:I})},this.instantiate=(H,i)=>(i&&h.setModule(H,i),this.H=new H(h).instantiate(),this.i=new Set,this.H.ready.then(()=>this))}},374:(H,i,e)=>{e.d(i,{A:()=>I});var t=e(761),h=e(209);class I extends((()=>globalThis.Worker||t)()){constructor(H,i,e,t){h.A.modules||new h.A;let I=h.A.modules.get(e);if(!I){let H,i="text/javascript",s=`'use strict';(${((H,i,e)=>{let t,h,I=new Promise(H=>{h=H});self.onmessage=({data:{id:s,command:n,data:r}})=>{let a,o=I,c={id:s};"init"===n?(Object.defineProperties(H,{WASMAudioDecoderCommon:{value:i},EmscriptenWASM:{value:e},module:{value:r.module},isWebWorker:{value:!0}}),t=new H(r.options),h()):"free"===n?t.free():"ready"===n?o=o.then(()=>t.ready):"reset"===n?o=o.then(()=>t.reset()):(Object.assign(c,t[n](Array.isArray(r)?r.map(H=>new Uint8Array(H)):new Uint8Array(r))),a=c.channelData?c.channelData.map(H=>H.buffer):[]),o.then(()=>self.postMessage(c,a))}}).toString()})(${e}, ${h.A}, ${t})`;try{H=void 0!==process.versions.node}catch{}I=H?`data:${i};base64,${Buffer.from(s).toString("base64")}`:URL.createObjectURL(new Blob([s],{type:i})),h.A.modules.set(e,I)}super(I,{name:i}),this.t=Number.MIN_SAFE_INTEGER,this.h=new Map,this.onmessage=({data:H})=>{const{id:i,...e}=H;this.h.get(i)(e),this.h.delete(i)},new t(h.A).getModule().then(i=>{this.postToDecoder("init",{module:i,options:H})})}async postToDecoder(H,i){return new Promise(e=>{this.postMessage({command:H,id:this.t,data:i}),this.h.set(this.t++,e)})}get ready(){return this.postToDecoder("ready")}async free(){await this.postToDecoder("free").finally(()=>{this.terminate()})}async reset(){await this.postToDecoder("reset")}}}}]);
//# sourceMappingURL=icecast-metadata-player-1.17.13.common.min.js.map