Merge pull request #170 from ragestudio/dev

This commit is contained in:
srgooglo 2025-07-07 17:57:47 +02:00 committed by GitHub
commit ef4b66981d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 24 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@comty/app",
"version": "1.44.1@alpha",
"version": "1.44.2@alpha",
"license": "ComtyLicense",
"main": "electron/main",
"type": "module",

View File

@ -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)

View File

@ -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)
}
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(() => {
currentTrackId.current = playerState.track_manifest?.id
if (playerState.track_manifest?.id !== currentTrackId.current) {
setVisible(false)
setCurrentLineIndex(0)
// set scroll top to 0
if (textRef.current) {
textRef.current.scrollTop = 0
}
}
}, [playerState.track_manifest])
React.useEffect(() => {