Skip to content

Commit

Permalink
fix: shared track not playable
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrani committed May 14, 2024
1 parent 078c960 commit cac964d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/observers/song-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default class SongTracker {

async handleShared(songStateData) {
await this.#applyEffects(songStateData)
const { startTime: position } = songStateData
const track_id = location.pathname?.split('/')?.at(-1)
const { startTime: position, trackId } = songStateData
const track_id = trackId ?? location.pathname?.split('/')?.at(-1)
this._video.currentTime = position

this.#mute()
Expand Down Expand Up @@ -178,9 +178,11 @@ export default class SongTracker {
if (this.#atTempSongEnd({ endTime, currentTimeMS })) return this.#handleEditingSnipMode(startTime)
if (isSnip && !this.#atSnipSongEnd({ currentTimeMS, endTime })) return

if (autoLoop || isShared) return (this._video.currentTime = startTime)
if (autoLoop || (isShared && this._video.currentTime >= endTime)) {
return (this._video.currentTime = startTime)
}

if (isShared && location?.search) history.pushState(null, '', location.pathname)
if (!isShared && location?.search) history.pushState(null, '', location.pathname)
if (isSnip || isSkipped) this.#nextButton.click()
}, 100)
}
Expand Down

0 comments on commit cac964d

Please sign in to comment.