@@ -3,7 +3,7 @@ import { useEffect, useId, useMemo, useRef } from "react";
33import { useCurrentFrame } from "../frame" ;
44import { PROJECT_SETTINGS } from "../../../project/project" ;
55import { useIsPlaying , useIsRender } from "../studio-state" ;
6- import { useClipActive , useClipRange , useProvideClipDuration } from "../clip" ;
6+ import { useClipActive , useClipId , useClipRange , useProvideClipDuration } from "../clip" ;
77import { registerAudioSegmentGlobal , unregisterAudioSegmentGlobal } from "../audio-plan" ;
88import { VideoCanvasRender } from "./video-render" ;
99import type { Trim } from "../trim" ;
@@ -37,6 +37,7 @@ export type VideoProps = {
3737 video : Video | string
3838 style ?: CSSProperties
3939 trim ?: Trim
40+ showWaveform ?: boolean
4041}
4142
4243/**
@@ -175,9 +176,10 @@ export type VideoResolvedTrimProps = {
175176 * <Video video="assets/demo.mp4" trim={{ from: 30, duration: 120 }} />
176177 * ```
177178 */
178- export const Video = ( { video, style, trim } : VideoProps ) => {
179+ export const Video = ( { video, style, trim, showWaveform } : VideoProps ) => {
179180 const isRender = useIsRender ( )
180181 const id = useId ( )
182+ const clipId = useClipId ( )
181183 const clipRange = useClipRange ( )
182184 const resolvedVideo = useMemo ( ( ) => normalizeVideo ( video ) , [ video ] )
183185 const resolvedStyle = useMemo ( ( ) => {
@@ -215,15 +217,17 @@ export const Video = ({ video, style, trim }: VideoProps) => {
215217 registerAudioSegmentGlobal ( {
216218 id,
217219 source : { kind : "video" , path : resolvedVideo . path } ,
220+ clipId : clipId ?? undefined ,
218221 projectStartFrame,
219222 sourceStartFrame : trimStartFrames ,
220223 durationFrames,
224+ showWaveform,
221225 } )
222226
223227 return ( ) => {
224228 unregisterAudioSegmentGlobal ( id )
225229 }
226- } , [ clipRange , id , rawDurationFrames , resolvedVideo . path , trimEndFrames , trimStartFrames ] )
230+ } , [ clipId , clipRange , id , rawDurationFrames , resolvedVideo . path , showWaveform , trimEndFrames , trimStartFrames ] )
227231
228232 if ( isRender ) {
229233 return (
0 commit comments