From 2031b413ce4e47d35c834ed831130f55650af09f Mon Sep 17 00:00:00 2001 From: srgooglo Date: Mon, 7 Jul 2025 17:56:09 +0200 Subject: [PATCH 1/3] Fix lyrics scroll handling and track state checking --- .../pages/lyrics/components/text/index.jsx | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/app/src/pages/lyrics/components/text/index.jsx b/packages/app/src/pages/lyrics/components/text/index.jsx index a2b3e3fd..4d3f26e1 100644 --- a/packages/app/src/pages/lyrics/components/text/index.jsx +++ b/packages/app/src/pages/lyrics/components/text/index.jsx @@ -10,6 +10,7 @@ const LyricsText = React.forwardRef((props, textRef) => { const { lyrics } = props + const currentTrackId = React.useRef(null) const [syncInterval, setSyncInterval] = React.useState(null) const [currentLineIndex, setCurrentLineIndex] = React.useState(0) const [visible, setVisible] = React.useState(false) @@ -25,9 +26,7 @@ const LyricsText = React.forwardRef((props, textRef) => { }) if (lineIndex === -1) { - if (!visible) { - setVisible(false) - } + setVisible(false) return false } @@ -70,8 +69,14 @@ const LyricsText = React.forwardRef((props, textRef) => { //* Handle when current line index change React.useEffect(() => { + console.debug("[lyrics] currentLineIndex", currentLineIndex) + if (currentLineIndex === 0) { setVisible(false) + + if (textRef.current) { + textRef.current.scrollTop = 0 + } } else { setVisible(true) @@ -87,9 +92,6 @@ const LyricsText = React.forwardRef((props, textRef) => { behavior: "smooth", block: "center", }) - } else { - // scroll to top - textRef.current.scrollTop = 0 } } } @@ -102,10 +104,16 @@ const LyricsText = React.forwardRef((props, textRef) => { //* Handle when manifest object change, reset... React.useEffect(() => { - setVisible(false) - setCurrentLineIndex(0) - // set scroll top to 0 - textRef.current.scrollTop = 0 + currentTrackId.current = playerState.track_manifest?.id + + if (playerState.track_manifest?.id !== currentTrackId.current) { + setVisible(false) + setCurrentLineIndex(0) + + if (textRef.current) { + textRef.current.scrollTop = 0 + } + } }, [playerState.track_manifest]) React.useEffect(() => { From a66d5891e3d824e636f885eec61d3aa8ae5830fa Mon Sep 17 00:00:00 2001 From: srgooglo Date: Mon, 7 Jul 2025 17:56:50 +0200 Subject: [PATCH 2/3] Improve DASH player configuration and buffering --- .../app/src/cores/player/classes/AudioBase.js | 56 ++++++++++++++----- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/packages/app/src/cores/player/classes/AudioBase.js b/packages/app/src/cores/player/classes/AudioBase.js index 4b9f4645..9c461980 100644 --- a/packages/app/src/cores/player/classes/AudioBase.js +++ b/packages/app/src/cores/player/classes/AudioBase.js @@ -81,11 +81,7 @@ export default class AudioBase { this.console.timeEnd("instanciate class") } - if ( - manifest.mpd_mode === true && - !manifest.dash_manifest && - this.demuxer - ) { + if (manifest.mpd_mode === true && !manifest.dash_manifest && this.demuxer) { this.console.time("fetch") const manifestString = await fetch(manifest.source).then((res) => res.text(), @@ -93,10 +89,7 @@ export default class AudioBase { this.console.timeEnd("fetch") this.console.time("parse mpd") - manifest.dash_manifest = await MPDParser( - manifestString, - manifest.source, - ) + manifest.dash_manifest = await MPDParser(manifestString, manifest.source) this.console.timeEnd("parse mpd") } @@ -247,14 +240,51 @@ export default class AudioBase { streaming: { //cacheInitSegments: true, buffer: { - bufferTimeAtTopQuality: 15, - initialBufferLevel: 1, + bufferTimeAtTopQuality: 30, + bufferTimeAtTopQualityLongForm: 60, + bufferTimeDefault: 20, + initialBufferLevel: 5, + bufferToKeep: 10, + longFormContentDurationThreshold: 300, + stallThreshold: 0.5, + bufferPruningInterval: 30, + }, + abr: { + initialBitrate: { + audio: 128, + }, + rules: { + insufficientBufferRule: { + active: true, + parameters: { + bufferLevel: 0.3, + }, + }, + switchHistoryRule: { + active: true, + parameters: { + sampleSize: 8, + }, + }, + }, + throughput: { + averageCalculationMode: "slidingWindow", + slidingWindowSize: 20, + ewmaHalfLife: 4, + }, + }, + retrySettings: { + maxRetries: 5, + retryDelayMs: 1000, + retryBackoffFactor: 2, + }, + requests: { + requestTimeout: 30000, + xhrWithCredentials: false, }, }, }) - //this.demuxer.setAutoPlay(false) - // Event listeners this.demuxer.on(dashjs.MediaPlayer.events.ERROR, (event) => { console.error("Demuxer error", event) From dc29623330e8002b9691c2339a66f3f12987bfbf Mon Sep 17 00:00:00 2001 From: srgooglo Date: Mon, 7 Jul 2025 17:57:02 +0200 Subject: [PATCH 3/3] Update package.json --- packages/app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/package.json b/packages/app/package.json index a2a085b5..7e1d37bf 100755 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@comty/app", - "version": "1.44.1@alpha", + "version": "1.44.2@alpha", "license": "ComtyLicense", "main": "electron/main", "type": "module",