WIP: global player pt. 3 monstrosity
This commit is contained in:
@@ -75,8 +75,19 @@
|
||||
// ... existing effect for playback ...
|
||||
$effect(() => {
|
||||
const track = player.currentTrack;
|
||||
if (track && audioEl) {
|
||||
// ...
|
||||
if (audioEl) {
|
||||
if (track) {
|
||||
const newSrc = track.src;
|
||||
if (audioEl.src !== newSrc) {
|
||||
audioEl.src = newSrc;
|
||||
audioEl.play().catch((e) => {
|
||||
console.warn("Autoplay blocked or failed", e);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
audioEl.removeAttribute("src");
|
||||
}
|
||||
|
||||
// Update MediaSession playback state
|
||||
if ("mediaSession" in navigator) {
|
||||
navigator.mediaSession.playbackState = audioEl.paused
|
||||
|
||||
Reference in New Issue
Block a user