mirror of
https://github.com/kevin-DL/vue-audio-recorder.git
synced 2026-01-11 19:04:28 +00:00
Add bitRate & sampleRate
This commit is contained in:
@@ -35,6 +35,8 @@ npm i vue-audio-recorder --save
|
|||||||
| attempts | Number | Number of recording attempts |
|
| attempts | Number | Number of recording attempts |
|
||||||
| headers | Object | HTTP headers |
|
| headers | Object | HTTP headers |
|
||||||
| time | Number | Time limit for the record (minutes) |
|
| time | Number | Time limit for the record (minutes) |
|
||||||
|
| bit-rate | Number | Default: 128 |
|
||||||
|
| sample-rate | Number | Default: 44100 |
|
||||||
| filename | String | Download/Upload filename |
|
| filename | String | Download/Upload filename |
|
||||||
| upload-url | String | URL for uploading |
|
| upload-url | String | URL for uploading |
|
||||||
| show-download-button | Boolean | If it is true show a download button. Default: true |
|
| show-download-button | Boolean | If it is true show a download button. Default: true |
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
:select-record="callback"
|
:select-record="callback"
|
||||||
:before-upload="callback"
|
:before-upload="callback"
|
||||||
:successful-upload="callback"
|
:successful-upload="callback"
|
||||||
:failed-upload="callback"/>
|
:failed-upload="callback"
|
||||||
|
:bit-rate="192"/>
|
||||||
|
|
||||||
<audio-player :src="mp3" v-if="!showRecorder"/>
|
<audio-player :src="mp3" v-if="!showRecorder"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -260,6 +260,9 @@
|
|||||||
attempts : { type: Number },
|
attempts : { type: Number },
|
||||||
time : { type: Number },
|
time : { type: Number },
|
||||||
|
|
||||||
|
bitRate : { type: Number, default: 128 },
|
||||||
|
sampleRate : { type: Number, default: 44100 },
|
||||||
|
|
||||||
showDownloadButton : { type: Boolean, default: true },
|
showDownloadButton : { type: Boolean, default: true },
|
||||||
showUploadButton : { type: Boolean, default: true },
|
showUploadButton : { type: Boolean, default: true },
|
||||||
|
|
||||||
@@ -343,7 +346,9 @@
|
|||||||
beforeRecording : this.beforeRecording,
|
beforeRecording : this.beforeRecording,
|
||||||
afterRecording : this.afterRecording,
|
afterRecording : this.afterRecording,
|
||||||
pauseRecording : this.pauseRecording,
|
pauseRecording : this.pauseRecording,
|
||||||
micFailed : this.micFailed
|
micFailed : this.micFailed,
|
||||||
|
bitRate : this.bitRate,
|
||||||
|
sampleRate : this.sampleRate
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { Mp3Encoder } from 'lamejs'
|
|||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
this.bitRate = config.bitRate || 128
|
this.bitRate = config.bitRate
|
||||||
this.sampleRate = config.sampleRate || 44100
|
this.sampleRate = config.sampleRate
|
||||||
this.dataBuffer = []
|
this.dataBuffer = []
|
||||||
this.encoder = new Mp3Encoder(1, this.sampleRate, this.bitRate)
|
this.encoder = new Mp3Encoder(1, this.sampleRate, this.bitRate)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ export default class {
|
|||||||
this.pauseRecording = options.pauseRecording
|
this.pauseRecording = options.pauseRecording
|
||||||
this.afterRecording = options.afterRecording
|
this.afterRecording = options.afterRecording
|
||||||
this.micFailed = options.micFailed
|
this.micFailed = options.micFailed
|
||||||
|
this.bitRate = options.bitRate
|
||||||
|
this.sampleRate = options.sampleRate
|
||||||
|
|
||||||
this.bufferSize = 4096
|
this.bufferSize = 4096
|
||||||
this.records = []
|
this.records = []
|
||||||
@@ -37,7 +39,10 @@ export default class {
|
|||||||
.catch(this._micError.bind(this))
|
.catch(this._micError.bind(this))
|
||||||
this.isPause = false
|
this.isPause = false
|
||||||
this.isRecording = true
|
this.isRecording = true
|
||||||
this.lameEncoder = new Encoder({})
|
this.lameEncoder = new Encoder({
|
||||||
|
bitRate : this.bitRate,
|
||||||
|
sampleRate : this.sampleRate
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
|
|||||||
Reference in New Issue
Block a user