mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 12:55:11 +01:00
1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
{"version":3,"sources":["webpack:///./node_modules/opus-recorder/dist/recorder.min.js"],"names":["self","module","exports","e","t","o","i","n","l","call","m","c","d","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","__esModule","create","bind","default","prototype","hasOwnProperty","p","s","AudioContext","webkitAudioContext","isRecordingSupported","Error","this","state","config","assign","bufferLength","encoderApplication","encoderFrameSize","encoderPath","encoderSampleRate","maxFramesPerPage","mediaTrackConstraints","monitorGain","numberOfChannels","recordingGain","resampleQuality","streamPages","reuseWorker","wavBitDepth","encodedSamplePosition","navigator","mediaDevices","getUserMedia","WebAssembly","clearStream","stream","getTracks","forEach","stop","audioContext","closeAudioContext","close","encodeBuffers","getChannelData","encoder","postMessage","command","buffers","initAudioContext","context","initAudioGraph","scriptProcessorNode","createScriptProcessor","connect","destination","onaudioprocess","inputBuffer","monitorGainNode","createGain","setMonitorGain","recordingGainNode","setRecordingGain","initSourceNode","Promise","resolve","audio","then","createMediaStreamSource","loadWorker","Worker","initWorker","streamPage","storePage","recordedPages","totalLength","data","message","samplePosition","page","removeEventListener","finish","addEventListener","originalSampleRate","sampleRate","wavSampleRate","pause","onpause","resume","onresume","gain","setTargetAtTime","currentTime","start","all","sourceNode","onstart","disconnect","destroyWorker","push","length","ondataavailable","Uint8Array","reduce","set","onstop","Function","window"],"mappings":"8EAAqM,oBAAoBA,MAAKA,KAA7JC,EAAOC,QAAmL,SAASC,GAAG,IAAIC,EAAE,GAAG,SAASC,EAAEC,GAAG,GAAGF,EAAEE,GAAG,OAAOF,EAAEE,GAAGJ,QAAQ,IAAIK,EAAEH,EAAEE,GAAG,CAACA,EAAEA,EAAEE,GAAE,EAAGN,QAAQ,IAAI,OAAOC,EAAEG,GAAGG,KAAKF,EAAEL,QAAQK,EAAEA,EAAEL,QAAQG,GAAGE,EAAEC,GAAE,EAAGD,EAAEL,QA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,EAAE,IAAIwH,WAAW1F,KAAK+D,aAAa/D,KAAK8D,cAAc6B,QAAO,SAAUxH,EAAEC,GAAG,OAAOF,EAAE0H,IAAIxH,EAAED,GAAGA,EAAEC,EAAEoH,SAAS,GAAGxF,KAAKyF,gBAAgBvH,GAAG8B,KAAK6F,SAAS7F,KAAKE,OAAOc,oBAAoBhB,KAAKiC,SAAS5D,EAAEmB,UAAUiG,gBAAgB,aAAapH,EAAEmB,UAAUmF,QAAQ,aAAatG,EAAEmB,UAAUqF,SAAS,aAAaxG,EAAEmB,UAAU4F,QAAQ,aAAa/G,EAAEmB,UAAUqG,OAAO,aAAa3H,EAAED,QAAQI,IAAIG,KAAKwB,KAAK5B,EAAE,KAAK,SAASF,EAAEC,GAAG,IAAIC,EAAEA,EAAE,WAAW,OAAO4B,KAAlB,GAA0B,IAAI5B,EAAEA,GAAG,IAAI0H,SAAS,cAAb,GAA8B,MAAM5H,GAAG,iBAAiB6H,SAAS3H,EAAE2H,QAAQ7H,EAAED,QAAQG","file":"10.bd5435d947f7c8aea0ee.js","sourcesContent":["!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports.Recorder=t():e.Recorder=t()}(\"undefined\"!=typeof self?self:this,(function(){return function(e){var t={};function o(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var n in e)o.d(i,n,function(t){return e[t]}.bind(null,n));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,\"a\",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p=\"\",o(o.s=0)}([function(e,t,o){\"use strict\";(function(t){var o=t.AudioContext||t.webkitAudioContext,i=function(e){if(!i.isRecordingSupported())throw new Error(\"Recording is not supported in this browser\");e||(e={}),this.state=\"inactive\",this.config=Object.assign({bufferLength:4096,encoderApplication:2049,encoderFrameSize:20,encoderPath:\"encoderWorker.min.js\",encoderSampleRate:48e3,maxFramesPerPage:40,mediaTrackConstraints:!0,monitorGain:0,numberOfChannels:1,recordingGain:1,resampleQuality:3,streamPages:!1,reuseWorker:!1,wavBitDepth:16},e),this.encodedSamplePosition=0};i.isRecordingSupported=function(){return o&&t.navigator&&t.navigator.mediaDevices&&t.navigator.mediaDevices.getUserMedia&&t.WebAssembly},i.prototype.clearStream=function(){this.stream&&(this.stream.getTracks?this.stream.getTracks().forEach((function(e){e.stop()})):this.stream.stop(),delete this.stream),this.audioContext&&this.closeAudioContext&&(this.audioContext.close(),delete this.audioContext)},i.prototype.encodeBuffers=function(e){if(\"recording\"===this.state){for(var t=[],o=0;o<e.numberOfChannels;o++)t[o]=e.getChannelData(o);this.encoder.postMessage({command:\"encode\",buffers:t})}},i.prototype.initAudioContext=function(e){return e&&e.context?(this.audioContext=e.context,this.closeAudioContext=!1):(this.audioContext=new o,this.closeAudioContext=!0),this.audioContext},i.prototype.initAudioGraph=function(){this.encodeBuffers=function(){delete this.encodeBuffers},this.scriptProcessorNode=this.audioContext.createScriptProcessor(this.config.bufferLength,this.config.numberOfChannels,this.config.numberOfChannels),this.scriptProcessorNode.connect(this.audioContext.destination),this.scriptProcessorNode.onaudioprocess=e=>{this.encodeBuffers(e.inputBuffer)},this.monitorGainNode=this.audioContext.createGain(),this.setMonitorGain(this.config.monitorGain),this.monitorGainNode.connect(this.audioContext.destination),this.recordingGainNode=this.audioContext.createGain(),this.setRecordingGain(this.config.recordingGain),this.recordingGainNode.connect(this.scriptProcessorNode)},i.prototype.initSourceNode=function(e){return e&&e.context?t.Promise.resolve(e):t.navigator.mediaDevices.getUserMedia({audio:this.config.mediaTrackConstraints}).then(e=>(this.stream=e,this.audioContext.createMediaStreamSource(e)))},i.prototype.loadWorker=function(){this.encoder||(this.encoder=new t.Worker(this.config.encoderPath))},i.prototype.initWorker=function(){var e=(this.config.streamPages?this.streamPage:this.storePage).bind(this);return this.recordedPages=[],this.totalLength=0,this.loadWorker(),new Promise((t,o)=>{var i=o=>{switch(o.data.message){case\"ready\":t();break;case\"page\":this.encodedSamplePosition=o.data.samplePosition,e(o.data.page);break;case\"done\":this.encoder.removeEventListener(\"message\",i),this.finish()}};this.encoder.addEventListener(\"message\",i),this.encoder.postMessage(Object.assign({command:\"init\",originalSampleRate:this.audioContext.sampleRate,wavSampleRate:this.audioContext.sampleRate},this.config))})},i.prototype.pause=function(e){if(\"recording\"===this.state){if(this.state=\"paused\",e&&this.config.streamPages){var t=this.encoder;return new Promise((e,o)=>{var i=o=>{\"flushed\"===o.data.message&&(t.removeEventListener(\"message\",i),this.onpause(),e())};t.addEventListener(\"message\",i),t.postMessage({command:\"flush\"})})}return this.onpause(),Promise.resolve()}},i.prototype.resume=function(){\"paused\"===this.state&&(this.state=\"recording\",this.onresume())},i.prototype.setRecordingGain=function(e){this.config.recordingGain=e,this.recordingGainNode&&this.audioContext&&this.recordingGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01)},i.prototype.setMonitorGain=function(e){this.config.monitorGain=e,this.monitorGainNode&&this.audioContext&&this.monitorGainNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01)},i.prototype.start=function(e){if(\"inactive\"===this.state)return this.initAudioContext(e),this.initAudioGraph(),this.encodedSamplePosition=0,Promise.all([this.initSourceNode(e),this.initWorker()]).then(e=>{this.sourceNode=e[0],this.state=\"recording\",this.onstart(),this.encoder.postMessage({command:\"getHeaderPages\"}),this.sourceNode.connect(this.monitorGainNode),this.sourceNode.connect(this.recordingGainNode)})},i.prototype.stop=function(){if(\"inactive\"!==this.state){this.state=\"inactive\",this.monitorGainNode.disconnect(),this.scriptProcessorNode.disconnect(),this.recordingGainNode.disconnect(),this.sourceNode.disconnect(),this.clearStream();var e=this.encoder;return new Promise(t=>{var o=i=>{\"done\"===i.data.message&&(e.removeEventListener(\"message\",o),t())};e.addEventListener(\"message\",o),e.postMessage({command:\"done\"}),this.config.reuseWorker||e.postMessage({command:\"close\"})})}return Promise.resolve()},i.prototype.destroyWorker=function(){\"inactive\"===this.state&&this.encoder&&(this.encoder.postMessage({command:\"close\"}),delete this.encoder)},i.prototype.storePage=function(e){this.recordedPages.push(e),this.totalLength+=e.length},i.prototype.streamPage=function(e){this.ondataavailable(e)},i.prototype.finish=function(){if(!this.config.streamPages){var e=new Uint8Array(this.totalLength);this.recordedPages.reduce((function(t,o){return e.set(o,t),t+o.length}),0),this.ondataavailable(e)}this.onstop(),this.config.reuseWorker||delete this.encoder},i.prototype.ondataavailable=function(){},i.prototype.onpause=function(){},i.prototype.onresume=function(){},i.prototype.onstart=function(){},i.prototype.onstop=function(){},e.exports=i}).call(this,o(1))},function(e,t){var o;o=function(){return this}();try{o=o||new Function(\"return this\")()}catch(e){\"object\"==typeof window&&(o=window)}e.exports=o}])}));"],"sourceRoot":""} |