Telegram Web, preconfigured for usage in I2P.
http://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
5.7 KiB
1 lines
5.7 KiB
!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()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";(function(t){var o=n(2),i=function(e){var n=this,o=t.AudioContext||t.webkitAudioContext;if(!i.isRecordingSupported())throw new Error("Recording is not supported in this browser");this.state="inactive",this.eventTarget=t.document.createDocumentFragment(),this.audioContext=new o,this.monitorNode=this.audioContext.createGain(),this.config=Object.assign({bufferLength:4096,encoderApplication:2049,encoderFrameSize:20,encoderPath:"encoderWorker.min.js",encoderSampleRate:48e3,leaveStreamOpen:!1,maxBuffersPerPage:40,monitorGain:0,numberOfChannels:1,originalSampleRate:this.audioContext.sampleRate,resampleQuality:3,mediaTrackConstraints:!0,streamPages:!1,wavBitDepth:16,wavSampleRate:this.audioContext.sampleRate},e),this.initWorker(),this.setMonitorGain(this.config.monitorGain),this.scriptProcessorNode=this.audioContext.createScriptProcessor(this.config.bufferLength,this.config.numberOfChannels,this.config.numberOfChannels),this.scriptProcessorNode.onaudioprocess=function(e){n.encodeBuffers(e.inputBuffer)}};i.isRecordingSupported=function(){return(t.AudioContext||t.webkitAudioContext)&&o.isSupported},i.prototype.addEventListener=function(e,t,n){this.eventTarget.addEventListener(e,t,n)},i.prototype.clearStream=function(){this.stream&&(this.stream.getTracks?this.stream.getTracks().forEach(function(e){e.stop()}):this.stream.stop(),delete this.stream)},i.prototype.encodeBuffers=function(e){if("recording"===this.state){for(var t=[],n=0;n<e.numberOfChannels;n++)t[n]=e.getChannelData(n);this.encoder.postMessage({command:"encode",buffers:t})}},i.prototype.initStream=function(){var e=this,n=function(n){return e.stream=n,e.sourceNode=e.audioContext.createMediaStreamSource(n),e.sourceNode.connect(e.scriptProcessorNode),e.sourceNode.connect(e.monitorNode),e.eventTarget.dispatchEvent(new t.Event("streamReady")),n},i=function(n){throw e.eventTarget.dispatchEvent(new t.ErrorEvent("streamError",{error:n})),n},r={audio:this.config.mediaTrackConstraints};return this.stream?(this.eventTarget.dispatchEvent(new t.Event("streamReady")),t.Promise.resolve(this.stream)):o(r).then(n,i)},i.prototype.initWorker=function(){var e=this;this.encoder=new t.Worker(this.config.encoderPath),this.config.streamPages?this.encoder.addEventListener("message",function(t){e.streamPage(t.data)}):(this.recordedPages=[],this.totalLength=0,this.encoder.addEventListener("message",function(t){e.storePage(t.data)}))},i.prototype.pause=function(){"recording"===this.state&&(this.state="paused",this.eventTarget.dispatchEvent(new t.Event("pause")))},i.prototype.removeEventListener=function(e,t,n){this.eventTarget.removeEventListener(e,t,n)},i.prototype.resume=function(){"paused"===this.state&&(this.state="recording",this.eventTarget.dispatchEvent(new t.Event("resume")))},i.prototype.setMonitorGain=function(e){this.monitorNode.gain.setTargetAtTime(e,this.audioContext.currentTime,.01)},i.prototype.start=function(){"inactive"===this.state&&this.stream&&(this.encoder.postMessage(Object.assign({command:"init"},this.config)),this.encodeBuffers=function(){delete this.encodeBuffers},this.state="recording",this.monitorNode.connect(this.audioContext.destination),this.scriptProcessorNode.connect(this.audioContext.destination),this.eventTarget.dispatchEvent(new t.Event("start")))},i.prototype.stop=function(){"inactive"!==this.state&&(this.state="inactive",this.monitorNode.disconnect(),this.scriptProcessorNode.disconnect(),this.config.leaveStreamOpen||this.clearStream(),this.encoder.postMessage({command:"done"}))},i.prototype.storePage=function(e){if(null===e){for(var n=new Uint8Array(this.totalLength),o=0,i=0;i<this.recordedPages.length;i++)n.set(this.recordedPages[i],o),o+=this.recordedPages[i].length;this.eventTarget.dispatchEvent(new t.CustomEvent("dataAvailable",{detail:n})),this.initWorker(),this.eventTarget.dispatchEvent(new t.Event("stop"))}else this.recordedPages.push(e),this.totalLength+=e.length},i.prototype.streamPage=function(e){null===e?(this.initWorker(),this.eventTarget.dispatchEvent(new t.Event("stop"))):this.eventTarget.dispatchEvent(new t.CustomEvent("dataAvailable",{detail:e}))},e.exports=i}).call(t,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var o,i;!function(n){"use strict";function r(){this.name="NotSupportedError",this.message="getUserMedia is not implemented in this browser"}function s(){this.then=function(){return this};var e=new r;this.catch=function(t){setTimeout(function(){t(e)})}}function a(e){return c?u?navigator.mediaDevices.getUserMedia(e):new Promise(function(t,n){if(!h)return n(new r);h.call(navigator,e,t,n)}):new s}r.prototype=Error.prototype;var c="undefined"!=typeof Promise,d="undefined"!=typeof navigator,u=d&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,h=d&&(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia);a.NotSupportedError=r,a.isSupported=!(!c||!u&&!h),o=[],void 0!==(i=function(){return a}.apply(t,o))&&(e.exports=i)}()}])});
|
|
|