fix: use isPlaying() in syncNowPlaying to handle bridge/native mode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-13 02:00:26 +02:00
1 parent 0c5fe53f13
commit 1e61d35018
2 files changed
+4 -2

No files matched your search

+2 -2
View File
@@ -2,7 +2,7 @@ import { S } from './state.js';
import { esc } from './utils.js';
import { coverUrl } from './api.js';
// Circular imports — safe (only used inside function bodies)
import { playCurrent, _syncNpDirect, dlSongLocal, npToggleStar, _syncOverlayState } from './player.js';
import { playCurrent, _syncNpDirect, dlSongLocal, npToggleStar, _syncOverlayState, isPlaying } from './player.js';
import { navigate } from './views.js';
import { openPlModal, showSongInfo } from './ui.js';
@@ -57,7 +57,7 @@ export function syncNowPlaying() {
if(shuffleBtn) shuffleBtn.classList.toggle('active', S.shuffle);
if(repeatBtn) repeatBtn.classList.toggle('active', S.repeat !== false);
if(volSlider) volSlider.value = Math.round(Math.sqrt(S.audio.volume) * 100);
const playing = !S.audio.paused;
const playing = isPlaying();
const npIcon = document.getElementById('np-play-icon');
if(npIcon) npIcon.innerHTML = playing
? '<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>'
+2
View File
@@ -425,6 +425,8 @@ export function togglePlay() {
if(S.audio.src) S.audio.paused ? S.audio.play() : S.audio.pause();
}
export const isPlaying = () => HAS_BRIDGE ? _nativePlaying : !S.audio.paused;
export function setPlayIcon(playing) {
document.getElementById('play-icon').innerHTML = playing
? '<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>'