From 282c372de35bb1f8ac5cdabb0f81a033b66f5619 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 3 Jul 2026 17:50:43 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20corregir=20reproducci=C3=B3n=20de=20audi?= =?UTF-8?q?o=20en=20chat=20turnero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - URL absoluta para local_file y media_url_external (igual que conversations.php) - Múltiples con MIME types (ogg, mpeg, wav, webm) para compatibilidad - onerror handler cuando el archivo no está disponible - Fallback visible cuando mediaSrc es null ("Audio pendiente de descarga") Co-Authored-By: Claude Sonnet 4.6 --- modules/turnero/views/chat.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/turnero/views/chat.php b/modules/turnero/views/chat.php index 37e2e38..77e3acc 100644 --- a/modules/turnero/views/chat.php +++ b/modules/turnero/views/chat.php @@ -752,7 +752,9 @@ function buildBubble(msg) { div.dataset.msgId = msg.id; div.dataset.waId = msg.message_id || ''; - const mediaSrc = msg.local_file ? ('../' + msg.local_file) : (msg.media_url_external || null); + const _base = window.location.origin; + const _toAbs = p => p ? (p.startsWith('http') ? p : `${_base}/${p.replace(/^\//, '')}`) : null; + const mediaSrc = msg.local_file ? _toAbs(msg.local_file) : (msg.media_url_external ? _toAbs(msg.media_url_external) : null); let content = ''; if (msg.message_type === 'image' && mediaSrc) { @@ -762,8 +764,18 @@ function buildBubble(msg) { } else if (msg.message_type === 'video' && mediaSrc) { content = ``; if (msg.content) content += `
${escHtml(msg.content)}
`; - } else if (msg.message_type === 'audio' && mediaSrc) { - content = ``; + } else if (msg.message_type === 'audio') { + if (mediaSrc) { + content = ``; + } else { + content = `
Audio pendiente de descarga
`; + } } else if (msg.message_type === 'document' && mediaSrc) { const icon = (msg.mime_type || '').includes('pdf') ? 'fa-file-pdf' : (msg.mime_type || '').includes('spreadsheet') || (msg.mime_type || '').includes('excel') ? 'fa-file-excel' :