diff --git a/data/changelog.xml b/data/changelog.xml index eed3754..3b107de 100644 --- a/data/changelog.xml +++ b/data/changelog.xml @@ -2,6 +2,14 @@ + + 2.4.0 + + Implementato il player video dedicato per la riproduzione dei canali visivi. + Correzione e bugfix di problematiche varie. + + + 2.3.0 diff --git a/data/tv.xml b/data/tv.xml index 83970a2..6eaa4d0 100644 --- a/data/tv.xml +++ b/data/tv.xml @@ -14,8 +14,8 @@ 1 Rc105 TV https://www.radiocitta105.it/wp-content/uploads/2020/06/26168468_1590103344416186_7025872599153073152_n-1.png - https://webtv.rpigroup.it/e1e55a4b-abec-4043-8f08-e2105b48b59b.m3u8 - https://webtv.rpigroup.it/memfs/e1e55a4b-abec-4043-8f08-e2105b48b59b.jpg + https://tv.rpigroup.net/memfs/a9699134-efb3-4932-b8db-5a49ae214031.m3u8 + https://tv.rpigroup.net/memfs/a9699134-efb3-4932-b8db-5a49ae214031.jpg \ No newline at end of file diff --git a/js/app.js b/js/app.js index 3095e55..68b3813 100644 --- a/js/app.js +++ b/js/app.js @@ -596,7 +596,127 @@ document.addEventListener('DOMContentLoaded', function () { */ function initializeTVPlayer() { console.log('TV Player inizializzato'); - // Implementare logica specifica per TV se necessario + + const video = document.getElementById('tvVideoPlayer'); + if (!video) { + console.log('Elemento video TV non trovato'); + return; + } + + // Cleanup istanza precedente se esiste + if (video.hlsInstance) { + video.hlsInstance.destroy(); + delete video.hlsInstance; + } + + const videoSrc = video.getAttribute('data-src'); + console.log('Video Source:', videoSrc); + + if (!videoSrc) { + console.error('Nessuna sorgente video specificata in data-src'); + return; + } + + // Creazione elemento per errori se non esiste giĆ  + let errorDisplay = video.parentNode.querySelector('.tv-error-display'); + if (!errorDisplay) { + errorDisplay = document.createElement('div'); + errorDisplay.className = 'tv-error-display'; + errorDisplay.style.display = 'none'; + errorDisplay.style.position = 'absolute'; + errorDisplay.style.top = '50%'; + errorDisplay.style.left = '50%'; + errorDisplay.style.transform = 'translate(-50%, -50%)'; + errorDisplay.style.backgroundColor = 'rgba(0, 0, 0, 0.8)'; + errorDisplay.style.color = '#fff'; + errorDisplay.style.padding = '20px'; + errorDisplay.style.borderRadius = '8px'; + errorDisplay.style.textAlign = 'center'; + errorDisplay.style.zIndex = '2000'; + errorDisplay.style.maxWidth = '90%'; + if (video.parentNode) { + video.parentNode.appendChild(errorDisplay); + // Assicurati che il parent sia relative per il posizionamento absolute + if (getComputedStyle(video.parentNode).position === 'static') { + video.parentNode.style.position = 'relative'; + } + } + } + + function showError(msg, details) { + console.error(msg, details); + errorDisplay.innerHTML = 'Errore:
' + msg + (details ? '
' + details + '' : ''); + errorDisplay.style.display = 'block'; + } + + // Controllo libreria HLS + if (typeof Hls === 'undefined') { + // Riprova tra poco se magari sta ancora caricando + setTimeout(() => { + if (typeof Hls === 'undefined') { + showError('Libreria HLS non caricata correttamente.'); + } else { + initializeTVPlayer(); // Riprova inizializzazione + } + }, 500); + return; + } + + if (Hls.isSupported()) { + console.log('HLS Supported - Loading stream'); + var hls = new Hls({ + debug: false, + enableWorker: true + }); + + hls.loadSource(videoSrc); + hls.attachMedia(video); + + hls.on(Hls.Events.MANIFEST_PARSED, function () { + console.log('TV Manifest Parsed - Ready to play'); + var playPromise = video.play(); + if (playPromise !== undefined) { + playPromise.catch(error => { + console.log('Autoplay blocked or failed:', error); + }); + } + }); + + // Gestione errori estesa + hls.on(Hls.Events.ERROR, function (event, data) { + console.warn('HLS Error:', data); + if (data.fatal) { + switch (data.type) { + case Hls.ErrorTypes.NETWORK_ERROR: + console.log('Network error, recovering...'); + hls.startLoad(); + break; + case Hls.ErrorTypes.MEDIA_ERROR: + console.log('Media error, recovering...'); + hls.recoverMediaError(); + break; + default: + showError('Errore fatale riproduzione.', data.type); + hls.destroy(); + break; + } + } + }); + + video.hlsInstance = hls; + + } else if (video.canPlayType('application/vnd.apple.mpegurl')) { + console.log('Native HLS Supported (Safari/iOS)'); + video.src = videoSrc; + video.addEventListener('loadedmetadata', function () { + video.play().catch(e => console.log("Autoplay iOS prevented")); + }); + video.addEventListener('error', function (e) { + showError('Errore riproduzione nativa.', e.message); + }); + } else { + showError('Il tuo browser non supporta HLS.'); + } } /** diff --git a/pages/page/player_tv.php b/pages/page/player_tv.php index e69de29..88f8cd8 100644 --- a/pages/page/player_tv.php +++ b/pages/page/player_tv.php @@ -0,0 +1,50 @@ +Errore: Stazione TV non trovata.'; + return; +} + +$station_id = (string)$station->id; +$station_name = (string)$station->name; +$station_logo = (string)$station->logo; +$station_stream = (string)$station->stream; +$station_poster = isset($station->poster) ? (string)$station->poster : ''; +?> + + +
+ + +
+ + + +
+ Logo +
+ +
+ + +
+ +
+ +
diff --git a/pages/page/tv.php b/pages/page/tv.php index c2db93d..78aca92 100644 --- a/pages/page/tv.php +++ b/pages/page/tv.php @@ -1,12 +1,27 @@ + +

TV

-

Guarda in streaming RC105 TV

+

Seleziona la webtv che vuoi guardare


-