From 008df364fec86c64aaf794e45f48b5524974ae89 Mon Sep 17 00:00:00 2001 From: alexspeaker Date: Wed, 28 Jan 2026 23:08:43 +0100 Subject: [PATCH] spero ultimo bugfix hls mobile --- data/changelog.xml | 2 +- js/app.js | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/data/changelog.xml b/data/changelog.xml index 7f52a12..cbe8276 100644 --- a/data/changelog.xml +++ b/data/changelog.xml @@ -3,7 +3,7 @@ - 2.1.2 (b) + 2.1.2 (c) Correzione e bugfix di problematiche varie. diff --git a/js/app.js b/js/app.js index 03fb4ed..fb9ebb2 100644 --- a/js/app.js +++ b/js/app.js @@ -535,13 +535,40 @@ document.addEventListener('DOMContentLoaded', function () { }); audioPlayer.addEventListener('error', function (e) { - console.error('Errore audio player:', e); - updatePlayState(false); - if (playerStatus) { - playerStatus.textContent = 'Errore di riproduzione'; + console.error('Errore audio player (Event):', e); + + if (audioPlayer.error) { + const err = audioPlayer.error; + console.error('Dettagli MediaError:', { + code: err.code, + message: err.message, + readableCode: getMediaErrorMessage(err.code) + }); + + // Mostra errore specifico all'utente se possibile + if (playerStatus) { + playerStatus.textContent = 'Errore: ' + getMediaErrorMessage(err.code); + } + } else { + if (playerStatus) { + playerStatus.textContent = 'Errore sconosciuto'; + } } + + updatePlayState(false); }); + // Helper per decodificare errori media + function getMediaErrorMessage(code) { + switch (code) { + case 1: return 'MEDIA_ERR_ABORTED (Aborted by user)'; + case 2: return 'MEDIA_ERR_NETWORK (Network error)'; + case 3: return 'MEDIA_ERR_DECODE (Decoding error)'; + case 4: return 'MEDIA_ERR_SRC_NOT_SUPPORTED (Format not supported)'; + default: return 'Unknown error code ' + code; + } + } + audioPlayer.addEventListener('waiting', function () { if (playerStatus) { playerStatus.textContent = 'Buffering...';