({
videoId,
userId,
rawFileKey,
bucketId,
processingMessage,
startFailureMessage,
mode,
forceRestart,
}: {
videoId: Video.VideoId;
userId: string;
rawFileKey: string;
bucketId: string | null;
processingMessage: string;
startFailureMessage: string;
mode?: "singlepart" | "multipart";
forceRestart?: boolean;
})
| 101 | } |
| 102 | |
| 103 | export async function startVideoProcessingWorkflow({ |
| 104 | videoId, |
| 105 | userId, |
| 106 | rawFileKey, |
| 107 | bucketId, |
| 108 | processingMessage, |
| 109 | startFailureMessage, |
| 110 | mode, |
| 111 | forceRestart, |
| 112 | }: { |
| 113 | videoId: Video.VideoId; |
| 114 | userId: string; |
| 115 | rawFileKey: string; |
| 116 | bucketId: string | null; |
| 117 | processingMessage: string; |
| 118 | startFailureMessage: string; |
| 119 | mode?: "singlepart" | "multipart"; |
| 120 | forceRestart?: boolean; |
| 121 | }): Promise<VideoProcessingStartStatus> { |
| 122 | const status = await transitionVideoToProcessing({ |
| 123 | videoId, |
| 124 | rawFileKey, |
| 125 | processingMessage, |
| 126 | mode, |
| 127 | forceRestart, |
| 128 | }); |
| 129 | |
| 130 | if (status !== "started") { |
| 131 | return status; |
| 132 | } |
| 133 | |
| 134 | try { |
| 135 | await start(processVideoWorkflow, [ |
| 136 | { |
| 137 | videoId, |
| 138 | userId, |
| 139 | rawFileKey, |
| 140 | bucketId: bucketId as S3Bucket.S3BucketId | null, |
| 141 | }, |
| 142 | ]); |
| 143 | return "started"; |
| 144 | } catch (error) { |
| 145 | const normalizedError = |
| 146 | error instanceof Error |
| 147 | ? error |
| 148 | : new Error("Video processing could not start"); |
| 149 | await setVideoProcessingError( |
| 150 | videoId, |
| 151 | startFailureMessage, |
| 152 | normalizedError, |
| 153 | ); |
| 154 | throw normalizedError; |
| 155 | } |
| 156 | } |
no test coverage detected