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
|
# File paths
|
||||||
PLAYLIST_FILE = './static/resurse/playlist.json'
|
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'
|
RESOURCES_FOLDER = './static/resurse'
|
||||||
|
|
||||||
# Ensure the resources folder exists
|
# 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 playbackInterval;
|
||||||
let inactivityTimer;
|
let inactivityTimer;
|
||||||
let isPaused = false;
|
let isPaused = false;
|
||||||
|
let isMuted = true; // Start with muted video
|
||||||
|
|
||||||
// Function to load the playlist from updated_playlist.json
|
// Function to load the playlist from updated_playlist.json
|
||||||
async function loadPlaylist() {
|
async function loadPlaylist() {
|
||||||
@@ -122,7 +123,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Function to play the current item in the playlist
|
// Function to play the current item in the playlist
|
||||||
function playCurrentItem() {
|
async function playCurrentItem() {
|
||||||
if (currentIndex >= playlist.length) {
|
if (currentIndex >= playlist.length) {
|
||||||
currentIndex = 0; // Loop back to the beginning
|
currentIndex = 0; // Loop back to the beginning
|
||||||
}
|
}
|
||||||
@@ -147,6 +148,7 @@
|
|||||||
video.src = currentItem.url;
|
video.src = currentItem.url;
|
||||||
video.autoplay = true;
|
video.autoplay = true;
|
||||||
video.controls = false;
|
video.controls = false;
|
||||||
|
video.muted = isMuted; // Start muted if isMuted is true
|
||||||
playlistContainer.appendChild(video);
|
playlistContainer.appendChild(video);
|
||||||
|
|
||||||
// Ensure the video starts playing
|
// 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 to stop playback
|
||||||
function stopMedia() {
|
function stopMedia() {
|
||||||
clearTimeout(playbackInterval);
|
clearTimeout(playbackInterval);
|
||||||
@@ -172,6 +183,7 @@
|
|||||||
|
|
||||||
// Function to play the previous item
|
// Function to play the previous item
|
||||||
function previousMedia() {
|
function previousMedia() {
|
||||||
|
unmuteVideo(); // Unmute the video
|
||||||
stopMedia();
|
stopMedia();
|
||||||
currentIndex = (currentIndex - 1 + playlist.length) % playlist.length;
|
currentIndex = (currentIndex - 1 + playlist.length) % playlist.length;
|
||||||
playCurrentItem();
|
playCurrentItem();
|
||||||
@@ -179,11 +191,13 @@
|
|||||||
|
|
||||||
// Function to refresh the playlist
|
// Function to refresh the playlist
|
||||||
function refreshPlaylist() {
|
function refreshPlaylist() {
|
||||||
|
unmuteVideo(); // Unmute the video
|
||||||
loadPlaylist(); // Reload the playlist
|
loadPlaylist(); // Reload the playlist
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to toggle play/pause
|
// Function to toggle play/pause
|
||||||
function togglePlayPause() {
|
function togglePlayPause() {
|
||||||
|
unmuteVideo(); // Unmute the video
|
||||||
isPaused = !isPaused;
|
isPaused = !isPaused;
|
||||||
if (isPaused) {
|
if (isPaused) {
|
||||||
playPauseButton.innerHTML = '<i class="fas fa-pause"></i>'; // Change to pause icon
|
playPauseButton.innerHTML = '<i class="fas fa-pause"></i>'; // Change to pause icon
|
||||||
@@ -195,6 +209,7 @@
|
|||||||
|
|
||||||
// Function to play the next item
|
// Function to play the next item
|
||||||
function nextMedia() {
|
function nextMedia() {
|
||||||
|
unmuteVideo(); // Unmute the video
|
||||||
stopMedia();
|
stopMedia();
|
||||||
currentIndex = (currentIndex + 1) % playlist.length;
|
currentIndex = (currentIndex + 1) % playlist.length;
|
||||||
playCurrentItem();
|
playCurrentItem();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
// Load configuration on page load
|
// Load configuration on page load
|
||||||
async function loadConfig() {
|
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();
|
const config = await response.json();
|
||||||
document.getElementById('player_orientation').value = config.player_orientation;
|
document.getElementById('player_orientation').value = config.player_orientation;
|
||||||
document.getElementById('player_name').value = config.player_name;
|
document.getElementById('player_name').value = config.player_name;
|
||||||
|
|||||||
Reference in New Issue
Block a user