Merge branch 'main' of github.com:monochrome-music/monochrome
This commit is contained in:
commit
49592e38a3
5 changed files with 61 additions and 37 deletions
36
index.html
36
index.html
|
|
@ -2218,23 +2218,39 @@
|
|||
<section class="content-section">
|
||||
<div class="header-actions">
|
||||
<h2 class="section-title">Recommended Songs</h2>
|
||||
<div style="display: flex; gap: 8px;">
|
||||
<div style="display: flex; gap: 8px">
|
||||
<button
|
||||
class="btn-primary"
|
||||
id="home-start-infinite-radio-btn"
|
||||
title="Start Infinite Radio"
|
||||
style="display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 0.85rem;"
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 12px;
|
||||
font-size: 0.85rem;
|
||||
"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"/><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.4"/><circle cx="12" cy="12" r="2"/><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.4"/><path d="M19.1 4.9C23 8.8 23 15.2 19.1 19.1"/>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9" />
|
||||
<path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.4" />
|
||||
<circle cx="12" cy="12" r="2" />
|
||||
<path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.4" />
|
||||
<path d="M19.1 4.9C23 8.8 23 15.2 19.1 19.1" />
|
||||
</svg>
|
||||
Start Infinite Radio
|
||||
</button>
|
||||
<button
|
||||
class="btn-secondary"
|
||||
id="refresh-songs-btn"
|
||||
title="Refresh"
|
||||
>
|
||||
<button class="btn-secondary" id="refresh-songs-btn" title="Refresh">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
|
|
@ -5627,7 +5643,7 @@
|
|||
<div id="radio-loading-indicator">
|
||||
<div class="animate-spin"></div>
|
||||
<span>Finding more songs for you...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button id="shuffle-btn" title="Shuffle">
|
||||
<svg
|
||||
|
|
|
|||
|
|
@ -348,7 +348,6 @@ class AudioContextManager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
changeSource(audioElement) {
|
||||
if (!this.audioContext) {
|
||||
this.init(audioElement);
|
||||
|
|
@ -360,8 +359,7 @@ class AudioContextManager {
|
|||
if (this.source) {
|
||||
try {
|
||||
this.source.disconnect();
|
||||
} catch (e) {
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
this.audio = audioElement;
|
||||
|
|
@ -389,8 +387,7 @@ class AudioContextManager {
|
|||
// Disconnect everything first
|
||||
try {
|
||||
this.source.disconnect();
|
||||
} catch (e) {
|
||||
}
|
||||
} catch (e) {}
|
||||
this.outputNode.disconnect();
|
||||
if (this.volumeNode) {
|
||||
this.volumeNode.disconnect();
|
||||
|
|
|
|||
33
js/events.js
33
js/events.js
|
|
@ -176,17 +176,25 @@ export function initializePlayerEvents(player, audioPlayer, scrobbler, ui) {
|
|||
|
||||
element.addEventListener('error', (e) => {
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
21
js/player.js
21
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -966,11 +969,11 @@ export class Player {
|
|||
|
||||
const newTracks = recommendations.filter((t) => {
|
||||
if (currentQueueIds.has(t.id)) return false;
|
||||
|
||||
|
||||
if (knownTrackIds.has(t.id)) {
|
||||
return Math.random() < 0.05;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3168,6 +3168,7 @@ input:checked + .slider::before {
|
|||
opacity: 0;
|
||||
transform: translate(-50%, 10px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue