diff --git a/index.html b/index.html index 08a88c0..a387dd6 100644 --- a/index.html +++ b/index.html @@ -2218,23 +2218,39 @@ Recommended Songs - + - - + + + + + + Start Infinite Radio - + Finding more songs for you... - + { if (player.activeElement !== element) return; - + if (!element.src) return; const error = element.error; let errorMsg = 'Unknown error'; if (error) { switch (error.code) { - case 1: errorMsg = 'Playback aborted'; break; - case 2: errorMsg = 'Network error'; break; - case 3: errorMsg = 'Decoding error'; break; - case 4: errorMsg = 'Source not supported'; break; + case 1: + errorMsg = 'Playback aborted'; + break; + case 2: + errorMsg = 'Network error'; + break; + case 3: + errorMsg = 'Decoding error'; + break; + case 4: + errorMsg = 'Source not supported'; + break; } if (error.message) errorMsg += `: ${error.message}`; } @@ -270,7 +278,6 @@ export function initializePlayerEvents(player, audioPlayer, scrobbler, ui) { }); } - // Waveform Masking Logic const updateWaveform = async () => { const progressBar = document.getElementById('progress-bar'); @@ -452,7 +459,7 @@ function initializeSmoothSliders(player) { if (activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } @@ -481,7 +488,7 @@ function initializeSmoothSliders(player) { if (activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } @@ -549,7 +556,7 @@ function initializeSmoothSliders(player) { if (activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } @@ -569,7 +576,7 @@ function initializeSmoothSliders(player) { if (activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } @@ -585,7 +592,7 @@ function initializeSmoothSliders(player) { if (activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } @@ -606,7 +613,7 @@ function initializeSmoothSliders(player) { if (delta > 0 && activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } @@ -629,7 +636,7 @@ function initializeSmoothSliders(player) { if (delta > 0 && activeEl.muted) { activeEl.muted = false; localStorage.setItem('muted', false); - + const inactiveEl = player.currentTrack?.type === 'video' ? player.audio : player.video; if (inactiveEl) inactiveEl.muted = false; } diff --git a/js/player.js b/js/player.js index e7a7a5a..a6858ae 100644 --- a/js/player.js +++ b/js/player.js @@ -103,7 +103,6 @@ export class Player { } }); - this._setupVideoSync(); } @@ -119,8 +118,7 @@ export class Player { if (this.video.readyState >= 2 && (this.audio.readyState > 0 || this.audio.src)) { this.audio.currentTime = this.video.currentTime; } - } catch (err) { - } + } catch (err) {} } const syncedEvent = new Event(eventName, { bubbles: e.bubbles, cancelable: e.cancelable }); @@ -467,8 +465,7 @@ export class Player { this.hls = new Hls(); this.hls.loadSource(url); this.hls.attachMedia(video); - this.hls.on(Hls.Events.MANIFEST_PARSED, () => { - }); + this.hls.on(Hls.Events.MANIFEST_PARSED, () => {}); this.hls.on(Hls.Events.ERROR, (event, data) => { if (data.fatal) { console.warn('HLS fatal error:', data.type); @@ -706,10 +703,16 @@ export class Player { if (!played) return; } else if (track.type === 'video') { if (window.monochromeUi) { - const isInFullscreen = document.getElementById('fullscreen-cover-overlay')?.style.display === 'flex'; + const isInFullscreen = + document.getElementById('fullscreen-cover-overlay')?.style.display === 'flex'; if (!isInFullscreen) { const lyricsManager = window.monochromeUi.lyricsManager; - window.monochromeUi.showFullscreenCover(track, this.getNextTrack(), lyricsManager, activeElement); + window.monochromeUi.showFullscreenCover( + track, + this.getNextTrack(), + lyricsManager, + activeElement + ); } } @@ -948,24 +951,24 @@ export class Player { const recommendations = await this.api.getRecommendedTracksForPlaylist(seeds, 10); if (recommendations && recommendations.length > 0) { const currentQueueIds = new Set(this.getCurrentQueue().map((t) => t.id)); - + const [favorites, userPlaylists] = await Promise.all([ db.getFavorites('track'), db.getAll('user_playlists'), ]); - + const knownTrackIds = new Set([ - ...favorites.map(t => t.id), - ...userPlaylists.flatMap(p => (p.tracks || []).map(t => t.id)) + ...favorites.map((t) => t.id), + ...userPlaylists.flatMap((p) => (p.tracks || []).map((t) => t.id)), ]); const newTracks = recommendations.filter((t) => { if (currentQueueIds.has(t.id)) return false; - + if (knownTrackIds.has(t.id)) { return Math.random() < 0.2; } - + return true; }); diff --git a/styles.css b/styles.css index 6f4bc31..dfc3a65 100644 --- a/styles.css +++ b/styles.css @@ -3168,6 +3168,7 @@ input:checked + .slider::before { opacity: 0; transform: translate(-50%, 10px); } + to { opacity: 1; transform: translate(-50%, 0);