From eddbd886c3e1881f916cdbf04e72aacda37f50b9 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 16 Aug 2021 14:39:58 +0530 Subject: [PATCH] Port "Use pre-existing dash manifest wherever possible." See https://github.com/TeamPiped/Piped/commit/631c50ba3336e2d4e8613520462b6d8c83454075 --- src/components/Player.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/Player.vue b/src/components/Player.vue index 503b25e..7ada73f 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -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