Skip to content

Commit 39beda5

Browse files
committed
revert AudioPlayer reason changes
1 parent c7d1eae commit 39beda5

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/apps/call/Telephone.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { AudioPlayer } from '~/common/util/audio/AudioPlayer';
2222
import { Link } from '~/common/components/Link';
2323
import { OptimaPanelGroupedList } from '~/common/layout/optima/panel/OptimaPanelGroupedList';
2424
import { OptimaPanelIn, OptimaToolbarIn } from '~/common/layout/optima/portals/OptimaPortalsIn';
25-
import { PhVoice } from '~/common/components/icons/phosphor/PhVoice';
2625
import { SpeechResult, useSpeechRecognition } from '~/common/components/speechrecognition/useSpeechRecognition';
2726
import { clipboardInterceptCtrlCForCleanup } from '~/common/util/clipboardUtils';
2827
import { conversationTitle, remapMessagesSysToUsr } from '~/common/stores/chat/chat.conversation';
@@ -31,7 +30,7 @@ import { createErrorContentFragment } from '~/common/stores/chat/chat.fragments'
3130
import { launchAppChat, navigateToIndex } from '~/common/app.routes';
3231
import { useChatStore } from '~/common/stores/chat/store-chats';
3332
import { useGlobalShortcuts } from '~/common/components/shortcuts/useGlobalShortcuts';
34-
import { usePlayUrl } from '~/common/util/audio/usePlayUrl';
33+
import { usePlayUrlInterval } from './state/usePlayUrlInterval';
3534

3635
import type { AppCallIntent } from './AppCall';
3736
import { CallAvatar } from './components/CallAvatar';
@@ -132,7 +131,7 @@ export function Telephone(props: {
132131
}, [isRinging, isConnected]);
133132

134133
// ringtone
135-
usePlayUrl(isRinging ? '/sounds/chat-ringtone.mp3' : null, 300, 2800 * 2);
134+
usePlayUrlInterval(isRinging ? '/sounds/chat-ringtone.mp3' : null, 300, 2800 * 2);
136135

137136

138137
/// Shortcuts
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
23
import { AudioPlayer } from '~/common/util/audio/AudioPlayer';
34

45

@@ -8,7 +9,7 @@ import { AudioPlayer } from '~/common/util/audio/AudioPlayer';
89
* @param firstDelay The delay before the first play, in milliseconds.
910
* @param repeatMs The delay between each repeat, in milliseconds. If 0, the sound will only play once.
1011
*/
11-
export function usePlayUrl(url: string | null, firstDelay: number = 0, repeatMs: number = 0) {
12+
export function usePlayUrlInterval(url: string | null, firstDelay: number = 0, repeatMs: number = 0) {
1213
React.useEffect(() => {
1314
if (!url) return;
1415

src/common/util/audio/AudioPlayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export namespace AudioPlayer {
33
/**
44
* Plays an audio file from a URL (e.g. an MP3 file).
55
*/
6-
export async function playUrl(url: string, nbOpts?: any): Promise<void> {
6+
export async function playUrl(url: string): Promise<void> {
77
return new Promise((resolve, reject) => {
88
const audio = new Audio(url);
99
audio.onended = () => resolve();

src/modules/aix/client/aix.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ async function _aixChatGenerateContent_LL(
720720
abortSignal,
721721
(audio) => {
722722
const audioUrl = URL.createObjectURL(audio.blob);
723-
void AudioPlayer.playUrl(audioUrl, { label: audio.label || 'AI Audio' })
723+
void AudioPlayer.playUrl(audioUrl)
724724
.finally(() => URL.revokeObjectURL(audioUrl));
725725
},
726726
);

src/modules/speex/components/SpeexVoiceSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function SpeexVoiceSelect(props: {
6868
enabled: !!previewUrl,
6969
queryKey: ['speex-voice-preview', previewUrl],
7070
queryFn: async ({ signal }) =>
71-
AudioPlayer.playUrl(previewUrl!, { label: `Voice Preview${selectedVoice?.name ? ` (${selectedVoice.name})` : ''}`, signal }),
71+
AudioPlayer.playUrl(previewUrl!),
7272
});
7373

7474

0 commit comments

Comments
 (0)