diff --git a/src/components/SubtitlesTrack.tsx b/src/components/SubtitlesTrack.tsx new file mode 100644 index 0000000..d182ea7 --- /dev/null +++ b/src/components/SubtitlesTrack.tsx @@ -0,0 +1,15 @@ +import {FC} from 'react'; + +import {Sequence} from 'remotion'; +import {SubtitleTrackRenderDescription} from '../utils/renderDescriptionSchema'; + +export const SubtitlesTrack: FC = (track) => { + return ( + + {track.assets.map((asset) => { + console.log(asset); + return null; // TODO: Implement this + })} + + ); +}; diff --git a/src/components/Timeline.tsx b/src/components/Timeline.tsx index 066250f..94ebd81 100644 --- a/src/components/Timeline.tsx +++ b/src/components/Timeline.tsx @@ -3,10 +3,15 @@ import {Sequence} from 'remotion'; import {RenderDescription} from '../utils/renderDescriptionSchema'; import {AudioTrack} from './AudioTrack'; import {VideoTrack} from './VideoTrack'; +import {SubtitlesTrack} from './SubtitlesTrack'; export const Timeline: FC = (renderDescription) => { return ( + {renderDescription.timeline.tracks.subtitles.map((subtitleTrack) => ( + + ))} + {renderDescription.timeline.tracks.video.map((videoTrack) => ( ))} diff --git a/src/utils/renderDescriptionSchema.ts b/src/utils/renderDescriptionSchema.ts index a3da388..a5968f2 100644 --- a/src/utils/renderDescriptionSchema.ts +++ b/src/utils/renderDescriptionSchema.ts @@ -59,11 +59,17 @@ const AudioTrackSchema = z.object({ assets: z.array(AudioAssetSchema), }); +const SubtitlesTrackSchema = z.object({ + id: z.string(), + index: z.number(), + assets: z.array(z.object({})), +}); + const TimelineSchema = z.object({ tracks: z.object({ video: z.array(VideoTrackSchema), audio: z.array(AudioTrackSchema), - subtitles: z.array(z.object({}).nonstrict()), + subtitles: z.array(SubtitlesTrackSchema), }), }); @@ -81,6 +87,9 @@ export type RenderDescription = z.infer; export type AudioTrackRenderDescription = z.infer; export type VideoTrackRenderDescription = z.infer; +export type SubtitleTrackRenderDescription = z.infer< + typeof SubtitlesTrackSchema +>; export type TextAssetSchemaRenderDescription = z.infer; export type AssetSchemaRenderDescription = z.infer;