Код: Выделить всё
const response = await fetch(STREAM_URL, {
method: "GET",
headers: { Authorization: SECRET_TOKEN },
cache: "no-cache",
signal: this.abortSignal,
});
if (response.ok && response.body) {
const contentType = response.headers.get("content-type");
if (contentType.startsWith("multipart/x-mixed-replace;")) {
const reader = response.body.getReader();
const decoder = new TextDecoder("utf-8");
while (true) {
const { done, value } = await reader.read(); // this line throws the error
// do something with the data
Репозиторий: https://github.com/nimrod42/authorized_stream_viewer
Подробнее здесь: https://stackoverflow.com/questions/795 ... iled-error
Мобильная версия