updated to portret recognize and moved app-config
This commit is contained in:
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"player_orientation": "portrait", "player_name": "tv-terasa", "quickconnect_code": "8887779", "server_address": "digi-signage.moto-adv.com", "port": 80}
|
||||
1
app/static/app_config.json
Executable file
1
app/static/app_config.json
Executable file
@@ -0,0 +1 @@
|
||||
{"player_orientation": "landscape", "player_name": "tv-terasa", "quickconnect_code": "8887779", "server_address": "digi-signage.moto-adv.com", "port": 80}
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user