mirror of
https://github.com/kevin-DL/vue-audio-recorder.git
synced 2026-01-24 00:15:27 +00:00
Add random ID for each record
This commit is contained in:
@@ -34,9 +34,9 @@ export default class {
|
|||||||
this.context.close()
|
this.context.close()
|
||||||
|
|
||||||
let encoder = new WavEncoder({
|
let encoder = new WavEncoder({
|
||||||
bufferSize: this.bufferSize,
|
bufferSize : this.bufferSize,
|
||||||
sampleRate: this.context.sampleRate,
|
sampleRate : this.context.sampleRate,
|
||||||
samples: this.samples
|
samples : this.samples
|
||||||
})
|
})
|
||||||
|
|
||||||
let audioBlob = encoder.getData()
|
let audioBlob = encoder.getData()
|
||||||
@@ -45,15 +45,17 @@ export default class {
|
|||||||
this.samples = []
|
this.samples = []
|
||||||
|
|
||||||
this.records.push({
|
this.records.push({
|
||||||
blob: audioBlob,
|
id : Date.now(),
|
||||||
url: audioUrl,
|
blob : audioBlob,
|
||||||
duration: convertTimeMMSS(this.duration)
|
duration : convertTimeMMSS(this.duration),
|
||||||
|
url : audioUrl
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this._duration = 0
|
||||||
|
this.duration = 0
|
||||||
|
|
||||||
this.isPause = false
|
this.isPause = false
|
||||||
this.isRecording = false
|
this.isRecording = false
|
||||||
this._duration = 0
|
|
||||||
this.duration = 0
|
|
||||||
|
|
||||||
if (this.afterStop) {
|
if (this.afterStop) {
|
||||||
this.afterStop()
|
this.afterStop()
|
||||||
@@ -80,9 +82,9 @@ export default class {
|
|||||||
|
|
||||||
_micCaptured (stream) {
|
_micCaptured (stream) {
|
||||||
this.context = new(window.AudioContext || window.webkitAudioContext)()
|
this.context = new(window.AudioContext || window.webkitAudioContext)()
|
||||||
|
this.duration = this._duration
|
||||||
this.input = this.context.createMediaStreamSource(stream)
|
this.input = this.context.createMediaStreamSource(stream)
|
||||||
this.processor = this.context.createScriptProcessor(this.bufferSize, 1, 1)
|
this.processor = this.context.createScriptProcessor(this.bufferSize, 1, 1)
|
||||||
this.duration = this._duration
|
|
||||||
this.stream = stream
|
this.stream = stream
|
||||||
|
|
||||||
this.processor.onaudioprocess = (ev) => {
|
this.processor.onaudioprocess = (ev) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user