Skip to content

🎥 Make videos programmatically with React

`@remotion/media`: Simplify back to createInputFrom for HLS

Jonny Burger78383930b9fe
diff --git a/packages/media/src/create-input.ts b/packages/media/src/create-input.ts
index f3db0882aa..602131165c 100644
--- a/packages/media/src/create-input.ts
+++ b/packages/media/src/create-input.ts
@@ -1,20 +1,5 @@
import type {CreateInputFromOptions} from 'mediabunny';
-import {
- ALL_FORMATS,
- HLS_FORMATS,
- PathedSource,
- UrlSource,
- createInputFrom,
-} from 'mediabunny';
-
-const isHlsSource = (src: string): boolean => {
- try {
- const url = new URL(src, 'http://placeholder');
- return url.pathname.toLowerCase().endsWith('.m3u8');
- } catch {
- return src.toLowerCase().endsWith('.m3u8');
- }
-};
+import {ALL_FORMATS, createInputFrom} from 'mediabunny';
export const createInput = ({
src,
@@ -25,18 +10,8 @@ export const createInput = ({
credentials: RequestCredentials | undefined;
urlSourceOptions?: Partial<CreateInputFromOptions>;
}) => {
- const options: CreateInputFromOptions = {
+ return createInputFrom(src, ALL_FORMATS, {
...urlSourceOptions,
...(credentials ? {requestInit: {credentials}} : undefined),
- };
-
- if (isHlsSource(src)) {
- const source = new PathedSource(
- src,
- ({path}) => new UrlSource(path, options),
- );
- return createInputFrom(source, HLS_FORMATS);
- }
-
- return createInputFrom(src, ALL_FORMATS, options);
+ });
};