voices
Some checks failed
Deploy Admin Panel / Deploy Admin Panel (push) Has been cancelled
Deploy Mnemo Cards / Deploy Backend (push) Has been cancelled
Deploy Admin Panel / Admin Panel Verification (push) Has been cancelled
Deploy Mnemo Cards / Deploy Web App (push) Has been cancelled
Deploy Mnemo Cards / Final Verification (push) Has been cancelled
Some checks failed
Deploy Admin Panel / Deploy Admin Panel (push) Has been cancelled
Deploy Mnemo Cards / Deploy Backend (push) Has been cancelled
Deploy Admin Panel / Admin Panel Verification (push) Has been cancelled
Deploy Mnemo Cards / Deploy Web App (push) Has been cancelled
Deploy Mnemo Cards / Final Verification (push) Has been cancelled
This commit is contained in:
parent
c9eef03aff
commit
aa67c02343
3 changed files with 9 additions and 21 deletions
|
|
@ -23,7 +23,7 @@ export const voicesApi = {
|
|||
addCardVoice: async (
|
||||
cardId: string,
|
||||
voiceUrl: string,
|
||||
language: string = 'es'
|
||||
language: string = 'en'
|
||||
): Promise<{ success: boolean; voice: VoiceDto }> => {
|
||||
const response = await adminApiClient.post(`/api/v2/admin/cards/${cardId}/voices`, {
|
||||
voiceUrl,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export function AudioUpload({
|
|||
label,
|
||||
value,
|
||||
onChange,
|
||||
language = 'es',
|
||||
language = 'en',
|
||||
onLanguageChange,
|
||||
accept = 'audio/*',
|
||||
maxSizeMB = 20, // Updated to match backend limit
|
||||
|
|
@ -173,18 +173,9 @@ export function AudioUpload({
|
|||
audioRef.current = null
|
||||
}
|
||||
|
||||
audio.onerror = (e: Event | string) => {
|
||||
audio.onerror = (e) => {
|
||||
console.error('Audio playback error:', e)
|
||||
let errorMessage = 'Failed to play audio. The file may be corrupted, in an unsupported format, or the URL may have expired.'
|
||||
|
||||
if (e instanceof Event) {
|
||||
const audioElement = e.target as HTMLAudioElement | null
|
||||
if (audioElement?.error) {
|
||||
errorMessage = `Failed to load audio: ${audioElement.error.message || 'Unknown error'}`
|
||||
}
|
||||
}
|
||||
|
||||
alert(errorMessage)
|
||||
alert('Failed to play audio. The file may be corrupted or in an unsupported format.')
|
||||
setIsPlaying(false)
|
||||
audioRef.current = null
|
||||
}
|
||||
|
|
@ -195,10 +186,7 @@ export function AudioUpload({
|
|||
|
||||
audio.play().catch((error) => {
|
||||
console.error('Audio play error:', error)
|
||||
const errorMessage = error instanceof Error
|
||||
? error.message
|
||||
: 'Failed to play audio'
|
||||
alert(`Failed to play audio: ${errorMessage}. Please check your browser audio settings.`)
|
||||
alert('Failed to play audio. Please check your browser audio settings.')
|
||||
setIsPlaying(false)
|
||||
audioRef.current = null
|
||||
})
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export default function CardsPage() {
|
|||
image: undefined as string | undefined,
|
||||
imageBack: undefined as string | undefined,
|
||||
voice: undefined as string | undefined,
|
||||
voiceLanguage: 'es',
|
||||
voiceLanguage: 'en',
|
||||
})
|
||||
|
||||
const limit = 20
|
||||
|
|
@ -173,7 +173,7 @@ export default function CardsPage() {
|
|||
image: undefined,
|
||||
imageBack: undefined,
|
||||
voice: undefined,
|
||||
voiceLanguage: 'es',
|
||||
voiceLanguage: 'en',
|
||||
})
|
||||
setIsDialogOpen(true)
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ export default function CardsPage() {
|
|||
image: card.image,
|
||||
imageBack: card.imageBack,
|
||||
voice: undefined,
|
||||
voiceLanguage: 'es',
|
||||
voiceLanguage: 'en',
|
||||
})
|
||||
setIsDialogOpen(true)
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ export default function CardsPage() {
|
|||
|
||||
const voice =
|
||||
formData.voice && formData.voice.trim()
|
||||
? { voiceUrl: formData.voice, language: formData.voiceLanguage || 'es' }
|
||||
? { voiceUrl: formData.voice, language: formData.voiceLanguage || 'en' }
|
||||
: undefined
|
||||
|
||||
if (isUpdate) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue