[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix NaN duration text

Kasper (Sep 18, 2024, 12:54 PM +0200) 7ac23dd2 f9acd378

+11 -7
+11 -7
src/lib/player.ts
··· 26 26 duration: 0, 27 27 }) 28 28 function update_time_details() { 29 - time_record.update((record) => { 30 - record.elapsed = audio.currentTime 31 - record.at_timestamp = Date.now() 32 - record.paused = audio.paused 33 - record.duration = audio.duration 34 - return record 35 - }) 29 + if (!Number.isNaN(audio.duration)) { 30 + time_record.update((record) => { 31 + record.elapsed = audio.currentTime 32 + record.at_timestamp = Date.now() 33 + record.paused = audio.paused 34 + record.duration = audio.duration 35 + return record 36 + }) 37 + } 36 38 } 37 39 export const playing_track: Writable<Track | null> = writable(null) 38 40 export const playing_id = derived(queue, () => { ··· 89 91 })() 90 92 91 93 audio.onplay = update_time_details 94 + audio.onloadeddata = update_time_details 95 + audio.onloadedmetadata = update_time_details 92 96 audio.onpause = update_time_details 93 97 audio.ontimeupdate = update_time_details 94 98