Add random ID for each record

This commit is contained in:
Gennady Grishkovtsov
2018-09-30 15:48:57 +03:00
parent 83ccce2374
commit 860f7e6158

View File

@@ -34,9 +34,9 @@ export default class {
this.context.close()
let encoder = new WavEncoder({
bufferSize: this.bufferSize,
sampleRate: this.context.sampleRate,
samples: this.samples
bufferSize : this.bufferSize,
sampleRate : this.context.sampleRate,
samples : this.samples
})
let audioBlob = encoder.getData()
@@ -45,15 +45,17 @@ export default class {
this.samples = []
this.records.push({
blob: audioBlob,
url: audioUrl,
duration: convertTimeMMSS(this.duration)
id : Date.now(),
blob : audioBlob,
duration : convertTimeMMSS(this.duration),
url : audioUrl
})
this._duration = 0
this.duration = 0
this.isPause = false
this.isRecording = false
this._duration = 0
this.duration = 0
if (this.afterStop) {
this.afterStop()
@@ -80,9 +82,9 @@ export default class {
_micCaptured (stream) {
this.context = new(window.AudioContext || window.webkitAudioContext)()
this.duration = this._duration
this.input = this.context.createMediaStreamSource(stream)
this.processor = this.context.createScriptProcessor(this.bufferSize, 1, 1)
this.duration = this._duration
this.stream = stream
this.processor.onaudioprocess = (ev) => {