Port "Use pre-existing dash manifest wherever possible."

See https://github.com/TeamPiped/Piped/commit/631c50ba3336e2d4e8613520462b6d8c83454075
This commit is contained in:
root
2021-08-16 14:39:58 +05:30
parent c6032f5bf7
commit eddbd886c3
+10 -7
View File
@@ -84,12 +84,15 @@ export default {
if (this.video.livestream) {
uri = this.video.hls
} else if (this.video.audioStreams.length > 0 && MseSupport) {
const dash = DashUtils.generate_dash_file_from_formats(
streams,
this.video.duration
)
uri = 'data:application/dash+xml;charset=utf-8;base64,' + btoa(dash)
if (!this.video.dash) {
const dash = DashUtils.generate_dash_file_from_formats(
streams,
this.video.duration
)
uri = 'data:application/dash+xml;charset=utf-8;base64,' + btoa(dash)
} else {
uri = this.video.dash
}
} else {
uri = this.video.videoStreams.filter(stream => stream.codec == null).slice(-1)[0].url
}
@@ -197,7 +200,7 @@ export default {
quality > 0 && (this.video.audioStreams.length > 0 || this.video.livestream) && !disableVideo
if (qualityConds) this.player.configure('abr.enabled', false)
player.load(uri, 0, uri.indexOf('dash+xml') >= 0 ? 'application/dash+xml' : 'video/mp4').then(() => {
player.load(uri, 0, uri.indexOf('dash') >= 0 ? 'application/dash+xml' : 'video/mp4').then(() => {
if (qualityConds) {
let leastDiff = Number.MAX_VALUE
let bestStream = null