text: function MediaStreamRecorder(e){if(!e)throw"MediaStream is mandatory.";this.start=function(i){var o=IsChrome?window.StereoRecorder:window.MediaRecorderWrapper;-1!=this.mimeType.indexOf("video")&&(o=IsChrome?window.WhammyRecorder:window.MediaRecorderWrapper),"image/gif"===this.mimeType&&(o=window.GifRecorder),t=new o(e),t.ondataavailable=this.ondataavailable,t.onstop=this.onstop,t.onStartedDrawingNonBlankFrames=this.onStartedDrawingNonBlankFrames,t=mergeProps(t,this),t.start(i)},this.onStartedDrawingNonBlankFrames=function(){},this.clearOldRecordedFrames=function(){t&&t.clearOldRecordedFrames()},this.stop=function(){t&&t.stop()},this.ondataavailable=function(e){console.log("ondataavailable..",e)},this.onstop=function(e){console.warn("stopped..",e)};var t}function loadScript(e,t){var i=window.MediaStreamRecorderScriptsDir,o=document.createElement("script");o.src=i+e,o.onload=t||function(){},document.documentElement.appendChild(o)}function mergeProps(e,t){t=reformatProps(t);for(var i in t)"function"!=typeof t[i]&&(e[i]=t[i]);return e}function reformatProps(e){var t={};for(var i in e)if(-1!=i.indexOf("-")){var o=i.split("-"),a=o[0]+o[1].split("")[0].toUpperCase()+o[1].substr(1);t[a]=e[i]}else t[i]=e[i];return t}function MediaRecorderWrapper(e){if("audio"==this.type&&e.getVideoTracks&&e.getVideoTracks().length&&!navigator.mozGetUserMedia){var t=new AudioContext,i=t.createMediaStreamSource(e),o=t.createMediaStreamDestination();i.connect(o),e=o.stream}this.start=function(t){function i(){a||(n=new MediaRecorder(e),n.ondataavailable=function(e){if(console.log("ondataavailable",e.data.type,e.data.size,e.data),!e.data.size)return void console.warn("Recording of",e.data.type,"failed.");var t=new window.Blob([e.data],{type:e.data.type||r.mimeType||"audio/ogg"});r.ondataavailable(t)},n.onstop=function(){},n.onerror=function(e){console.error(e),r.start(t)},n.onwarning=function(e){console.warn(e)},n.start(0),setTimeout(function(){n.stop(),i()},t))}t=t||1e3,a=!1,i()};var a=!1;this.stop=function(){a=!0,r.onstop&&r.onstop({})},this.ondataavailable=this.onstop=function(){};var r=this;!r.mimeType&&e.getAudioTracks&&(r.mimeType=e.getAudioTracks().length&&e.getVideoTracks().length?"video/webm":"audio/ogg");var n}function StereoRecorder(e){this.start=function(o){o=o||1e3,t=new StereoAudioRecorder(e,this),t.record(),i=setInterval(function(){t.requestData()},o)},this.stop=function(){t&&(t.stop(),clearTimeout(i))},this.ondataavailable=function(){};var t,i}function StereoAudioRecorder(e,t){function i(e,t){for(var i=e.length+t.length,o=new Float32Array(i),a=0,r=0;i>r;)o[r++]=e[a],o[r++]=t[a],a++;return o}function o(e,t){for(var i=new Float32Array(t),o=0,a=e.length,r=0;a>r;r++){var n=e[r];i.set(n,o),o+=n.length}return i}function a(e,t,i){for(var o=i.length,a=0;o>a;a++)e.setUint8(t+a,i.charCodeAt(a))}var r,n,d,s,c,u=[],h=[],l=!1,f=0,g=t.sampleRate||44100,v=t.audioChannels||2;this.record=function(){l=!0,u.length=h.length=0,f=0},this.requestData=function(){if(0==f)return void(w=!1);w=!0;var e=u.slice(0),r=(h.slice(0),f);u.length=h.length=[],f=0,w=!1;var n=o(e,r),d=o(e,r);if(2===v)var s=i(n,d);else var s=n;var c=new ArrayBuffer(44+2*s.length),l=new DataView(c);a(l,0,"RIFF"),l.setUint32(4,44+2*s.length,!0),a(l,8,"WAVE"),a(l,12,"fmt "),l.setUint32(16,16,!0),l.setUint16(20,1,!0),l.setUint16(22,v,!0),l.setUint32(24,g,!0),l.setUint32(28,4*g,!0),l.setUint16(32,2*v,!0),l.setUint16(34,16,!0),a(l,36,"data"),l.setUint32(40,2*s.length,!0);for(var m=s.length,p=44,b=1,R=0;m>R;R++)l.setInt16(p,32767*s[R]*b,!0),p+=2;var y=new Blob([l],{type:"audio/wav"});console.debug("audio recorded blob size:",bytesToSize(y.size)),t.ondataavailable(y)},this.stop=function(){l=!1,this.requestData()};var s=ObjectStore.AudioContext;ObjectStore.AudioContextConstructor||(ObjectStore.AudioContextConstructor=new s);var c=ObjectStore.AudioContextConstructor;ObjectStore.VolumeGainNode||(ObjectStore.VolumeGainNode=c.createGain());var n=ObjectStore.VolumeGainNode;ObjectStore.AudioInput||(ObjectStore.AudioInput=c.createMediaStreamSource(e));var d=ObjectStore.AudioInput;d.connect(n);var m=t.bufferSize||2048;if(0==t.bufferSize&&(m=0),c.createJavaScriptNode)r=c.createJavaScriptNode(m,v,v);else{if(!c.createScriptProcessor)throw"WebAudio API has no support on this browser.";r=c.createScriptProcessor(m,v,v)}m=r.bufferSize,console.debug("using audio buffer-size:",m);var w=!1;window.scriptprocessornode=r,1==v&&console.debug("All right-channels are skipped."),r.onaudioprocess=function(e){if(l&&!w){var t=e.inputBuffer.getChannelData(0);if(u.push(new Float32Array(t)),2==v){var i=e.inputBuffer.getChannelData(1);h.push(new Float32Array(i))}f+=m}},n.connect(r),r.connect(c.destination)}function WhammyRecorderHelper(e,t){function i(){if(!s){if(r)return setTimeout(i,100);var e=(new Date).getTime()-u;if(!e)return i();u=(new Date).getTime(),f.drawImage(c,0,0,l.width,l.height),!s&&n.push({duration:e,image:l.toDataURL("image/webp")}),d||o(n[n.length-1])||(d=!0,t.onStartedDrawingNonBlankFrames()),setTimeout(i,10)}}function o(e,t,i){var o=document.createElement("canvas");o.width=l.width,o.height=l.height;var a,r,n,d=o.getContext("2d"),s={r:0,g:0,b:0},c=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),u=t&&t>=0&&1>=t?t:0,h=i&&i>=0&&1>=i?i:0,f=new Image;f.src=e.image,d.drawImage(f,0,0,l.width,l.height);var g=d.getImageData(0,0,l.width,l.height);a=0,r=g.data.length,n=g.data.length/4;for(var v=0;r>v;v+=4){var m={r:g.data[v],g:g.data[v+1],b:g.data[v+2]},w=Math.sqrt(Math.pow(m.r-s.r,2)+Math.pow(m.g-s.g,2)+Math.pow(m.b-s.b,2));c*u>=w&&a++}return n*h>=n-a?!1:!0}function a(e,t,i,o){var a=document.createElement("canvas");a.width=l.width,a.height=l.height;for(var r=a.getContext("2d"),n=[],d=-1===t,s=t&&t>0&&t<=e.length?t:e.length,c={r:0,g:0,b:0},u=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),h=i&&i>=0&&1>=i?i:0,f=o&&o>=0&&1>=o?o:0,g=!1,v=0;s>v;v++){var m,w,p;if(!g){var b=new Image;b.src=e[v].image,r.drawImage(b,0,0,l.width,l.height);var R=r.getImageData(0,0,l.width,l.height);m=0,w=R.data.length,p=R.data.length/4;for(var y=0;w>y;y+=4){var S={r:R.data[y],g:R.data[y+1],b:R.data[y+2]},A=Math.sqrt(Math.pow(S.r-c.r,2)+Math.pow(S.g-c.g,2)+Math.pow(S.b-c.b,2));u*h>=A&&m++}}!g&&p*f>=p-m||(d&&(g=!0),n.push(e[v]))}return n=n.concat(e.slice(s)),n.length<=0&&n.push(e[e.length-1]),n}this.record=function(){this.width||(this.width=320),this.height||(this.height=240),this.video&&this.video instanceof HTMLVideoElement&&(this.width||(this.width=c.videoWidth||c.clientWidth||320),this.height||(this.height=c.videoHeight||c.clientHeight||240)),this.video||(this.video={width:this.width,height:this.height}),this.canvas&&this.canvas.width&&this.canvas.height||(this.canvas={width:this.width,height:this.height}),l.width=this.canvas.width,l.height=this.canvas.height,this.video&&this.video instanceof HTMLVideoElement?c=this.video.cloneNode():(c=document.createElement("video"),c.src=URL.createObjectURL(e),c.width=this.video.width,c.height=this.video.height),c.muted=!0,c.play(),u=(new Date).getTime(),h=new Whammy.Video,console.log("canvas resolutions",l.width,"*",l.height),console.log("video width/height",c.width||l.width,"*",c.height||l.height),i()},this.clearOldRecordedFrames=function(){n=[]};var r=!1;this.requestData=function(){if(!n.length)return void(r=!1);r=!0;var e=n.slice(0);n=[],h.frames=a(e,-1);var i=h.compile();t.ondataavailable(i),console.debug("video recorded blob size:",bytesToSize(i.size)),r=!1};var n=[],d=!1,s=!1;this.stop=function(){s=!0,this.requestData()};var c,u,h,l=document.createElement("canvas"),f=l.getContext("2d")}function WhammyRecorder(e){this.start=function(o){o=o||1e3,t=new WhammyRecorderHelper(e,this);for(var a in this)"function"!=typeof this[a]&&(t[a]=this[a]);t.record(),i=setInterval(function(){t.requestData()},o)},this.stop=function(){t&&(t.stop(),clearTimeout(i))},this.clearOldRecordedFrames=function(){t&&t.clearOldRecordedFrames()},this.ondataavailable=function(){};var t,i}function GifRecorder(e){function t(){d=Date.now();var e=new Blob([new Uint8Array(c.stream().bin)],{type:"image/gif"});i.ondataavailable(e),c.stream().bin=[]}if(!window.GIFEncoder)throw"Please link: https://cdn.webrtc-experiment.com/gif-recorder.js";this.start=function(e){function i(e){h=requestAnimationFrame(i),void 0===typeof s&&(s=e),90>e-s||(a.drawImage(r,0,0,d,l),c.addFrame(a),s=e)}e=e||1e3;var d=this.videoWidth||320,l=this.videoHeight||240;o.width=r.width=d,o.height=r.height=l,c=new GIFEncoder,c.setRepeat(0),c.setDelay(this.frameRate||200),c.setQuality(this.quality||1),c.start(),n=Date.now(),h=requestAnimationFrame(i),u=setTimeout(t,e)},this.stop=function(){h&&(cancelAnimationFrame(h),clearTimeout(u),t())},this.ondataavailable=function(){},this.onstop=function(){};var i=this,o=document.createElement("canvas"),a=o.getContext("2d"),r=document.createElement("video");r.muted=!0,r.autoplay=!0,r.src=URL.createObjectURL(e),r.play();var n,d,s,c,u,h=null}function MultiStreamRecorder(e){if(!e)throw"MediaStream is mandatory.";var t=this,i=!!navigator.mozGetUserMedia;this.stream=e,this.start=function(d){function s(e){n++,t.ondataavailable(e)}o=new MediaStreamRecorder(e),a=new MediaStreamRecorder(e),o.mimeType="audio/ogg",a.mimeType="video/webm";for(var c in this)"function"!=typeof this[c]&&(o[c]=a[c]=this[c]);o.ondataavailable=function(e){r[n]||(r[n]={}),r[n].audio=e,r[n].video&&!r[n].onDataAvailableEventFired&&(r[n].onDataAvailableEventFired=!0,s(r[n]))},a.ondataavailable=function(e){return i?t.ondataavailable({video:e,audio:e}):(r[n]||(r[n]={}),r[n].video=e,void(r[n].audio&&!r[n].onDataAvailableEventFired&&(r[n].onDataAvailableEventFired=!0,s(r[n]))))},a.onstop=o.onstop=function(e){t.onstop(e)},i?a.start(d):(a.onStartedDrawingNonBlankFrames=function(){a.clearOldRecordedFrames(),o.start(d)},a.start(d))},this.stop=function(){o&&o.stop(),a&&a.stop()},this.ondataavailable=function(e){console.log("ondataavailable..",e)},this.onstop=function(e){console.warn("stopped..",e)};var o,a,r={},n=0}function bytesToSize(e){var t=1e3,i=["Bytes","KB","MB","GB","TB"];if(0===e)return"0 Bytes";var o=parseInt(Math.floor(Math.log(e)/Math.log(t)),10);return(e/Math.pow(t,o)).toPrecision(3)+" "+i[o]}function RecordRTC(e,t){function i(){t.disableLogs||console.debug("started recording "+t.type+" stream.");var i=isChrome?window.StereoRecorder:window.MediaStreamRecorder;return"video"===t.type&&isChrome&&(i=window.WhammyRecorder),"gif"===t.type&&(i=window.GifRecorder),"canvas"===t.type&&(i=window.CanvasRecorder),t.recorderType&&(i=t.recorderType),d=new i(e),d=mergeProps(d,t),d.onAudioProcessStarted=function(){t.onAudioProcessStarted&&t.onAudioProcessStarted()},d.onGifPreview=function(e){t.onGifPreview&&t.onGifPreview(e)},d.record(),s}function o(e){function i(){for(var i in d)s&&(s[i]=d[i]),o&&(o[i]=d[i]);var a=d.blob;if(e){var r=URL.createObjectURL(a);e(r)}a&&!t.disableLogs&&console.debug(a.type,"->",bytesToSize(a.size)),t.autoWriteToDisk&&n(function(e){var i={};i[t.type+"Blob"]=e,DiskStorage.Store(i)})}if(!d)return console.warn(c);var o=this;t.disableLogs||console.warn("Stopped recording "+t.type+" stream."),"gif"!==t.type?d.stop(i):(d.stop(),i())}function a(){return d?void(d.pause?d.pause():t.disableLogs||console.warn('This recording library is having no "pause" method.')):console.warn(c)}function r(){return d?void(d.resume?d.resume():t.disableLogs||console.warn('This recording library is having no "resume" method.')):console.warn(c)}function n(e,i){function o(e){var t=URL.createObjectURL(new Blob([e.toString(),"this.onmessage =  function (e) {readFile(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return URL.revokeObjectURL(t),i}if(!e)throw"Pass a callback function over getDataURL.";var a=i?i.blob:d.blob;if(!a)return t.disableLogs||console.warn("Blob encoder did not yet finished its job."),void setTimeout(function(){n(e,i)},1e3);if(window.Worker){var r=o(function(e){postMessage((new FileReaderSync).readAsDataURL(e))});r.onmessage=function(t){e(t.data)},r.postMessage(a)}else{var s=new FileReader;s.readAsDataURL(a),s.onload=function(t){e(t.target.result)}}}if(t=t||{},!e)throw"MediaStream is mandatory.";t.type||(t.type="audio");var d,s=this,c='It seems that "startRecording" is not invoked for '+t.type+" recorder.",u={startRecording:i,stopRecording:o,pauseRecording:a,resumeRecording:r,getBlob:function(){return d?d.blob:console.warn(c)},getDataURL:n,toURL:function(){return d?URL.createObjectURL(d.blob):console.warn(c)},save:function(e){if(!d){var t=this;return setTimeout(function(){t.save(e)},2e3),console.warn(c)}var i=document.createElement("a");i.href=URL.createObjectURL(d.blob),i.target="_blank",i.download=(e||Math.round(9999999999*Math.random())+888888888)+"."+d.blob.type.split("/")[1];var o=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});i.dispatchEvent(o),(window.URL||window.webkitURL).revokeObjectURL(i.href)},getFromDisk:function(e){return d?void RecordRTC.getFromDisk(t.type,e):console.warn(c)},setAdvertisementArray:function(e){this.advertisement=[];for(var t=e.length,i=0;t>i;i++)this.advertisement.push({duration:i,image:e[i]})},blob:null,bufferSize:0,sampleRate:0,buffer:null,view:null};if(!this)return u;for(var h in u)this[h]=u[h];return u}function MRecordRTC(e){this.addStream=function(t){t&&(e=t)},this.mediaType={audio:!0,video:!0},this.startRecording=function(){!isChrome&&e&&e.getAudioTracks&&e.getAudioTracks().length&&e.getVideoTracks().length&&(this.mediaType.audio=!1),this.mediaType.audio&&(this.audioRecorder=new RecordRTC(e,{type:"audio",bufferSize:this.bufferSize,sampleRate:this.sampleRate}),this.audioRecorder.startRecording()),this.mediaType.video&&(this.videoRecorder=new RecordRTC(e,{type:"video",video:this.video,canvas:this.canvas}),this.videoRecorder.startRecording()),this.mediaType.gif&&(this.gifRecorder=new RecordRTC(e,{type:"gif",frameRate:this.frameRate||200,quality:this.quality||10}),this.gifRecorder.startRecording())},this.stopRecording=function(e){e=e||function(){},this.audioRecorder&&this.audioRecorder.stopRecording(function(t){e(t,"audio")}),this.videoRecorder&&this.videoRecorder.stopRecording(function(t){e(t,"video")}),this.gifRecorder&&this.gifRecorder.stopRecording(function(t){e(t,"gif")})},this.getBlob=function(e){var t={};this.audioRecorder&&(t.audio=this.audioRecorder.getBlob()),this.videoRecorder&&(t.video=this.videoRecorder.getBlob()),this.gifRecorder&&(t.gif=this.gifRecorder.getBlob()),e&&e(t)},this.getDataURL=function(e){function t(e,t){if(window.Worker){var o=i(function(e){postMessage((new FileReaderSync).readAsDataURL(e))});o.onmessage=function(e){t(e.data)},o.postMessage(e)}else{var a=new FileReader;a.readAsDataURL(e),a.onload=function(e){t(e.target.result)}}}function i(e){var t=URL.createObjectURL(new Blob([e.toString(),"this.onmessage =  function (e) {readFile(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return URL.revokeObjectURL(t),i}this.getBlob(function(i){t(i.audio,function(o){t(i.video,function(t){e({audio:o,video:t})})})})},this.writeToDisk=function(){RecordRTC.writeToDisk({audio:this.audioRecorder,video:this.videoRecorder,gif:this.gifRecorder})},this.save=function(e){e=e||{audio:!0,video:!0,gif:!0},e.audio&&this.audioRecorder&&this.audioRecorder.save("string"==typeof e.audio?e.audio:""),e.video&&this.videoRecorder&&this.videoRecorder.save("string"==typeof e.video?e.video:""),e.gif&&this.gifRecorder&&this.gifRecorder.save("string"==typeof e.gif?e.gif:"")}}function mergeProps(e,t){t=reformatProps(t);for(var i in t)"function"!=typeof t[i]&&(e[i]=t[i]);return e}function reformatProps(e){var t={};for(var i in e)if(-1!==i.indexOf("-")){var o=i.split("-"),a=o[0]+o[1].split("")[0].toUpperCase()+o[1].substr(1);t[a]=e[i]}else t[i]=e[i];return t}function bytesToSize(e){var t=1e3,i=["Bytes","KB","MB","GB","TB"];if(0===e)return"0 Bytes";var o=parseInt(Math.floor(Math.log(e)/Math.log(t)),10);return(e/Math.pow(t,o)).toPrecision(3)+" "+i[o]}function MediaStreamRecorder(e){var t=this;if(t.mimeType&&"video/webm"!==t.mimeType&&e.getVideoTracks&&e.getVideoTracks().length){var i=new AudioContext,o=i.createMediaStreamSource(e),a=i.createMediaStreamDestination();o.connect(a),e=a.stream}var r=!1;this.record=function(){n=new window.MediaRecorder(e),n.ondataavailable=function(e){if(!r){if(!e.data.size)return void(t.disableLogs||console.warn("Recording of",e.data.type,"failed."));r=!0,t.blob=new Blob([e.data],{type:e.data.type||t.mimeType||"audio/ogg"}),t.callback&&t.callback()}},n.onerror=function(e){t.disableLogs||console.warn(e),n.stop(),t.record(0)},n.start(0),t.onAudioProcessStarted&&t.onAudioProcessStarted()},this.stop=function(e){n&&(this.callback=e,"recording"===n.state&&n.stop())},this.pause=function(){n&&"recording"===n.state&&(n.pause(),this.disableLogs||console.debug("Paused recording."))},this.resume=function(){n&&"paused"===n.state&&(n.resume(),this.disableLogs||console.debug("Resumed recording."))};var n}function StereoRecorder(e){var t=this;this.record=function(){i=new StereoAudioRecorder(e,this),i.onAudioProcessStarted=function(){t.onAudioProcessStarted&&t.onAudioProcessStarted()},i.record()},this.stop=function(e){i&&i.stop(function(){for(var o in i)t[o]=i[o];e&&e()})},this.pause=function(){i&&i.pause()},this.resume=function(){i&&i.resume()};var i}function StereoAudioRecorder(e,t){function i(e,t){function i(e){function t(e,t){for(var i=new Float64Array(t),o=0,a=e.length,r=0;a>r;r++){var n=e[r];i.set(n,o),o+=n.length}return i}function i(e,t){for(var i=e.length+t.length,o=new Float64Array(i),a=0,r=0;i>r;)o[r++]=e[a],o[r++]=t[a],a++;return o}function o(e,t,i){for(var o=i.length,a=0;o>a;a++)e.setUint8(t+a,i.charCodeAt(a))}var a=e.leftBuffers,r=e.rightBuffers,n=e.sampleRate;a=t(a[0],a[1]),r=t(r[0],r[1]);var d=i(a,r),s=d.length,c=44+2*s,u=new ArrayBuffer(c),h=new DataView(u);o(h,0,"RIFF");var l=4;h.setUint32(l,44+2*s,!0),o(h,8,"WAVE"),o(h,12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,2,!0),h.setUint32(24,n,!0),h.setUint32(28,n*l,!0),h.setUint16(32,l,!0),h.setUint16(34,16,!0),o(h,36,"data"),h.setUint32(40,2*s,!0);for(var f,g=44,v=0;s>v;v++,g+=2){var m=Math.max(-1,Math.min(1,d[v])),w=0>m?32768*m:32767*m;e.leftChannel?(w!==f&&h.setInt16(g,w,!0),f=w):h.setInt16(g,w,!0)}postMessage({buffer:u,view:h})}var a=o(i);a.onmessage=function(e){t(e.data.buffer,e.data.view)},a.postMessage(e)}function o(e){var t=URL.createObjectURL(new Blob([e.toString(),"this.onmessage =  function (e) {"+e.name+"(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return URL.revokeObjectURL(t),i}if(!e.getAudioTracks().length)throw"Your stream has no audio tracks.";var a=this,r=[],n=[],d=!1,s=0;this.record=function(){r.length=n.length=0,s=0,d=!0},this.stop=function(e){d=!1,u.disconnect(),i({sampleRate:f,leftChannel:t.leftChannel,leftBuffers:[r,s],rightBuffers:[n,s]},function(t,i){a.blob=new Blob([i],{type:"audio/wav"}),a.buffer=new ArrayBuffer(i),a.view=i,a.sampleRate=f,a.bufferSize=l,a.length=s,e&&e(),v=!1})},Storage.AudioContextConstructor||(Storage.AudioContextConstructor=new Storage.AudioContext);var c=Storage.AudioContextConstructor,u=c.createMediaStreamSource(e),h=[0,256,512,1024,2048,4096,8192,16384],l="undefined"==typeof t.bufferSize?4096:t.bufferSize;-1===h.indexOf(l)&&(t.disableLogs||console.warn("Legal values for buffer-size are "+JSON.stringify(h,null,"	")));var f="undefined"!=typeof t.sampleRate?t.sampleRate:c.sampleRate||44100;if((22050>f||f>96e3)&&(t.disableLogs||console.warn("sample-rate must be under range 22050 and 96000.")),c.createJavaScriptNode)__stereoAudioRecorderJavacriptNode=c.createJavaScriptNode(l,2,2);else{if(!c.createScriptProcessor)throw"WebAudio API has no support on this browser.";__stereoAudioRecorderJavacriptNode=c.createScriptProcessor(l,2,2)}u.connect(__stereoAudioRecorderJavacriptNode),l=__stereoAudioRecorderJavacriptNode.bufferSize,t.disableLogs||(console.log("sample-rate",f),console.log("buffer-size",l));var g=!1;this.pause=function(){g=!0,t.disableLogs||console.debug("Paused recording.")},this.resume=function(){g=!1,t.disableLogs||console.debug("Resumed recording.")};var v=!1;__stereoAudioRecorderJavacriptNode.onaudioprocess=function(t){if(!g){if(e.ended)return void(__stereoAudioRecorderJavacriptNode.onaudioprocess=function(){});if(!d)return void u.disconnect();v||(v=!0,a.onAudioProcessStarted&&a.onAudioProcessStarted());var i=t.inputBuffer.getChannelData(0),o=t.inputBuffer.getChannelData(1);r.push(new Float32Array(i)),n.push(new Float32Array(o)),s+=l}},__stereoAudioRecorderJavacriptNode.connect(c.destination)}function CanvasRecorder(e){function t(){return o?(a=(new Date).getTime(),setTimeout(t,100)):void window.html2canvas(e,{onrendered:function(e){var o=(new Date).getTime()-a;return o?(a=(new Date).getTime(),r.frames.push({duration:o,image:e.toDataURL("image/webp")}),void(i&&requestAnimationFrame(t))):t()}})}if(!window.html2canvas)throw"Please link: //cdn.webrtc-experiment.com/screenshot.js";var i;this.record=function(){i=!0,r.frames=[],t()},this.stop=function(e){i=!1;var t=this;r.compile(function(i){t.blob=i,t.blob.forEach&&(t.blob=new Blob([],{type:"video/webm"})),e&&e(t.blob)})};var o=!1;this.pause=function(){o=!0,this.disableLogs||console.debug("Paused recording.")},this.resume=function(){o=!1,this.disableLogs||console.debug("Resumed recording.")};var a=(new Date).getTime(),r=new Whammy.Video(100)}function WhammyRecorder(e){function t(){var e=(new Date).getTime()-n;return e?a?(n=(new Date).getTime(),setTimeout(t,100)):(n=(new Date).getTime(),r.paused&&r.play(),c.drawImage(r,0,0,s.width,s.height),d.frames.push({duration:e,image:s.toDataURL("image/webp")}),void(o||setTimeout(t,10))):setTimeout(t,10)}function i(e,t,i,o){var a=document.createElement("canvas");a.width=s.width,a.height=s.height;for(var r=a.getContext("2d"),n=[],d=-1===t,c=t&&t>0&&t<=e.length?t:e.length,u={r:0,g:0,b:0},h=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),l=i&&i>=0&&1>=i?i:0,f=o&&o>=0&&1>=o?o:0,g=!1,v=0;c>v;v++){var m,w,p;if(!g){var b=new Image;b.src=e[v].image,r.drawImage(b,0,0,s.width,s.height);var R=r.getImageData(0,0,s.width,s.height);m=0,w=R.data.length,p=R.data.length/4;for(var y=0;w>y;y+=4){var S={r:R.data[y],g:R.data[y+1],b:R.data[y+2]},A=Math.sqrt(Math.pow(S.r-u.r,2)+Math.pow(S.g-u.g,2)+Math.pow(S.b-u.b,2));h*l>=A&&m++}}!g&&p*f>=p-m||(d&&(g=!0),n.push(e[v]))}return n=n.concat(e.slice(c)),n.length<=0&&n.push(e[e.length-1]),n}this.record=function(){this.width||(this.width=320),this.height||(this.height=240),this.video||(this.video={width:this.width,height:this.height}),this.canvas||(this.canvas={width:this.width,height:this.height}),s.width=this.canvas.width,s.height=this.canvas.height,c=s.getContext("2d"),this.video&&this.video instanceof HTMLVideoElement?r=this.video.cloneNode():(r=document.createElement("video"),r.src=URL.createObjectURL(e),r.width=this.video.width,r.height=this.video.height),r.muted=!0,r.play(),n=(new Date).getTime(),d=new Whammy.Video,this.disableLogs||(console.log("canvas resolutions",s.width,"*",s.height),console.log("video width/height",r.width||s.width,"*",r.height||s.height)),t()};var o=!1;this.stop=function(e){o=!0;var t=this;setTimeout(function(){d.frames=i(d.frames,-1),this.advertisement&&this.advertisement.length&&(d.frames=this.advertisement.concat(d.frames)),d.compile(function(i){t.blob=i,t.blob.forEach&&(t.blob=new Blob([],{type:"video/webm"})),e&&e(t.blob)})},10)};var a=!1;this.pause=function(){a=!0,this.disableLogs||console.debug("Paused recording.")},this.resume=function(){a=!1,this.disableLogs||console.debug("Resumed recording.")};var r,n,d,s=document.createElement("canvas"),c=s.getContext("2d")}function GifRecorder(e){if(!window.GIFEncoder)throw"Please link: https://cdn.webrtc-experiment.com/gif-recorder.js";this.record=function(){function e(r){return t?setTimeout(function(){e(r)},100):(c=requestAnimationFrame(e),void 0===typeof d&&(d=r),void(90>r-d||(a.paused&&a.play(),o.drawImage(a,0,0,i.width,i.height),n.onGifPreview&&n.onGifPreview(i.toDataURL("image/png")),s.addFrame(o),d=r)))}this.width||(this.width=a.offsetWidth||320),this.height||(this.height=a.offsetHeight||240),this.video||(this.video={width:this.width,height:this.height}),this.canvas||(this.canvas={width:this.width,height:this.height}),i.width=this.canvas.width,i.height=this.canvas.height,a.width=this.video.width,a.height=this.video.height,s=new window.GIFEncoder,s.setRepeat(0),s.setDelay(this.frameRate||200),s.setQuality(this.quality||10),s.start(),r=Date.now();var n=this;c=requestAnimationFrame(e)},this.stop=function(){c&&cancelAnimationFrame(c),n=Date.now(),this.blob=new Blob([new Uint8Array(s.stream().bin)],{type:"image/gif"}),s.stream().bin=[]};var t=!1;this.pause=function(){t=!0,this.disableLogs||console.debug("Paused recording.")},this.resume=function(){t=!1,this.disableLogs||console.debug("Resumed recording.")};var i=document.createElement("canvas"),o=i.getContext("2d"),a=document.createElement("video");a.muted=!0,a.autoplay=!0,a.src=URL.createObjectURL(e),a.play();var r,n,d,s,c=null}!function(e){navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var t=!!navigator.getUserMedia;e.fn.initRecorder=function(){return e.videoFrameTarget=e(this.selector)},e.fn.setParams=function(t){return e.VideoParams=t},e.fn.startRecording=function(){navigator.getUserMedia({video:e.VideoParams,audio:!0},function(i){e.localMediaStream=i;var o=e(e.videoFrameTarget.selector);return e.videoFrameTarget=e.videoFrameTarget.selector,o.attr("controls","controls"),o.attr("src",window.URL.createObjectURL(i)),e.recordAudio=RecordRTC(i,{bufferSize:512,sampleRate:44e3,onAudioProcessStarted:function(){t||recordVideo.startRecording()}}),t&&e.recordAudio.startRecording(),t||(e.recordVideo=RecordRTC(i,{type:"video"}),e.recordAudio.startRecording()),this},function(){alert("Resource usage denied by user! video will not be recorded.")})},e.fn.PauseRecorder=function(){var i=document.querySelector(e.videoFrameTarget);i.pause(),e.recordAudio.stopRecording(t?function(t){e(e.videoFrameTarget).attr("src",t),e.localMediaStream.stop(),e(this).saveVideo(e.recordAudio.getBlob(),"video","MyVideo.webm")}:function(){e.localMediaStream.stop(),e(this).saveVideo(e.recordAudio.getBlob(),"audio",fileName+".wav")}),t||e.recordVideo.stopRecording(function(){e.localMediaStream.stop(),e(this).saveVideo(e.recordVideo.getBlob(),"video","MyVideo.webm")})},e.fn.resumeRecorder=function(){var t=document.querySelector(e.videoFrameTarget);t.play()},e.fn.saveVideo=function(e){saveAs(e,"video.webm")}}(jQuery);var saveAs=saveAs||navigator.msSaveBlob&&navigator.msSaveBlob.bind(navigator)||function(e){"use strict";var t=e.document,i=function(){return e.URL||e.webkitURL||e},o=e.URL||e.webkitURL||e,a=t.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in a,n=function(i){var o=t.createEvent("MouseEvents");o.initMouseEvent("click",!0,!1,e,0,0,0,0,0,!1,!1,!1,!1,0,null),i.dispatchEvent(o)},d=e.webkitRequestFileSystem,s=e.requestFileSystem||d||e.mozRequestFileSystem,c=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},u="application/octet-stream",h=0,l=[],f=function(){for(var e=l.length;e--;){var t=l[e];"string"==typeof t?o.revokeObjectURL(t):t.remove()}l.length=0},g=function(e,t,i){t=[].concat(t);for(var o=t.length;o--;){var a=e["on"+t[o]];if("function"==typeof a)try{a.call(e,i||e)}catch(r){c(r)}}},v=function(t,o){var c,f,v,m=this,w=t.type,p=!1,b=function(){var e=i().createObjectURL(t);return l.push(e),e},R=function(){g(m,"writestart progress write writeend".split(" "))},y=function(){(p||!c)&&(c=b(t)),f&&(f.location.href=c),m.readyState=m.DONE,R()},S=function(e){return function(){return m.readyState!==m.DONE?e.apply(this,arguments):void 0}},A={create:!0,exclusive:!1};return m.readyState=m.INIT,o||(o="download"),r?(c=b(t),a.href=c,a.download=o,n(a),m.readyState=m.DONE,void R()):(e.chrome&&w&&w!==u&&(v=t.slice||t.webkitSlice,t=v.call(t,0,t.size,u),p=!0),d&&"download"!==o&&(o+=".download"),f=w===u||d?e:e.open(),s?(h+=t.size,void s(e.TEMPORARY,h,S(function(e){e.root.getDirectory("saved",A,S(function(e){var i=function(){e.getFile(o,A,S(function(e){e.createWriter(S(function(i){i.onwriteend=function(t){f.location.href=e.toURL(),l.push(e),m.readyState=m.DONE,g(m,"writeend",t)},i.onerror=function(){var e=i.error;e.code!==e.ABORT_ERR&&y()},"writestart progress write abort".split(" ").forEach(function(e){i["on"+e]=m["on"+e]}),i.write(t),m.abort=function(){i.abort(),m.readyState=m.DONE},m.readyState=m.WRITING}),y)}),y)};e.getFile(o,{create:!1},S(function(e){e.remove(),i()}),S(function(e){e.code===e.NOT_FOUND_ERR?i():y()}))}),y)}),y)):void y())},m=v.prototype,w=function(e,t){return new v(e,t)};return m.abort=function(){var e=this;e.readyState=e.DONE,g(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,e.addEventListener("unload",f,!1),w}(self);window.requestAnimationFrame||(requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame),window.cancelAnimationFrame||(cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame),window.AudioContext||(window.AudioContext=window.webkitAudioContext||window.mozAudioContext),URL=window.URL||window.webkitURL,navigator.getUserMedia=navigator.webkitGetUserMedia||navigator.mozGetUserMedia,window.webkitMediaStream&&(window.MediaStream=window.webkitMediaStream),IsChrome=!!navigator.webkitGetUserMedia;var ObjectStore={AudioContext:window.AudioContext||window.webkitAudioContext},Whammy=function(){function e(e){for(var i=t(e),o=3e4,a=[{id:440786851,data:[{data:1,id:17030},{data:1,id:17143},{data:4,id:17138},{data:8,id:17139},{data:"webm",id:17026},{data:2,id:17031},{data:2,id:17029}]},{id:408125543,data:[{id:357149030,data:[{data:1e6,id:2807729},{data:"whammy",id:19840},{data:"whammy",id:22337},{data:c(i.duration),id:17545}]},{id:374648427,data:[{id:174,data:[{data:1,id:215},{data:1,id:25541},{data:0,id:156},{data:"und",id:2274716},{data:"V_VP8",id:134},{data:"VP8",id:2459272},{data:1,id:131},{id:224,data:[{data:i.width,id:176},{data:i.height,id:186}]}]}]}]}],d=0,s=0;d<e.length;){var u=[],h=0;do u.push(e[d]),h+=e[d].duration,d++;while(d<e.length&&o>h);var l=0,f={id:524531317,data:[{data:s,id:231}].concat(u.map(function(e){var t=n({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(l)});return l+=e.duration,{data:t,id:163}}))};a[1].data.push(f),s+=h}return r(a)}function t(e){if(!e[0])return void console.warn("Something went wrong. Maybe WebP format is not supported in the current browser.");for(var t=e[0].width,i=e[0].height,o=e[0].duration,a=1;a<e.length;a++)o+=e[a].duration;return{duration:o,width:t,height:i}}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function o(e){return new Uint8Array(e.split("").map(function(e){return e.charCodeAt(0)}))}function a(e){var t=[],i=e.length%8?new Array(9-e.length%8).join("0"):"";e=i+e;for(var o=0;o<e.length;o+=8)t.push(parseInt(e.substr(o,8),2));return new Uint8Array(t)}function r(e){for(var t=[],n=0;n<e.length;n++){var d=e[n].data;"object"==typeof d&&(d=r(d)),"number"==typeof d&&(d=a(d.toString(2))),"string"==typeof d&&(d=o(d));var s=d.size||d.byteLength||d.length,c=Math.ceil(Math.ceil(Math.log(s)/Math.log(2))/8),u=s.toString(2),h=new Array(7*c+7+1-u.length).join("0")+u,l=new Array(c).join("0")+"1"+h;t.push(i(e[n].id)),t.push(a(l)),t.push(d)}return new Blob(t,{type:"video/webm"})}function n(e){var t=0;if(e.keyframe&&(t|=128),e.invisible&&(t|=8),e.lacing&&(t|=e.lacing<<1),e.discardable&&(t|=1),e.trackNum>127)throw"TrackNumber > 127 not supported";var i=[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map(function(e){return String.fromCharCode(e)}).join("")+e.frame;return i}function d(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),o=0,a=[];4>o;o++)a[o]=t.charCodeAt(i+3+o);var r,n,d;return d=a[1]<<8|a[0],r=16383&d,d=a[3]<<8|a[2],n=16383&d,{width:r,height:n,data:t,riff:e}}function s(e){for(var t=0,i={};t<e.length;){var o=e.substr(t,4),a=parseInt(e.substr(t+4,4).split("").map(function(e){var t=e.charCodeAt(0).toString(2);
  return new Array(8-t.length+1).join("0")+t}).join(""),2),r=e.substr(t+4+4,a);t+=8+a,i[o]=i[o]||[],i[o].push("RIFF"==o||"LIST"==o?s(r):r)}return i}function c(e){return[].slice.call(new Uint8Array(new Float64Array([e]).buffer),0).map(function(e){return String.fromCharCode(e)}).reverse().join("")}function u(e){this.frames=[],this.duration=e||1,this.quality=100}return u.prototype.add=function(e,t){if("canvas"in e&&(e=e.canvas),"toDataURL"in e&&(e=e.toDataURL("image/webp",this.quality)),!/^data:image\/webp;base64,/gi.test(e))throw"Input must be formatted properly as a base64 encoded DataURI of type image/webp";this.frames.push({image:e,duration:t||this.duration})},u.prototype.compile=function(){return new e(this.frames.map(function(e){var t=d(s(atob(e.image.slice(23))));return t.duration=e.duration,t}))},{Video:u,toWebM:e}}();RecordRTC.getFromDisk=function(e,t){if(!t)throw"callback is mandatory.";console.log("Getting recorded "+("all"===e?"blobs":e+" blob ")+" from disk!"),DiskStorage.Fetch(function(i,o){"all"!==e&&o===e+"Blob"&&t&&t(i),"all"===e&&t&&t(i,o.replace("Blob",""))})},RecordRTC.writeToDisk=function(e){console.log("Writing recorded blob(s) to disk!"),e=e||{},e.audio&&e.video&&e.gif?e.audio.getDataURL(function(t){e.video.getDataURL(function(i){e.gif.getDataURL(function(e){DiskStorage.Store({audioBlob:t,videoBlob:i,gifBlob:e})})})}):e.audio&&e.video?e.audio.getDataURL(function(t){e.video.getDataURL(function(e){DiskStorage.Store({audioBlob:t,videoBlob:e})})}):e.audio&&e.gif?e.audio.getDataURL(function(t){e.gif.getDataURL(function(e){DiskStorage.Store({audioBlob:t,gifBlob:e})})}):e.video&&e.gif?e.video.getDataURL(function(t){e.gif.getDataURL(function(e){DiskStorage.Store({videoBlob:t,gifBlob:e})})}):e.audio?e.audio.getDataURL(function(e){DiskStorage.Store({audioBlob:e})}):e.video?e.video.getDataURL(function(e){DiskStorage.Store({videoBlob:e})}):e.gif&&e.gif.getDataURL(function(e){DiskStorage.Store({gifBlob:e})})},MRecordRTC.getFromDisk=RecordRTC.getFromDisk,MRecordRTC.writeToDisk=RecordRTC.writeToDisk,window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame),window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame),window.AudioContext||(window.AudioContext=window.webkitAudioContext||window.mozAudioContext),window.URL=window.URL||window.webkitURL,navigator.getUserMedia=navigator.webkitGetUserMedia||navigator.mozGetUserMedia,window.webkitMediaStream&&(window.MediaStream=window.webkitMediaStream);var isChrome=!!navigator.webkitGetUserMedia;0===location.href.indexOf("file:")&&console.error("Please load this HTML file on HTTP or HTTPS.");var Storage={AudioContext:window.AudioContext||window.webkitAudioContext},__stereoAudioRecorderJavacriptNode,Whammy=function(){function e(e){this.frames=[],this.duration=e||1,this.quality=100}function t(e){var t=URL.createObjectURL(new Blob([e.toString(),"this.onmessage =  function (e) {"+e.name+"(e.data);}"],{type:"application/javascript"})),i=new Worker(t);return URL.revokeObjectURL(t),i}function i(e){function t(e){var t=o(e);if(!t)return[];for(var a=3e4,r=[{id:440786851,data:[{data:1,id:17030},{data:1,id:17143},{data:4,id:17138},{data:8,id:17139},{data:"webm",id:17026},{data:2,id:17031},{data:2,id:17029}]},{id:408125543,data:[{id:357149030,data:[{data:1e6,id:2807729},{data:"whammy",id:19840},{data:"whammy",id:22337},{data:l(t.duration),id:17545}]},{id:374648427,data:[{id:174,data:[{data:1,id:215},{data:1,id:29637},{data:0,id:156},{data:"und",id:2274716},{data:"V_VP8",id:134},{data:"VP8",id:2459272},{data:1,id:131},{id:224,data:[{data:t.width,id:176},{data:t.height,id:186}]}]}]}]}],n=0,s=0;n<e.length;){var c=[],u=0;do c.push(e[n]),u+=e[n].duration,n++;while(n<e.length&&a>u);var h=0,f={id:524531317,data:i(s,h,c)};r[1].data.push(f),s+=u}return d(r)}function i(e,t,i){return[{data:e,id:231}].concat(i.map(function(e){var i=s({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}}))}function o(e){if(!e[0])return void postMessage({error:"Something went wrong. Maybe WebP format is not supported in the current browser."});for(var t=e[0].width,i=e[0].height,o=e[0].duration,a=1;a<e.length;a++)o+=e[a].duration;return{duration:o,width:t,height:i}}function a(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function r(e){return new Uint8Array(e.split("").map(function(e){return e.charCodeAt(0)}))}function n(e){var t=[],i=e.length%8?new Array(9-e.length%8).join("0"):"";e=i+e;for(var o=0;o<e.length;o+=8)t.push(parseInt(e.substr(o,8),2));return new Uint8Array(t)}function d(e){for(var t=[],i=0;i<e.length;i++){var o=e[i].data;"object"==typeof o&&(o=d(o)),"number"==typeof o&&(o=n(o.toString(2))),"string"==typeof o&&(o=r(o));var s=o.size||o.byteLength||o.length,c=Math.ceil(Math.ceil(Math.log(s)/Math.log(2))/8),u=s.toString(2),h=new Array(7*c+7+1-u.length).join("0")+u,l=new Array(c).join("0")+"1"+h;t.push(a(e[i].id)),t.push(n(l)),t.push(o)}return new Blob(t,{type:"video/webm"})}function s(e){var t=0;if(e.keyframe&&(t|=128),e.invisible&&(t|=8),e.lacing&&(t|=e.lacing<<1),e.discardable&&(t|=1),e.trackNum>127)throw"TrackNumber > 127 not supported";var i=[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map(function(e){return String.fromCharCode(e)}).join("")+e.frame;return i}function c(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),o=0,a=[];4>o;o++)a[o]=t.charCodeAt(i+3+o);var r,n,d;return d=a[1]<<8|a[0],r=16383&d,d=a[3]<<8|a[2],n=16383&d,{width:r,height:n,data:t,riff:e}}function u(e,t){return parseInt(e.substr(t+4,4).split("").map(function(e){var t=e.charCodeAt(0).toString(2);return new Array(8-t.length+1).join("0")+t}).join(""),2)}function h(e){for(var t=0,i={};t<e.length;){var o=e.substr(t,4),a=u(e,t),r=e.substr(t+4+4,a);t+=8+a,i[o]=i[o]||[],i[o].push("RIFF"===o||"LIST"===o?h(r):r)}return i}function l(e){return[].slice.call(new Uint8Array(new Float64Array([e]).buffer),0).map(function(e){return String.fromCharCode(e)}).reverse().join("")}var f=new t(e.map(function(e){var t=c(h(atob(e.image.slice(23))));return t.duration=e.duration,t}));postMessage(f)}return e.prototype.add=function(e,t){if("canvas"in e&&(e=e.canvas),"toDataURL"in e&&(e=e.toDataURL("image/webp",this.quality)),!/^data:image\/webp;base64,/gi.test(e))throw"Input must be formatted properly as a base64 encoded DataURI of type image/webp";this.frames.push({image:e,duration:t||this.duration})},e.prototype.compile=function(e){var o=t(i);o.onmessage=function(t){return t.data.error?void console.error(t.data.error):void e(t.data)},o.postMessage(this.frames)},{Video:e}}(),DiskStorage={init:function(){function e(e){e.createObjectStore(o.dataStoreName)}function t(){function e(e){t.objectStore(o.dataStoreName).get(e).onsuccess=function(t){o.callback&&o.callback(t.target.result,e)}}var t=i.transaction([o.dataStoreName],"readwrite");o.videoBlob&&t.objectStore(o.dataStoreName).put(o.videoBlob,"videoBlob"),o.gifBlob&&t.objectStore(o.dataStoreName).put(o.gifBlob,"gifBlob"),o.audioBlob&&t.objectStore(o.dataStoreName).put(o.audioBlob,"audioBlob"),e("audioBlob"),e("videoBlob"),e("gifBlob")}var i,o=this,a=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB,r=1,n=this.dbName||location.href.replace(/\/|:|#|%|\.|\[|\]/g,""),d=a.open(n,r);d.onerror=o.onError,d.onsuccess=function(){if(i=d.result,i.onerror=o.onError,i.setVersion)if(i.version!==r){var a=i.setVersion(r);a.onsuccess=function(){e(i),t()}}else t();else t()},d.onupgradeneeded=function(t){e(t.target.result)}},Fetch:function(e){return this.callback=e,this.init(),this},Store:function(e){return this.audioBlob=e.audioBlob,this.videoBlob=e.videoBlob,this.gifBlob=e.gifBlob,this.init(),this},onError:function(e){console.error(JSON.stringify(e,null,"	"))},dataStoreName:"recordRTC",dbName:null};