实时喊话需求变更

This commit is contained in:
yanran200730
2022-06-17 11:23:49 +08:00
parent 43d1e6634d
commit 4ae91369cb

View File

@@ -63,7 +63,7 @@
<span class="line19 animation"></span>
<span class="line20 animation"></span>
</div>
<h2>{{ time }}</h2>
<h2>{{ time }}S</h2>
</div>
</div>
</template>
@@ -93,8 +93,7 @@
isRecording: false,
recorder: null,
blobFile: null,
counterDownTime: 0,
time: '00:00:00',
time: 60,
timingTimeout: null,
equipmentList: [],
recordList: [],
@@ -192,13 +191,11 @@
},
timing () {
var durationObj = this.$dayjs.duration(this.counterDownTime * 1000)
var hours = durationObj.hours() > 9 ? durationObj.hours() : '0' + durationObj.hours()
var min = durationObj.minutes() > 9 ? durationObj.minutes() : '0' + durationObj.minutes()
var seconds = durationObj.seconds() > 9 ? durationObj.seconds() : '0' + durationObj.seconds()
this.time = this.time - 1
this.time = hours + ':' + min + ':' + seconds
this.counterDownTime++
if (this.time === 0) {
this.stop()
}
this.timingTimeout = setTimeout(() => {
this.timing()
}, 1000)
@@ -238,17 +235,16 @@
},
stop (isCancel) {
this.counterDownTime = 0
clearTimeout(this.timingTimeout)
this.recorder.stop((blob, duration) => {
this.recorder.close()
this.recorder = null
if (isCancel) {
this.time = 60
return false
}
this.time = '00:00:00'
let formData = {}
formData = new FormData()
formData.append('file', new window.File([blob], `${(new Date).getTime()}` ))
@@ -286,6 +282,8 @@
}).catch(() => {
this.isShow = false
})
this.time = 60
console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms')
}, msg => {
console.log('录音失败:' + msg)