vue recorderX録音プラグインの導入

975 ワード

これは私が導入したステップです.初めて導入したのでできません.時間を無駄にしました.ブログを書いて記録してください.このプラグインを書いた大神に聞いてから、私の問題を解決しました.
 
1、プラグインの導入
npm install recorderx -S

2、import進ページ
import Recorder from 'recorderx';
const rc=0;

3、レコーディング開始
let that = this;
this.$nextTick(function () {
    that.rc = new Recorder(true);
    
    that.rc.start();
    //              
    // const audio = new Audio()
    // audio.autoplay = true
    // this.rc.start().then(stream => {
    //   audio.srcObject = stream
    // })
    // .catch(error => alert(error));
})

4、その他
//    
this.rc.pause()

//    
this.rc.close()

//  pcm  
this.rc.getRecord()

//  wav  
this.rc.getRecordWav();//(    wav  blob url)

//     blob  (   )
       encodeWAV()
import {encodeWAV} from 'recorderx';
      :
var pcm = this.rc.getRecord();
const blob = encodeWAV(pcm,16,44100)