🎥 Make videos programmatically with React
call it associated playlists
Jonny Burger42f0fdb35935
diff --git a/packages/docs/docs/media-parser/fields.mdx b/packages/docs/docs/media-parser/fields.mdxindex b32f15b7b4..4b75cc0593 100644--- a/packages/docs/docs/media-parser/fields.mdx+++ b/packages/docs/docs/media-parser/fields.mdx@@ -208,7 +208,7 @@ An array of objects with the following fields:- `codecs`: The codec strings of the stream as an array May be `null`.- `url`: The URI of the stream- `id`: A unique identifier that Remotion gives the stream-- `dedicatedAudioTracks`: Audio tracks that are connected to this stream but are in a separate file. Currently these need to be processed yourself. We plan a breaking change to allow you to select an audio stream and allowing you to get the samples in the usual interleaved manner. This value is an array with objects of the following shape:+- `associatedPlaylists`: Audio tracks that are connected to this stream but live in a separate file.- `url`: The URL of the audio track- `autoselect`: Corresponds to the `AUTOSELECT` attribute in the HLS playlist- `default`: Corresponds to the `DEFAULT` attribute in the HLS playlistdiff --git a/packages/media-parser/src/containers/m3u/get-streams.ts b/packages/media-parser/src/containers/m3u/get-streams.tsindex 6245733aa9..c3026a5905 100644--- a/packages/media-parser/src/containers/m3u/get-streams.ts+++ b/packages/media-parser/src/containers/m3u/get-streams.ts@@ -3,7 +3,7 @@ import type {Structure} from '../../parse-result';import type {ParserState} from '../../state/parser-state';import type {M3uMediaInfo} from './types';-export type M3uStreamAudioTrack = {+export type M3uAssociatedPlaylist = {groupId: string;language: string | null;name: string | null;@@ -20,7 +20,7 @@ export type M3uStream = {resolution: Dimensions | null;codecs: string[] | null;id: number;- dedicatedAudioTracks: M3uStreamAudioTrack[];+ associatedPlaylists: M3uAssociatedPlaylist[];};export const isIndependentSegments = (structure: Structure | null): boolean => {@@ -52,7 +52,7 @@ export const getM3uStreams = (throw new Error('Expected m3u-text-value');}- const dedicatedAudioTracks: M3uStreamAudioTrack[] = [];+ const associatedPlaylists: M3uAssociatedPlaylist[] = [];if (str.audio) {const match = structure.boxes.filter((box) => {@@ -60,7 +60,7 @@ export const getM3uStreams = (}) as M3uMediaInfo[];for (const audioTrack of match) {- dedicatedAudioTracks.push({+ associatedPlaylists.push({autoselect: audioTrack.autoselect,channels: audioTrack.channels,default: audioTrack.default,@@ -84,7 +84,7 @@ export const getM3uStreams = (bandwidth: str.bandwidth,codecs: str.codecs,resolution: str.resolution,- dedicatedAudioTracks,+ associatedPlaylists,});}}diff --git a/packages/media-parser/src/test/m3u8-multiple-audio-streams.test.ts b/packages/media-parser/src/test/m3u8-multiple-audio-streams.test.tsindex 77215ba3f6..ab2c2d5c61 100644--- a/packages/media-parser/src/test/m3u8-multiple-audio-streams.test.ts+++ b/packages/media-parser/src/test/m3u8-multiple-audio-streams.test.ts@@ -19,7 +19,7 @@ test('separate video and audio streams', async () => {averageBandwidth: null,bandwidth: 5000000,codecs: ['avc1.42e00a', 'mp4a.40.2'],- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: 1,@@ -58,7 +58,7 @@ test('multiple audio streams', async () => {bandwidth: 10285391,codecs: ['avc1.4d4033', 'mp4a.40.2'],resolution: {width: 4096, height: 1744},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -86,7 +86,7 @@ test('multiple audio streams', async () => {bandwidth: 4149264,codecs: ['avc1.4d4028', 'mp4a.40.2'],resolution: {width: 1921, height: 818},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -114,7 +114,7 @@ test('multiple audio streams', async () => {bandwidth: 6214307,codecs: ['avc1.4d4028', 'mp4a.40.2'],resolution: {width: 1921, height: 818},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -142,7 +142,7 @@ test('multiple audio streams', async () => {bandwidth: 1558322,codecs: ['avc1.4d401f', 'mp4a.40.2'],resolution: {width: 1277, height: 554},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -170,7 +170,7 @@ test('multiple audio streams', async () => {bandwidth: 1144430,codecs: ['avc1.4d401f', 'mp4a.40.2'],resolution: {width: 958, height: 408},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -198,7 +198,7 @@ test('multiple audio streams', async () => {bandwidth: 520929,codecs: ['avc1.4d4015', 'mp4a.40.2'],resolution: {width: 638, height: 272},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -226,7 +226,7 @@ test('multiple audio streams', async () => {bandwidth: 831270,codecs: ['avc1.4d4015', 'mp4a.40.2'],resolution: {width: 638, height: 272},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,@@ -254,7 +254,7 @@ test('multiple audio streams', async () => {bandwidth: 258157,codecs: ['avc1.4d400d', 'mp4a.40.2'],resolution: {width: 422, height: 180},- dedicatedAudioTracks: [+ associatedPlaylists: [{autoselect: true,channels: null,diff --git a/packages/media-parser/src/test/parse-m3u8.test.ts b/packages/media-parser/src/test/parse-m3u8.test.tsindex c08169fc26..c335f05c22 100644--- a/packages/media-parser/src/test/parse-m3u8.test.ts+++ b/packages/media-parser/src/test/parse-m3u8.test.ts@@ -136,7 +136,7 @@ test('parse m3u8', async () => {codecs: ['mp4a.40.2', 'avc1.640028'],resolution: {width: 1000, height: 1000},id: 0,- dedicatedAudioTracks: [],+ associatedPlaylists: [],},{averageBandwidth: 618200,@@ -144,7 +144,7 @@ test('parse m3u8', async () => {codecs: ['mp4a.40.2', 'avc1.640020'],resolution: {width: 720, height: 720},id: 1,- dedicatedAudioTracks: [],+ associatedPlaylists: [],},{averageBandwidth: 358600,@@ -152,7 +152,7 @@ test('parse m3u8', async () => {codecs: ['mp4a.40.2', 'avc1.64001f'],resolution: {width: 480, height: 480},id: 2,- dedicatedAudioTracks: [],+ associatedPlaylists: [],},{averageBandwidth: 214500,@@ -160,7 +160,7 @@ test('parse m3u8', async () => {codecs: ['mp4a.40.2', 'avc1.640015'],resolution: {width: 270, height: 270},id: 3,- dedicatedAudioTracks: [],+ associatedPlaylists: [],},]);});