From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +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