spero ultimo bugfix hls mobile
This commit is contained in:
35
js/app.js
35
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...';
|
||||
|
||||
Reference in New Issue
Block a user