JuHua-web/public/js/jessibuca-pro/jessibuca-pro-talk.js

2 lines
20 KiB
JavaScript
Raw Permalink Normal View History

2024-12-09 14:12:40 +08:00
!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";class t{on(t,e,i){var s=this.e||(this.e={});return(s[t]||(s[t]=[])).push({fn:e,ctx:i}),this}once(s,r,a){const n=this;function o(){n.off(s,o);for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];r.apply(a,e)}return o._=r,this.on(s,o,a)}emit(t){for(var e=((this.e||(this.e={}))[t]||[]).slice(),i=arguments.length,s=new Array(1<i?i-1:0),r=1;r<i;r++)s[r-1]=arguments[r];for(let t=0;t<e.length;t+=1)e[t].fn.apply(e[t].ctx,s);return this}off(t,i){const e=this.e||(this.e={});if(t){var s=e[t],r=[];if(s&&i)for(let t=0,e=s.length;t<e;t+=1)s[t].fn!==i&&s[t].fn._!==i&&r.push(s[t]);return r.length?e[t]=r:delete e[t],this}Object.keys(e).forEach(t=>{delete e[t]}),delete this.e}}const r="debug",n="warn",s="talkGetUserMediaSuccess",a="talkGetUserMediaFail",e="talkGetUserMediaTimeout",o="talkStreamClose",h="talkStreamError",l="talkStreamInactive",i={talkStreamClose:o,talkStreamError:h,talkStreamInactive:l,talkGetUserMediaTimeout:e},u="open",c="g711a",d="g711u",f="rtp",p="worklet",g={encType:c,packetType:f,rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,debug:!1,debugLevel:n,testMicrophone:!1,audioBufferLength:160,engine:p,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4};var m;function k(){return(new Date).getTime()}function w(e){let i="";if("object"==typeof e)try{i=JSON.stringify(e),i=JSON.parse(i)}catch(t){i=e}else i=e;return i}(function(t){var n,e,o,i,s;n="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,o=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],i=0,s=e.length,r={};i<s;i++)if((t=e[i])&&t[1]in n){for(i=0;i<t.length;i++)r[e[0][i]]=t[i];return r}return!1}(),i={change:o.fullscreenchange,error:o.fullscreenerror},s={request:function(r,a){return new Promise(function(t,e){var i=function(){this.off("change",i),t()}.bind(this),s=(this.on("change",i),(r=r||n.documentElement)[o.requestFullscreen](a));s instanceof Promise&&s.then(i).catch(e)}.bind(this))},exit:function(){return new Promise(function(t,e){var i,s;this.isFullscreen?(i=function(){this.off("change",i),t()}.bind(this),this.on("change",i),(s=n[o.exitFullscreen]())instanceof Promise&&s.then(i).catch(e)):t()}.bind(this))},toggle:function(t,e){return this.isFullscreen?this.exit():this.request(t,e)},onchange:function(t){this.on("change",t)},onerror:function(t){this.on("error",t)},on:function(t,e){t=i[t];t&&n.addEventListener(t,e,!1)},off:function(t,e){t=i[t];t&&n.removeEventListener(t,e,!1)},raw:o},o?(Object.defineProperties(s,{isFullscreen:{get:function(){return Boolean(n[o.fullscreenElement])}},element:{enumerable:!0,get:function(){return n[o.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(n[o.fullscreenEnabled])}}}),e?t.exports=s:window.screenfull=s):e?t.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}})(m={exports:{}}),m.exports.isEnabled;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var b=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(b instanceof WebAssembly.Module)new WebAssembly.Instance(b)instanceof WebAssembly.Instance}}catch(t){}class v{constructor(t){var{fromSampleRate:t,toSampleRate:e,channels:i,inputBufferSize:s}=t;if(!t||!e||!i)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=t,this.toSampleRate=e,this.channels