mirror of
https://github.com/ragestudio/comty.git
synced 2025-07-08 16:54:15 +00:00
Merge pull request #170 from ragestudio/dev
This commit is contained in:
commit
ef4b66981d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@comty/app",
|
"name": "@comty/app",
|
||||||
"version": "1.44.1@alpha",
|
"version": "1.44.2@alpha",
|
||||||
"license": "ComtyLicense",
|
"license": "ComtyLicense",
|
||||||
"main": "electron/main",
|
"main": "electron/main",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -81,11 +81,7 @@ export default class AudioBase {
|
|||||||
this.console.timeEnd("instanciate class")
|
this.console.timeEnd("instanciate class")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (manifest.mpd_mode === true && !manifest.dash_manifest && this.demuxer) {
|
||||||
manifest.mpd_mode === true &&
|
|
||||||
!manifest.dash_manifest &&
|
|
||||||
this.demuxer
|
|
||||||
) {
|
|
||||||
this.console.time("fetch")
|
this.console.time("fetch")
|
||||||
const manifestString = await fetch(manifest.source).then((res) =>
|
const manifestString = await fetch(manifest.source).then((res) =>
|
||||||
res.text(),
|
res.text(),
|
||||||
@ -93,10 +89,7 @@ export default class AudioBase {
|
|||||||
this.console.timeEnd("fetch")
|
this.console.timeEnd("fetch")
|
||||||
|
|
||||||
this.console.time("parse mpd")
|
this.console.time("parse mpd")
|
||||||
manifest.dash_manifest = await MPDParser(
|
manifest.dash_manifest = await MPDParser(manifestString, manifest.source)
|
||||||
manifestString,
|
|
||||||
manifest.source,
|
|
||||||
)
|
|
||||||
this.console.timeEnd("parse mpd")
|
this.console.timeEnd("parse mpd")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,14 +240,51 @@ export default class AudioBase {
|
|||||||
streaming: {
|
streaming: {
|
||||||
//cacheInitSegments: true,
|
//cacheInitSegments: true,
|
||||||
buffer: {
|
buffer: {
|
||||||
bufferTimeAtTopQuality: 15,
|
bufferTimeAtTopQuality: 30,
|
||||||
initialBufferLevel: 1,
|
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
|
// Event listeners
|
||||||
this.demuxer.on(dashjs.MediaPlayer.events.ERROR, (event) => {
|
this.demuxer.on(dashjs.MediaPlayer.events.ERROR, (event) => {
|
||||||
console.error("Demuxer error", event)
|
console.error("Demuxer error", event)
|
||||||
|
@ -10,6 +10,7 @@ const LyricsText = React.forwardRef((props, textRef) => {
|
|||||||
|
|
||||||
const { lyrics } = props
|
const { lyrics } = props
|
||||||
|
|
||||||
|
const currentTrackId = React.useRef(null)
|
||||||
const [syncInterval, setSyncInterval] = React.useState(null)
|
const [syncInterval, setSyncInterval] = React.useState(null)
|
||||||
const [currentLineIndex, setCurrentLineIndex] = React.useState(0)
|
const [currentLineIndex, setCurrentLineIndex] = React.useState(0)
|
||||||
const [visible, setVisible] = React.useState(false)
|
const [visible, setVisible] = React.useState(false)
|
||||||
@ -25,9 +26,7 @@ const LyricsText = React.forwardRef((props, textRef) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (lineIndex === -1) {
|
if (lineIndex === -1) {
|
||||||
if (!visible) {
|
setVisible(false)
|
||||||
setVisible(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -70,8 +69,14 @@ const LyricsText = React.forwardRef((props, textRef) => {
|
|||||||
|
|
||||||
//* Handle when current line index change
|
//* Handle when current line index change
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
console.debug("[lyrics] currentLineIndex", currentLineIndex)
|
||||||
|
|
||||||
if (currentLineIndex === 0) {
|
if (currentLineIndex === 0) {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
|
|
||||||
|
if (textRef.current) {
|
||||||
|
textRef.current.scrollTop = 0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setVisible(true)
|
setVisible(true)
|
||||||
|
|
||||||
@ -87,9 +92,6 @@ const LyricsText = React.forwardRef((props, textRef) => {
|
|||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "center",
|
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...
|
//* Handle when manifest object change, reset...
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setVisible(false)
|
currentTrackId.current = playerState.track_manifest?.id
|
||||||
setCurrentLineIndex(0)
|
|
||||||
// set scroll top to 0
|
if (playerState.track_manifest?.id !== currentTrackId.current) {
|
||||||
textRef.current.scrollTop = 0
|
setVisible(false)
|
||||||
|
setCurrentLineIndex(0)
|
||||||
|
|
||||||
|
if (textRef.current) {
|
||||||
|
textRef.current.scrollTop = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}, [playerState.track_manifest])
|
}, [playerState.track_manifest])
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user