From 77950e48c76f4a3b29d01831d43039caba29888a Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 18 十一月 2025 14:12:42 +0800
Subject: [PATCH] 修改
---
app/components/base/audio-btn/audio.ts | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/app/components/base/audio-btn/audio.ts b/app/components/base/audio-btn/audio.ts
index 00797d0..baf675d 100644
--- a/app/components/base/audio-btn/audio.ts
+++ b/app/components/base/audio-btn/audio.ts
@@ -2,7 +2,7 @@
import { textToAudioStream } from '@/service/share'
declare global {
- // eslint-disable-next-line ts/consistent-type-definitions
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface Window {
ManagedMediaSource: any
}
@@ -21,9 +21,9 @@
isLoadData = false
url: string
isPublic: boolean
- callback: ((event: string) => void) | null
+ callback: ((event: string) => {}) | null
- constructor(streamUrl: string, isPublic: boolean, msgId: string | undefined, msgContent: string | null | undefined, voice: string | undefined, callback: ((event: string) => void) | null) {
+ constructor(streamUrl: string, isPublic: boolean, msgId: string | undefined, msgContent: string | null | undefined, voice: string | undefined, callback: ((event: string) => {}) | null) {
this.audioContext = new AudioContext()
this.msgId = msgId
this.msgContent = msgContent
@@ -68,7 +68,7 @@
})
}
- public setCallback(callback: ((event: string) => void) | null) {
+ public setCallback(callback: ((event: string) => {}) | null) {
this.callback = callback
if (callback) {
this.audio.addEventListener('ended', () => {
@@ -125,7 +125,7 @@
this.receiveAudioData(value)
}
}
- catch {
+ catch (error) {
this.isLoadData = false
this.callback && this.callback('error')
}
@@ -211,6 +211,10 @@
this.audioContext.suspend()
}
+ private cancer() {
+
+ }
+
private receiveAudioData(unit8Array: Uint8Array) {
if (!unit8Array) {
this.finishStream()
--
Gitblit v1.8.0