updated to portret recognize and moved app-config

This commit is contained in:
2025-05-11 20:07:55 +03:00
parent 1909b16ec5
commit b07f086beb
6 changed files with 19 additions and 4 deletions

View File

@@ -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 = '<i class="fas fa-pause"></i>'; // 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();