mirror of
https://github.com/ragestudio/comty.git
synced 2025-07-08 16:54:15 +00:00
Improve DASH player configuration and buffering
This commit is contained in:
parent
2031b413ce
commit
a66d5891e3
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user