add temp album art
Hunter
Tuesday, October 28th, 2025 at 11:48 PM
Binary files differ.
6 const progressBar = document.getElementById('progressBar');
7 const progressContainer = document.getElementById('progressContainer');
8 const audio = document.getElementById('audioPlayer');
9 +audio.controls = true; // Enable controls for iOS media session
10
11 let currentSongIndex = 0;
12 let isPlaying = false;
69
70 // Update media session metadata
71 if ('mediaSession' in navigator) {
72 + // Convert relative path to absolute URL for media session
73 + const albumArtUrl = new URL('resources/album_art.jpg', window.location.href).href;
74 navigator.mediaSession.metadata = new MediaMetadata({
75 title: song.title,
- artist: song.artist
76 + artist: song.artist,
77 + artwork: [
78 + { src: albumArtUrl, sizes: '860x860', type: 'image/jpeg' },
79 + { src: albumArtUrl, sizes: '512x512', type: 'image/jpeg' },
80 + { src: albumArtUrl, sizes: '256x256', type: 'image/jpeg' },
81 + { src: albumArtUrl, sizes: '128x128', type: 'image/jpeg' }
82 + ]
83 });
84 +
85 + // Set action handlers after playback starts (required for iOS)
86 + // Explicitly set seek handlers to null so iOS shows next/prev instead
87 + navigator.mediaSession.setActionHandler('play', () => {
88 + if (playerReady && !isPlaying) {
89 + togglePlayPause();
90 + }
91 + });
92 +
93 + navigator.mediaSession.setActionHandler('pause', () => {
94 + if (playerReady && isPlaying) {
95 + togglePlayPause();
96 + }
97 + });
98 +
99 + navigator.mediaSession.setActionHandler('previoustrack', () => {
100 + if (playerReady) {
101 + prevSong();
102 + }
103 + });
104 +
105 + navigator.mediaSession.setActionHandler('nexttrack', () => {
106 + if (playerReady) {
107 + nextSong();
108 + }
109 + });
110 +
111 + // Explicitly set seek handlers to null to show track controls instead
112 + navigator.mediaSession.setActionHandler('seekbackward', null);
113 + navigator.mediaSession.setActionHandler('seekforward', null);
114 }
115 });
116
664 }
665 });
666
-// Media key controls
-navigator.mediaSession.metadata = new MediaMetadata({
- title: 'vibe capsule',
- artist: 'MP3 Player'
-});
-
-navigator.mediaSession.setActionHandler('play', () => {
- if (playerReady && !isPlaying) {
- togglePlayPause();
- }
-});
-
-navigator.mediaSession.setActionHandler('pause', () => {
- if (playerReady && isPlaying) {
- togglePlayPause();
- }
-});
-
-navigator.mediaSession.setActionHandler('previoustrack', () => {
- if (playerReady) {
- prevSong();
- }
-});
-
-navigator.mediaSession.setActionHandler('nexttrack', () => {
- if (playerReady) {
- nextSong();
- }
-});
-
667 // Pre-caching system
668 function preloadResources() {
669 console.log('Preloading UI resources...');
672 'resources/play.png',
673 'resources/pause.png',
674 'resources/prev.png',
- 'resources/next.png'
675 + 'resources/next.png',
676 + 'resources/album_art.jpg'
677 ];
678
679 const imagePromises = resources.map(src => {