Add bitRate & sampleRate

This commit is contained in:
Gennady Grishkovtsov
2018-12-31 12:48:07 +03:00
parent 87f9703529
commit 7fdf3f745b
5 changed files with 18 additions and 5 deletions

View File

@@ -260,6 +260,9 @@
attempts : { type: Number },
time : { type: Number },
bitRate : { type: Number, default: 128 },
sampleRate : { type: Number, default: 44100 },
showDownloadButton : { type: Boolean, default: true },
showUploadButton : { type: Boolean, default: true },
@@ -343,7 +346,9 @@
beforeRecording : this.beforeRecording,
afterRecording : this.afterRecording,
pauseRecording : this.pauseRecording,
micFailed : this.micFailed
micFailed : this.micFailed,
bitRate : this.bitRate,
sampleRate : this.sampleRate
})
}
},

View File

@@ -2,8 +2,8 @@ import { Mp3Encoder } from 'lamejs'
export default class {
constructor(config) {
this.bitRate = config.bitRate || 128
this.sampleRate = config.sampleRate || 44100
this.bitRate = config.bitRate
this.sampleRate = config.sampleRate
this.dataBuffer = []
this.encoder = new Mp3Encoder(1, this.sampleRate, this.bitRate)
}

View File

@@ -7,6 +7,8 @@ export default class {
this.pauseRecording = options.pauseRecording
this.afterRecording = options.afterRecording
this.micFailed = options.micFailed
this.bitRate = options.bitRate
this.sampleRate = options.sampleRate
this.bufferSize = 4096
this.records = []
@@ -37,7 +39,10 @@ export default class {
.catch(this._micError.bind(this))
this.isPause = false
this.isRecording = true
this.lameEncoder = new Encoder({})
this.lameEncoder = new Encoder({
bitRate : this.bitRate,
sampleRate : this.sampleRate
})
}
stop () {