From b07f086bebee0462517c8a6017196246aadccc3f Mon Sep 17 00:00:00 2001 From: Scheianu Ionut Date: Sun, 11 May 2025 20:07:55 +0300 Subject: [PATCH] updated to portret recognize and moved app-config --- app/__pycache__/app.cpython-312.pyc | Bin 13046 -> 13053 bytes app/app.py | 2 +- app/app_config.json | 1 - app/static/app_config.json | 1 + app/static/index.html | 17 ++++++++++++++++- app/static/settings.html | 2 +- 6 files changed, 19 insertions(+), 4 deletions(-) delete mode 100755 app/app_config.json create mode 100755 app/static/app_config.json diff --git a/app/__pycache__/app.cpython-312.pyc b/app/__pycache__/app.cpython-312.pyc index d4b45bdf1163c667c88c7c2b5edc8e737b06b650..9dc326e298ffdd8f41108abfcd9fba450ae63473 100644 GIT binary patch delta 44 ycmeyC`ZtyLG%qg~0}xEPs*usPk=KNUQ$kO_xFoS8GkLQ!%Xb|{oz2#UyBPsW5)M)T delta 37 rcmeyH`Yo0BG%qg~0}$w~P{>H!$ZNvFB&fI9i{-lxqv~cS!`+Mk+2jh` diff --git a/app/app.py b/app/app.py index a1e1979..9505a25 100755 --- a/app/app.py +++ b/app/app.py @@ -19,7 +19,7 @@ player = vlc_instance.media_player_new() # File paths PLAYLIST_FILE = './static/resurse/playlist.json' -APP_CONFIG_FILE = './app_config.json' +APP_CONFIG_FILE = './static/app_config.json' # Moved to the static folder RESOURCES_FOLDER = './static/resurse' # Ensure the resources folder exists diff --git a/app/app_config.json b/app/app_config.json deleted file mode 100755 index be9d181..0000000 --- a/app/app_config.json +++ /dev/null @@ -1 +0,0 @@ -{"player_orientation": "portrait", "player_name": "tv-terasa", "quickconnect_code": "8887779", "server_address": "digi-signage.moto-adv.com", "port": 80} \ No newline at end of file diff --git a/app/static/app_config.json b/app/static/app_config.json new file mode 100755 index 0000000..ee14a0e --- /dev/null +++ b/app/static/app_config.json @@ -0,0 +1 @@ +{"player_orientation": "landscape", "player_name": "tv-terasa", "quickconnect_code": "8887779", "server_address": "digi-signage.moto-adv.com", "port": 80} \ No newline at end of file diff --git a/app/static/index.html b/app/static/index.html index 922dae7..0c66e8c 100755 --- a/app/static/index.html +++ b/app/static/index.html @@ -92,6 +92,7 @@ let playbackInterval; let inactivityTimer; let isPaused = false; + let isMuted = true; // Start with muted video // Function to load the playlist from updated_playlist.json async function loadPlaylist() { @@ -122,7 +123,7 @@ } // Function to play the current item in the playlist - function playCurrentItem() { + async function playCurrentItem() { if (currentIndex >= playlist.length) { currentIndex = 0; // Loop back to the beginning } @@ -147,6 +148,7 @@ video.src = currentItem.url; video.autoplay = true; video.controls = false; + video.muted = isMuted; // Start muted if isMuted is true playlistContainer.appendChild(video); // Ensure the video starts playing @@ -164,6 +166,15 @@ } } + // Function to unmute the video + function unmuteVideo() { + isMuted = false; // Set isMuted to false + const video = playlistContainer.querySelector('video'); + if (video) { + video.muted = false; // Unmute the video + } + } + // Function to stop playback function stopMedia() { clearTimeout(playbackInterval); @@ -172,6 +183,7 @@ // Function to play the previous item function previousMedia() { + unmuteVideo(); // Unmute the video stopMedia(); currentIndex = (currentIndex - 1 + playlist.length) % playlist.length; playCurrentItem(); @@ -179,11 +191,13 @@ // Function to refresh the playlist function refreshPlaylist() { + unmuteVideo(); // Unmute the video loadPlaylist(); // Reload the playlist } // Function to toggle play/pause function togglePlayPause() { + unmuteVideo(); // Unmute the video isPaused = !isPaused; if (isPaused) { playPauseButton.innerHTML = ''; // Change to pause icon @@ -195,6 +209,7 @@ // Function to play the next item function nextMedia() { + unmuteVideo(); // Unmute the video stopMedia(); currentIndex = (currentIndex + 1) % playlist.length; playCurrentItem(); diff --git a/app/static/settings.html b/app/static/settings.html index 6d905d3..1c38938 100755 --- a/app/static/settings.html +++ b/app/static/settings.html @@ -83,7 +83,7 @@ // Load configuration on page load async function loadConfig() { - const response = await fetch(`${apiBase}/config`); + const response = await fetch('/static/app_config.json'); // Updated path for app_config.json const config = await response.json(); document.getElementById('player_orientation').value = config.player_orientation; document.getElementById('player_name').value = config.player_name;