Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/common/src/api/tan-query/tracks/useUpdateTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,22 @@ export const useUpdateTrack = () => {
})
}

// A changed preview start needs a freshly sliced preview clip. The SDK
// only regenerates when asked (and skips it when a new audio file is
// uploaded, since transcoding produces the preview then); without this
// flag an edit updates preview_start_seconds in metadata while the
// track keeps streaming the old preview_cid's clip.
const generatePreview =
metadataWithSplits.preview_start_seconds != null &&
metadataWithSplits.preview_start_seconds !==
previousMetadata?.preview_start_seconds

const response = await sdk.tracks.updateTrack({
audioFile,
imageFile,
trackId: Id.parse(trackId),
userId: Id.parse(userId),
generatePreview,
metadata: sdkMetadata as UpdateTrackRequestBody,
onProgress: (_, progress) => {
if (progress.key === 'audio') {
Expand Down
Loading