From 6333d49ee785fde20e88917d251937d0f3abff5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Tue, 14 Mar 2023 19:12:56 +0100 Subject: [PATCH] fix: Fix fetch plugin with old implementations (#5091) Fixes https://github.com/shaka-project/shaka-player/issues/5088 --- lib/net/http_fetch_plugin.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/net/http_fetch_plugin.js b/lib/net/http_fetch_plugin.js index b5320258c6..b73178be0c 100644 --- a/lib/net/http_fetch_plugin.js +++ b/lib/net/http_fetch_plugin.js @@ -243,6 +243,16 @@ shaka.net.HttpFetchPlugin = class { } else { return false; } + // Old fetch implementations hasn't body and ReadableStream implementation + // See: https://github.com/shaka-project/shaka-player/issues/5088 + if (window.Response) { + const response = new Response(''); + if (!response.body) { + return false; + } + } else { + return false; + } return !!(window.fetch && window.AbortController); } };