replaceClipMedia method
Replaces the media of clip index with file (an AI render of the
clip's trimmed range), keeping its place, speed, volume and look.
Implementation
Future<void> replaceClipMedia(int index, File file) async {
if (index < 0 || index >= clips.length) return;
final info = await VideoRenderService.probe(file);
final old = clips[index];
final replacement = old.copyWith(
file: file,
duration: info.duration,
startTime: Duration.zero,
endTime: info.duration,
thumbnails: const [],
width: info.size.width,
height: info.size.height,
hasAudio: info.hasAudio,
clearConvertedVideoFile: true,
)..proxyVideoFile = null;
replacement.markEdited();
clipController.replaceClip(replacement);
_saveState();
notifyListeners();
_addToProcessingQueue(replacement.id);
_updateVideoPlayerForCurrentClip();
}