You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
12 KiB
JavaScript
11 lines
12 KiB
JavaScript
1 year ago
|
import{at as P,au as A}from"./index-93dfb385.js";var v={exports:{}};/*!
|
||
|
*
|
||
|
* js-audio-recorder - js audio recorder plugin
|
||
|
*
|
||
|
* @version v1.0.7
|
||
|
* @homepage https://github.com/2fps/recorder
|
||
|
* @author 2fps <echoweb@126.com> (https://www.zhuyuntao.cn)
|
||
|
* @license MIT
|
||
|
*
|
||
|
*/(function(w,b){(function(m,f){w.exports=f()})(P,function(){return function(m){var f={};function p(a){if(f[a])return f[a].exports;var r=f[a]={i:a,l:!1,exports:{}};return m[a].call(r.exports,r,r.exports,p),r.l=!0,r.exports}return p.m=m,p.c=f,p.d=function(a,r,o){p.o(a,r)||Object.defineProperty(a,r,{enumerable:!0,get:o})},p.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},p.t=function(a,r){if(1&r&&(a=p(a)),8&r||4&r&&typeof a=="object"&&a&&a.__esModule)return a;var o=Object.create(null);if(p.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:a}),2&r&&typeof a!="string")for(var t in a)p.d(o,t,(function(n){return a[n]}).bind(null,t));return o},p.n=function(a){var r=a&&a.__esModule?function(){return a.default}:function(){return a};return p.d(r,"a",r),r},p.o=function(a,r){return Object.prototype.hasOwnProperty.call(a,r)},p.p="",p(p.s=1)}([function(m,f,p){function a(r,o,t){for(var n=0;n<t.length;n++)r.setUint8(o+n,t.charCodeAt(n))}Object.defineProperty(f,"__esModule",{value:!0}),f.compress=function(r,o,t){for(var n=o/t,d=Math.max(n,1),s=r.left,i=r.right,e=Math.floor((s.length+i.length)/n),l=new Float32Array(e),u=0,g=0;u<e;){var c=Math.floor(g);l[u]=s[c],u++,i.length&&(l[u]=i[c],u++),g+=d}return l},f.encodePCM=function(r,o,t){t===void 0&&(t=!0);var n=0,d=r.length*(o/8),s=new ArrayBuffer(d),i=new DataView(s);if(o===8)for(var e=0;e<r.length;e++,n++){var l=(u=Math.max(-1,Math.min(1,r[e])))<0?128*u:127*u;l=+l+128,i.setInt8(n,l)}else for(e=0;e<r.length;e++,n+=2){var u=Math.max(-1,Math.min(1,r[e]));i.setInt16(n,u<0?32768*u:32767*u,t)}return i},f.encodeWAV=function(r,o,t,n,d,s){s===void 0&&(s=!0);var i=t>o?o:t,e=d,l=new ArrayBuffer(44+r.byteLength),u=new DataView(l),g=n,c=0;a(u,c,"RIFF"),c+=4,u.setUint32(c,36+r.byteLength,s),a(u,c+=4,"WAVE"),a(u,c+=4,"fmt "),c+=4,u.setUint32(c,16,s),c+=4,u.setUint16(c,1,s),c+=2,u.setUint16(c,g,s),c+=2,u.setUint32(c,i,s),c+=4,u.setUint32(c,g*i*(e/8),s),c+=4,u.setUint16(c,g*(e/8),s),c+=2,u.setUint16(c,e,s),a(u,c+=2,"data"),c+=4,u.setUint32(c,r.byteLength,s),c+=4;for(var y=0;y<r.byteLength;)u.setUint8(c,r.getUint8(y)),c++,y++;return u}},function(m,f,p){var a,r=this&&this.__extends||(a=function(s,i){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,l){e.__proto__=l}||function(e,l){for(var u in l)l.hasOwnProperty(u)&&(e[u]=l[u])})(s,i)},function(s,i){function e(){this.constructor=s}a(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(f,"__esModule",{value:!0});var o=p(2),t=p(0),n=p(3),d=function(s){function i(e){e===void 0&&(e={});var l=s.call(this,e)||this;return l.isrecording=!1,l.ispause=!1,l.isplaying=!1,l}return r(i,s),i.prototype.setOption=function(e){e===void 0&&(e={}),this.setNewOption(e)},i.prototype.start=function(){return this.isrecording?Promise.reject():(this.isrecording=!0,this.startRecord())},i.prototype.pause=function(){this.isrecording&&!this.ispause&&(this.ispause=!0,this.pauseRecord())},i.prototype.resume=function(){this.isrecording&&this.ispause&&(this.ispause=!1,this.resumeRecord())},i.prototype.stop=function(){this.isrecording&&(this.isrecording=!1,this.ispause=!1,this.stopRecord())},i.prototype.play=function(){this.stop(),this.isplaying=!0,this.onplay&&this.onplay(),n.default.addPlayEnd(this.onplayend);var e=this.getWAV();e.byteLength>44&&n.default.play(e.buffer)},i.prototype.getPlayTime=function(){return n.default.getPlayTime()},i.prototype.pausePlay=function(){!this.isrecording&&this.isplaying&&(this.isplaying=!1,this.onpauseplay&&this.onpauseplay(),n.default.pausePlay())},i.prototype.resumePlay=function(){this.isrecording||this.isplaying||(this.isplaying=!0,this.onresumeplay&&this.onresumeplay(),n.default.resumePlay())},i.prototype.stopPlay=function(){this.isrecording||(this.isplaying=!1,this.onstopplay&&this.onstopplay(),n.default.stopPlay())},i.prototype.destroy=function(){return n.default.destroyPlay(),this.destroyRecord()},i.prototype.getRecordAnalyseData=function(){return this.getAn
|