Presences icon indicating copy to clipboard operation
Presences copied to clipboard

YouTube Music | music.youtube.com - Correct Timestamps after resuming playback

Open RichardKanshen opened this issue 1 year ago • 0 comments

Presence name

YouTube Music

Description

After resuming playback, the timestamps get reset as if the video started midway. image image

Alternatives

No response

Additional context

After looking through the code of the presence, it should be fairly simple to fix, I believe just one change in the last function of the presence should fix it (snippet - YouTube Music // presence.ts - Lines 268 - 279)

function updateSongTimestamps() {
	const element = document
			.querySelector<HTMLSpanElement>("#left-controls > span")
			.textContent.trim()
			.split(" / "),
		[currTimes, totalTimes] = element;

	mediaTimestamps = presence.getTimestamps(
		presence.timestampFromFormat(currTimes),
		presence.timestampFromFormat(totalTimes)
	);
}

RichardKanshen avatar Feb 27 '24 18:02 RichardKanshen