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{ar as M,as as R,d as b,q as A,a1 as P,B,ai as x,aa as S,o as C,c as D,_ as U}from "./index-f5e1fd05.js";var _={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(v,w){(function(m,c){v.exports=c()})(M,function(){return function(m){var c={};function d(o){if(c[o])return c[o].exports;var i=c[o]={i:o,l:!1,exports:{}};return m[o].call(i.exports,i,i.exports,d),i.l=!0,i.exports}return d.m=m,d.c=c,d.d=function(o,i,r){d.o(o,i)||Object.defineProperty(o,i,{enumerable:!0,get:r})},d.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},d.t=function(o,i){if(1&i&&(o=d(o)),8&i||4&i&&typeof o=="object"&&o&&o.__esModule)return o;var r=Object.create(null);if(d.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:o}),2&i&&typeof o!="string")for(var t in o)d.d(r,t,(function(e){return o[e]}).bind(null,t));return r},d.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return d.d(i,"a",i),i},d.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)},d.p="",d(d.s=1)}([function(m,c,d){function o(i,r,t){for(var e=0;e<t.length;e++)i.setUint8(r+e,t.charCodeAt(e))}Object.defineProperty(c,"__esModule",{value:!0}),c.compress=function(i,r,t){for(var e=r/t,f=Math.max(e,1),s=i.left,a=i.right,n=Math.floor((s.length+a.length)/e),l=new Float32Array(n),u=0,g=0;u<n;){var p=Math.floor(g);l[u]=s[p],u++,a.length&&(l[u]=a[p],u++),g+=f}return l},c.encodePCM=function(i,r,t){t===void 0&&(t=!0);var e=0,f=i.length*(r/8),s=new ArrayBuffer(f),a=new DataView(s);if(r===8)for(var n=0;n<i.length;n++,e++){var l=(u=Math.max(-1,Math.min(1,i[n])))<0?128*u:127*u;l=+l+128,a.setInt8(e,l)}else for(n=0;n<i.length;n++,e+=2){var u=Math.max(-1,Math.min(1,i[n]));a.setInt16(e,u<0?32768*u:32767*u,t)}return a},c.encodeWAV=function(i,r,t,e,f,s){s===void 0&&(s=!0);var a=t>r?r:t,n=f,l=new ArrayBuffer(44+i.byteLength),u=new DataView(l),g=e,p=0;o(u,p,"RIFF"),p+=4,u.setUint32(p,36+i.byteLength,s),o(u,p+=4,"WAVE"),o(u,p+=4,"fmt "),p+=4,u.setUint32(p,16,s),p+=4,u.setUint16(p,1,s),p+=2,u.setUint16(p,g,s),p+=2,u.setUint32(p,a,s),p+=4,u.setUint32(p,g*a*(n/8),s),p+=4,u.setUint16(p,g*(n/8),s),p+=2,u.setUint16(p,n,s),o(u,p+=2,"data"),p+=4,u.setUint32(p,i.byteLength,s),p+=4;for(var y=0;y<i.byteLength;)u.setUint8(p,i.getUint8(y)),p++,y++;return u}},function(m,c,d){var o,i=this&&this.__extends||(o=function(s,a){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,l){n.__proto__=l}||function(n,l){for(var u in l)l.hasOwnProperty(u)&&(n[u]=l[u])})(s,a)},function(s,a){function n(){this.constructor=s}o(s,a),s.prototype=a===null?Object.create(a):(n.prototype=a.prototype,new n)});Object.defineProperty(c,"__esModule",{value:!0});var r=d(2),t=d(0),e=d(3),f=function(s){function a(n){n===void 0&&(n={});var l=s.call(this,n)||this;return l.isrecording=!1,l.ispause=!1,l.isplaying=!1,l}return i(a,s),a.prototype.setOption=function(n){n===void 0&&(n={}),this.setNewOption(n)},a.prototype.start=function(){return this.isrecording?Promise.reject():(this.isrecording=!0,this.startRecord())},a.prototype.pause=function(){this.isrecording&&!this.ispause&&(this.ispause=!0,this.pauseRecord())},a.prototype.resume=function(){this.isrecording&&this.ispause&&(this.ispause=!1,this.resumeRecord())},a.prototype.stop=function(){this.isrecording&&(this.isrecording=!1,this.ispause=!1,this.stopRecord())},a.prototype.play=function(){this.stop(),this.isplaying=!0,this.onplay&&this.onplay(),e.default.addPlayEnd(this.onplayend);var n=this.getWAV();n.byteLength>44&&e.default.play(n.buffer)},a.prototype.getPlayTime=function(){return e.default.getPlayTime()},a.prototype.pausePlay=function(){!this.isrecording&&this.isplaying&&(this.isplaying=!1,this.onpauseplay&&this.onpauseplay(),e.default.pausePlay())},a.prototype.resumePlay=function(){this.isrecording||this.isplaying||(this.isplaying=!0,this.onresumeplay&&this.onresumeplay(),e.default.resumePlay())},a.prototype.stopPlay=function(){this.isrecording||(this.isplaying=!1,this.onstopplay&&this.onstopplay(),e.default.stopPlay())},a.prototype.destroy=function(){return e.default.destroyPlay(),this.destroyRecord()},a.prototype.getRecordAnalyseData=function(){return this.getAn
|