|
@@ -88,7 +88,7 @@ export default defineComponent({
|
|
|
|
|
|
const countdown = ref(0)
|
|
|
let interval: NodeJS.Timer
|
|
|
- let recordIng = false
|
|
|
+ let recordIng = ref(false)
|
|
|
const start = () => {
|
|
|
showBottomBar.value = false
|
|
|
countdown.value = 2
|
|
@@ -96,7 +96,7 @@ export default defineComponent({
|
|
|
if (--countdown.value <= 0) {
|
|
|
clearInterval(interval)
|
|
|
videoRecorder.startRecord()
|
|
|
- recordIng = true
|
|
|
+ recordIng.value = true
|
|
|
} else {
|
|
|
interval = setTimeout(timeiffe, 300)
|
|
|
}
|
|
@@ -112,16 +112,25 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const pause = () => {
|
|
|
- console.error('停止了')
|
|
|
if (countdown.value === 0 && recordIng) {
|
|
|
videoRecorder.endRecord()
|
|
|
- recordIng = false
|
|
|
+ recordIng.value = false
|
|
|
}
|
|
|
countdown.value = 0
|
|
|
showBottomBar.value = true
|
|
|
clearInterval(interval)
|
|
|
}
|
|
|
|
|
|
+ watchEffect((onCleanup) => {
|
|
|
+ if (recordIng.value) {
|
|
|
+ const timeout = setTimeout(() => {
|
|
|
+ // 超过30分钟自动结束
|
|
|
+ pause()
|
|
|
+ }, 10 * 1000)
|
|
|
+ onCleanup(() => clearTimeout(timeout))
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
const blobs: File[] = shallowReactive([])
|
|
|
videoRecorder.off('*')
|
|
|
videoRecorder.on('record', blob => {
|