Rename sync_audio_at_ms to video_starts_at_ms

This commit is contained in:
SrGooglo 2025-06-16 20:49:34 +00:00
parent a403d528df
commit 4dfacb8427

View File

@ -33,7 +33,7 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
if ( if (
!lyrics || !lyrics ||
!lyrics.video_source || !lyrics.video_source ||
typeof lyrics.sync_audio_at_ms === "undefined" || typeof lyrics.video_starts_at_ms === "undefined" ||
!videoRef.current !videoRef.current
) { ) {
return null return null
@ -43,7 +43,7 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
setSyncingVideo(true) setSyncingVideo(true)
let newTime = let newTime =
currentTrackTime + lyrics.sync_audio_at_ms / 1000 + 150 / 1000 currentTrackTime + lyrics.video_starts_at_ms / 1000 + 150 / 1000
newTime -= 5 / 1000 newTime -= 5 / 1000
videoRef.current.currentTime = newTime videoRef.current.currentTime = newTime
@ -55,7 +55,7 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
!videoRef.current || !videoRef.current ||
!lyrics || !lyrics ||
!lyrics.video_source || !lyrics.video_source ||
typeof lyrics.sync_audio_at_ms === "undefined" typeof lyrics.video_starts_at_ms === "undefined"
) { ) {
stopSyncInterval() stopSyncInterval()
return return
@ -68,7 +68,7 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
const currentTrackTime = window.app.cores.player.controls.seek() const currentTrackTime = window.app.cores.player.controls.seek()
const currentVideoTime = const currentVideoTime =
videoRef.current.currentTime - lyrics.sync_audio_at_ms / 1000 videoRef.current.currentTime - lyrics.video_starts_at_ms / 1000
const maxOffset = maxLatencyInMs / 1000 const maxOffset = maxLatencyInMs / 1000
const currentVideoTimeDiff = Math.abs( const currentVideoTimeDiff = Math.abs(
currentVideoTime - currentTrackTime, currentVideoTime - currentTrackTime,
@ -135,7 +135,7 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
} }
} }
if (typeof lyrics.sync_audio_at_ms !== "undefined") { if (typeof lyrics.video_starts_at_ms !== "undefined") {
videoElement.loop = false videoElement.loop = false
syncPlayback(true) syncPlayback(true)
} else { } else {
@ -177,7 +177,7 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
return return
} }
const shouldSync = typeof lyrics.sync_audio_at_ms !== "undefined" const shouldSync = typeof lyrics.video_starts_at_ms !== "undefined"
if (playerState.playback_status === "playing") { if (playerState.playback_status === "playing") {
videoElement videoElement
@ -255,4 +255,6 @@ const LyricsVideo = React.forwardRef((props, videoRef) => {
) )
}) })
LyricsVideo.displayName = "LyricsVideo"
export default LyricsVideo export default LyricsVideo