diff options
Diffstat (limited to 'app/index.php')
-rw-r--r-- | app/index.php | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/app/index.php b/app/index.php index 601c974..6de3cdf 100644 --- a/app/index.php +++ b/app/index.php @@ -1,6 +1,21 @@ <?php header("X-Frame-Options: DENY"); require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFILE; ?> +<!-- + +🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️ + + __ _ __ __ __ + / /__________ _____ _____ _____(_)___ _/ /_ / /______/ / + / __/ ___/ __ `/ __ \/ ___/ / ___/ / __ `/ __ \/ __/ ___/ / +/ /_/ / / /_/ / / / (__ ) / / / / /_/ / / / / /_(__ )_/ +\__/_/ \__,_/_/ /_/____/ /_/ /_/\__, /_/ /_/\__/____(_) + /____/ + +🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️🏳️⚧️ + +--> + <!doctype html> <html lang="en"> <head> @@ -271,6 +286,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI window.seekTo = (time) => { document.getElementById("player").contentDocument.getElementById("player-audio").currentTime = time; + updateAndroidNotification(); if (playingStella) { playerDocument.getElementById("player-audio-stella-side1").currentTime = playerDocument.getElementById("player-audio").currentTime; @@ -422,10 +438,16 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI } playerDocument.getElementById("player-audio").onplay = () => { + updateAndroidNotification(); + if (window.preloadedGains[window.currentSongID]) { window.currentNormalizationSource.connect(window.preloadedGains[window.currentSongID]); - window.currentNormalizationSource2.connect(window.preloadedGainsBoosted1[window.currentSongID]); - window.currentNormalizationSource3.connect(window.preloadedGainsBoosted2[window.currentSongID]); + + if (playingStella) { + window.currentNormalizationSource2.connect(window.preloadedGainsBoosted1[window.currentSongID]); + window.currentNormalizationSource3.connect(window.preloadedGainsBoosted2[window.currentSongID]); + } + window.preloadedGains[window.currentSongID].connect(window.currentNormalizationContext.destination); } @@ -447,10 +469,25 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI updateDisplay(); } + window.needsDurationChange = true; + + playerDocument.getElementById("player-audio").ondurationchange = () => { + if (window.needsDurationChange) { + updateAndroidNotification(); + window.needsDurationChange = false; + } + } + playerDocument.getElementById("player-audio").onpause = () => { if (window.preloadedGains[window.currentSongID]) { try { window.currentNormalizationSource.disconnect(window.preloadedGains[window.currentSongID]); + + if (playingStella) { + window.currentNormalizationSource2.disconnect(window.preloadedGainsBoosted1[window.currentSongID]); + window.currentNormalizationSource3.disconnect(window.preloadedGainsBoosted2[window.currentSongID]); + } + window.preloadedGains[window.currentSongID].disconnect(window.currentNormalizationContext.destination); } catch (e) { console.error(e); @@ -486,16 +523,19 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI } updateDisplay(); + updateAndroidNotification(); } } initializePlayerDocument(); - function updateDisplay() { + function updateAndroidNotification() { if (window.MistAndroid && currentSong) { window.MistAndroid.setNotificationData(currentSong.title, currentSong.artist, currentSong.album, Math.round(playerDocument.getElementById("player-audio").currentTime * 1000), Math.round(playerDocument.getElementById("player-audio").duration * 1000), !playerDocument.getElementById("player-audio").paused, buffering); } + } + function updateDisplay() { if (playerDocument.getElementById("player-audio").paused) { document.title = "Mist"; } else if (currentSong) { @@ -853,6 +893,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI window.currentSong = songs[id]; window.currentSongID = id; updateDisplay(); + updateAndroidNotification(); if (document.getElementById("ui").contentWindow.refreshQueue) document.getElementById("ui").contentWindow.refreshQueue(); let stellaCompatible = false; @@ -886,6 +927,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFI cleanupPreload(); preloadMore(); + window.needsDurationChange = true; if (!stellaCompatible) { if (!window.preloadedURLs[id]) { |