Skip to content

Commit

Permalink
fix: optimize audio source comparison in audio player (#1987)
Browse files Browse the repository at this point in the history
* fix: optimize audio source comparison in player mount method

* fix: audio src invalid error
  • Loading branch information
xiangzy1 authored Dec 4, 2024
1 parent f2ed678 commit 322435a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/renderer/src/atoms/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ export const AudioPlayer = {
show: true,
listId: routeParams.listId,
})
const currentUrl = URL.canParse(this.audio.src)
? new URL(this.audio.src).toString()
: this.audio.src
const newUrl = URL.canParse(v.src) ? new URL(v.src).toString() : v.src

if (this.audio.src !== v.src) {
if (currentUrl !== newUrl) {
this.audio.src = v.src
this.audio.currentTime = v.currentTime ?? curV.currentTime ?? 0
}
Expand Down

0 comments on commit 322435a

Please sign in to comment.