fix initial page load for track duration
This commit is contained in:
parent
ffc8f2a558
commit
bbf4d88f61
9
app.js
9
app.js
@ -1,4 +1,4 @@
|
||||
const APP_VERSION = '0.1.0-beta';
|
||||
const APP_VERSION = '0.1.1-beta';
|
||||
const playlist = [
|
||||
{ url: 'https://feed.falsefinish.club/Echo%20Reality/PINK%20FLIGHT/MP3%20BOUNCE/01.%20PINK%20FLIGHT%20ATTENDANT.mp3', name: 'TRACK 1 - PINK FLIGHT ATTENDANT' },
|
||||
{ url: 'https://feed.falsefinish.club/Echo%20Reality/PINK%20FLIGHT/MP3%20BOUNCE/02.%20NOW.mp3', name: 'TRACK 2 - NOW' },
|
||||
@ -1146,6 +1146,13 @@ audio.addEventListener('timeupdate', () => {
|
||||
updateTapeSizes();
|
||||
});
|
||||
|
||||
// Update time display when metadata loads (fixes cold start 0:00 / 0:00 issue)
|
||||
audio.addEventListener('loadedmetadata', () => {
|
||||
const current = formatTime(audio.currentTime);
|
||||
const duration = formatTime(audio.duration);
|
||||
timeDisplay.textContent = `${current} / ${duration}`;
|
||||
});
|
||||
|
||||
// Format time helper
|
||||
function formatTime(seconds) {
|
||||
if (isNaN(seconds)) return '00:00';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user