From b24eff223cdeb16b53894fb57faf027f0e122b7f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 11 Nov 2021 06:43:42 +0530 Subject: [PATCH] Fix LBRY videos --- src/components/Player.vue | 12 ++++++++---- src/routes/Preferences.vue | 5 +++++ src/store/prefs-store.js | 3 ++- src/translations/en.json | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/Player.vue b/src/components/Player.vue index 92e2fdc..4dd1481 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -110,12 +110,16 @@ export default { } mime = 'application/dash+xml' } else if (lbry) { - const contentType = await fetch(uri, { + uri = lbry.url + if (this.$store.getters['prefs/getPreferenceBoolean']('proxyLBRY', true)) { + const url = new URL(uri) + url.searchParams.set('host', url.host) + url.host = new URL(this.video.proxyUrl).host + uri = url.toString() + } + mime = await fetch(uri, { method: 'HEAD' }).then(response => response.headers.get('Content-Type')) - - mime = contentType - uri = lbry.uri } else if (this.video.hls) { uri = this.video.hls mime = 'application/x-mpegURL' diff --git a/src/routes/Preferences.vue b/src/routes/Preferences.vue index a71759d..158259d 100644 --- a/src/routes/Preferences.vue +++ b/src/routes/Preferences.vue @@ -50,6 +50,11 @@ export default { type: 'bool', default: false }, + { + id: 'proxyLBRY', + type: 'bool', + default: true + }, { id: 'homepage', type: 'select', diff --git a/src/store/prefs-store.js b/src/store/prefs-store.js index d3ddef3..d062a88 100644 --- a/src/store/prefs-store.js +++ b/src/store/prefs-store.js @@ -7,7 +7,8 @@ const PrefsStore = { prefs: { playerAutoplay: true, autoplay: false, - listen: false + listen: false, + proxyLBRY: true } }), mutations: { diff --git a/src/translations/en.json b/src/translations/en.json index 0021055..81b0dd7 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -50,6 +50,7 @@ "enabled_codecs": "Enabled Codecs (Multiple)" }, "preferences": { + "proxyLBRY": "Proxy LBRY videos", "playerAutoplay": "Autoplay Video", "bufferGoal": "Buffering Goal", "listen": "Audio Only",