{"version":3,"file":"msr_poodll.min.js","sources":["../src/msr_poodll.js"],"sourcesContent":["/* jshint ignore:start */\ndefine(['jquery',\n        'core/log', 'filter_poodll/utils_amd', 'filter_poodll/msr_stereoaudio', 'filter_poodll/msr_plain'],\n    function ($, log, utils, stereoaudiorecorder, plainrecorder) {\n\n        \"use strict\"; // jshint ;_;\n\n        log.debug('PoodLL MS Recorder: initialising');\n\n        return {\n\n            sampleRate: 48000,//44100,\n            mimeType: 'audio/wav',\n            audioChannels: 1,\n            bufferSize: 2048,\n            therecorder: null,\n            audioctx: null,\n            audioanalyser: null,\n            state: 'stopped',\n\n            //for making multiple instances\n            clone: function () {\n                return $.extend(true, {}, this);\n            },\n\n            // init the poodll recorder\n            // basically we check the users preferred recorders and if the rec supports the browser\n            init: function (mediaStream, audioctx, audioanalyser, mediaType, encoder) {\n                //we want to use the same context for absolutely everything\n                //so we pass it around. analyser should be available to skins but we set it up here\n                this.audioctx = audioctx;\n                this.audioanalyser = audioanalyser;\n\n                //this is where we choose which recorder/encoder set we will use\n                if (encoder != 'auto') {\n                    switch (encoder) {\n                        case 'stereoaudio':\n                            if (mediaType == 'audio') {\n                                this.therecorder = stereoaudiorecorder;\n                            } else {\n                                this.therecorder = plainrecorder;\n                            }\n                            break;\n                        case 'plain':\n                        default:\n                            this.therecorder = plainrecorder;\n                    }\n                    //if browser has mediarecorder, lets use it!\n                } else if (utils.has_mediarecorder()) {\n                    this.therecorder = plainrecorder;\n                    log.debug('using plain recorder');\n\n                 //we can handle audio using wav encoder, so even without mediarecorder we are ok\n                } else if (mediaType == 'audio') {\n                        this.therecorder = stereoaudiorecorder;\n                        log.debug('using stereo recorder');\n                        //before init is called, set mimeType/sampleRate/audioChannels\n                        //etc on this object, they will be picked up when stereoaudiorecorder helper runs\n                }\n                if (this.therecorder) {\n                    this.therecorder.init(this, mediaStream, audioctx, mediaType);\n                }\n\n            },\n\n            start: function (timeinterval) {\n                this.therecorder.start(timeinterval);\n                //start audio analyser which generates events for wav/freq visualisations\n                this.audioanalyser.start();\n                this.state='started';\n            },\n\n            stop: function () {\n                this.therecorder.stop();\n                this.audioanalyser.clear();\n                this.state='stopped';\n            },\n\n            pause: function () {\n                this.therecorder.pause();\n                this.audioanalyser.clear();\n                this.state='stopped';\n            },\n\n            resume: function () {\n                this.therecorder.resume();\n                this.audioanalyser.start();\n                this.state='started';\n            },\n\n            ondataavailable: function (blob) {\n                log.debug('ondataavailable:' + blob);\n            },\n\n            onStartedDrawingNonBlankFrames: function () {\n                log.debug('started drawing non blank frames:');\n            },\n\n            onstop: function (error) {\n                log.debug(error);\n            }\n        };// end of returned object\n    });// total end\n"],"names":["define","$","log","utils","stereoaudiorecorder","plainrecorder","debug","sampleRate","mimeType","audioChannels","bufferSize","therecorder","audioctx","audioanalyser","state","clone","extend","this","init","mediaStream","mediaType","encoder","has_mediarecorder","start","timeinterval","stop","clear","pause","resume","ondataavailable","blob","onStartedDrawingNonBlankFrames","onstop","error"],"mappings":"AACAA,kCAAO,CAAC,SACA,WAAY,0BAA2B,gCAAiC,4BAC5E,SAAUC,EAAGC,IAAKC,MAAOC,oBAAqBC,sBAI1CH,IAAII,MAAM,oCAEH,CAEHC,WAAY,KACZC,SAAU,YACVC,cAAe,EACfC,WAAY,KACZC,YAAa,KACbC,SAAU,KACVC,cAAe,KACfC,MAAO,UAGPC,MAAO,kBACId,EAAEe,QAAO,EAAM,GAAIC,OAK9BC,KAAM,SAAUC,YAAaP,SAAUC,cAAeO,UAAWC,iBAGxDT,SAAWA,cACXC,cAAgBA,cAGN,QAAXQ,WAES,gBADDA,aAGSV,YADQ,SAAbS,UACmBhB,oBAEAC,wBAKlBM,YAAcN,mBAGpBF,MAAMmB,0BACRX,YAAcN,cACnBH,IAAII,MAAM,yBAGU,SAAbc,iBACET,YAAcP,oBACnBF,IAAII,MAAM,0BAIdW,KAAKN,kBACAA,YAAYO,KAAKD,KAAME,YAAaP,SAAUQ,YAK3DG,MAAO,SAAUC,mBACRb,YAAYY,MAAMC,mBAElBX,cAAcU,aACdT,MAAM,WAGfW,KAAM,gBACGd,YAAYc,YACZZ,cAAca,aACdZ,MAAM,WAGfa,MAAO,gBACEhB,YAAYgB,aACZd,cAAca,aACdZ,MAAM,WAGfc,OAAQ,gBACCjB,YAAYiB,cACZf,cAAcU,aACdT,MAAM,WAGfe,gBAAiB,SAAUC,MACvB5B,IAAII,MAAM,mBAAqBwB,OAGnCC,+BAAgC,WAC5B7B,IAAII,MAAM,sCAGd0B,OAAQ,SAAUC,OACd/B,IAAII,MAAM2B"}