text: (this["webpackJsonpvoicerecorder-example"]=this["webpackJsonpvoicerecorder-example"]||[]).push([[0],{10:function(e,t,o){"use strict";o.r(t);var r=o(0),n=o.n(r),i=o(2),a=o.n(i),c=o(1);"undefined"!==typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!==typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var s=function(e,t,o){var r=this,n=this;this.setUpRecorder=function(){try{navigator.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.webkitGetUserMedia;var e=function(){if(navigator.getUserMedia&&window.MediaRecorder){var e=function(e,t){try{var o=e()}catch(r){return t(r)}return o&&o.then?o.then(void 0,t):o}((function(){return Promise.resolve(navigator.mediaDevices.getUserMedia({audio:n.constraints})).then((function(e){n.mediaRecorder=new window.MediaRecorder(e,n.options),n.mediaRecorder.ondataavailable=function(e){n.chunks.push(e.data)},n.mediaRecorder.onstop=n.onStop}))}),(function(){window.alert("Microphone access Blocked")}));if(e&&e.then)return e.then((function(){}))}else window.alert("Audio recording APIs not supported by this browser")}();return Promise.resolve(e&&e.then?e.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},this.startRecording=function(){r.mediaRecorder&&r.mediaRecorder.start()},this.stopRecording=function(){r.mediaRecorder&&"inactive"!==r.mediaRecorder.state&&r.mediaRecorder.stop()},this.onStop=function(){var e=new window.Blob(this.chunks,{type:"audio/webm"});this.upload(e),this.chunks=[]},this.constraints=e,this.options=t,this.upload=o},d=function(e){var t,o;function r(){for(var t,o=arguments.length,r=new Array(o),n=0;n<o;n++)r[n]=arguments[n];return(t=e.call.apply(e,[this].concat(r))||this).componentDidMount=function(){try{var e=t.props,o=e.audioUpload,r=e.constraints,n=e.options;return t.recorder=new s(r,n,o),Promise.resolve(t.recorder.setUpRecorder()).then((function(){}))}catch(i){return Promise.reject(i)}},t.componentDidUpdate=function(){t.props.status?t.recorder.startRecording():t.recorder.stopRecording()},t}return o=e,(t=r).prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o,r.prototype.render=function(){return null},r}(n.a.Component),u=function(){var e=Object(r.useState)(!1),t=Object(c.a)(e,2),o=t[0],i=t[1],a=Object(r.useState)(""),s=Object(c.a)(a,2),u=s[0],p=s[1];return n.a.createElement("div",null,n.a.createElement(d,{options:{audioBitsPerSecond:128e3},constraints:{echoCancellation:!0,noiseSuppression:!0,sampleRate:44100},audioUpload:function(e){p(URL.createObjectURL(e))},status:o}),o?n.a.createElement("button",{onClick:function(){return i(!1)}},"STOP"):n.a.createElement("button",{onClick:function(){return i(!0)}},"START"),n.a.createElement("audio",{src:u,controls:"controls"}))};a.a.render(n.a.createElement(u,null),document.getElementById("root"))},3:function(e,t,o){e.exports=o(10)}},[[3,1,2]]]);
  //# sourceMappingURL=main.9f0d22dd.chunk.js.map