Skip to content

Commit 11d4a19

Browse files
committed
fix audio
1 parent 59123a0 commit 11d4a19

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

webview/src/hooks/useAudioPlayer.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ export function useAudioPlayer(options?: UseAudioPlayerOptions) {
7171
console.error('[AUDIO] Error testing URL:', fetchError);
7272
}
7373

74-
// Handle case when too many audio elements exist
75-
if (window.performance && window.performance.memory) {
76-
console.log('[AUDIO] Current memory usage:',
77-
Math.round(window.performance.memory.usedJSHeapSize / 1024 / 1024) + "MB");
78-
}
79-
8074
// Create new audio element or reuse existing
8175
let audio: HTMLAudioElement;
8276
if (audioRef.current) {
@@ -152,7 +146,7 @@ export function useAudioPlayer(options?: UseAudioPlayerOptions) {
152146
audio.onerror = (e) => {
153147
const errorCode = audio.error ? audio.error.code : 'unknown';
154148
const errorMessage = audio.error ? audio.error.message : 'unknown error';
155-
console.error(`[AUDIO] Error loading audio: code=${errorCode}, message=${errorMessage}`);
149+
console.error(e, `[AUDIO] Error loading audio: code=${errorCode}, message=${errorMessage}`);
156150

157151
setIsLoading(false);
158152
const error = new Error(`Error loading audio: ${errorCode} - ${errorMessage}`);
@@ -181,7 +175,7 @@ export function useAudioPlayer(options?: UseAudioPlayerOptions) {
181175

182176
// Start loading with timeout
183177
console.log('[AUDIO] Starting to load audio');
184-
const loadingPromise = new Promise<void>((resolve, reject) => {
178+
const loadingPromise = new Promise<void>((resolve) => {
185179
const loadTimeout = setTimeout(() => {
186180
console.log('[AUDIO] Load timeout reached, continuing anyway');
187181
// Consider audio ready even if timeout is reached

0 commit comments

Comments
 (0)