Skip to content

🎥 Make videos programmatically with React

handling when not being able to fetch manifest

Jonny Burgeraf2ca1e6c183
diff --git a/packages/media-parser/src/containers/m3u/fetch-m3u8-stream.ts b/packages/media-parser/src/containers/m3u/fetch-m3u8-stream.ts
index 10fc0ef1c6..92a7368d8d 100644
--- a/packages/media-parser/src/containers/m3u/fetch-m3u8-stream.ts
+++ b/packages/media-parser/src/containers/m3u/fetch-m3u8-stream.ts
@@ -4,6 +4,10 @@ import type {M3uBox} from './types';
export const fetchM3u8Stream = async (stream: M3uStream): Promise<M3uBox[]> => {
const res = await fetch(stream.url);
+ if (!res.ok) {
+ throw new Error(`Failed to fetch ${stream.url} (HTTP code: ${res.status})`);
+ }
+
const text = await res.text();
const lines = text.split('\n');
const boxes: M3uBox[] = [];