Skip to content

Commit bb7dcc6

Browse files
committedSep 20, 2024
Merge remote-tracking branch 'origin/next' into task/OV-352-add-logic-for-edit-video-button
2 parents 7661e68 + 5b87517 commit bb7dcc6

File tree

5 files changed

+5828
-2672
lines changed

5 files changed

+5828
-2672
lines changed
 

‎frontend/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,10 @@
5353
"remotion": "4.0.201",
5454
"shared": "*",
5555
"zod-formik-adapter": "1.3.0"
56+
},
57+
"overrides": {
58+
"vite": {
59+
"rollup": "npm:@rollup/wasm-node"
60+
}
5661
}
5762
}

‎frontend/src/bundles/studio/components/player-controls/player-controls.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const PlayerControls: React.FC<Properties> = ({ playerRef }) => {
3939
const togglePlaying = useCallback(() => {
4040
if (elapsedTime >= totalDuration) {
4141
void dispatch(studioActions.setElapsedTime(0));
42+
playerRef.current?.pauseAndReturnToPlayStart();
4243
}
4344
playerRef.current?.toggle();
4445

‎frontend/src/bundles/studio/store/actions.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createAsyncThunk } from '@reduxjs/toolkit';
2+
import { getAudioData } from '@remotion/media-utils';
23
import { type UpdateVideoRequestDto } from 'shared';
34

45
import { type AsyncThunkConfig } from '~/bundles/common/types/types.js';
@@ -10,6 +11,7 @@ import {
1011
type GetVoicesResponseDto,
1112
type RenderAvatarResponseDto,
1213
type RenderAvatarVideoRequestDto,
14+
type Script,
1315
type VideoGetAllItemResponseDto,
1416
} from '~/bundles/studio/types/types.js';
1517

@@ -36,13 +38,21 @@ const loadVoices = createAsyncThunk<
3638
});
3739

3840
const generateScriptSpeech = createAsyncThunk<
39-
GenerateSpeechResponseDto,
41+
Required<Pick<Script, 'id'>> & Partial<Script>,
4042
GenerateSpeechRequestDto,
4143
AsyncThunkConfig
4244
>(`${sliceName}/generate-script-speech`, (payload, { extra }) => {
4345
const { speechApi } = extra;
4446

45-
return speechApi.generateScriptSpeech(payload);
47+
return speechApi
48+
.generateScriptSpeech(payload)
49+
.then(({ scriptId, audioUrl }) => {
50+
return getAudioData(audioUrl).then(({ durationInSeconds }) => ({
51+
id: scriptId,
52+
duration: durationInSeconds,
53+
url: audioUrl,
54+
}));
55+
});
4656
});
4757

4858
const generateScriptSpeechPreview = createAsyncThunk<

‎frontend/src/bundles/studio/store/slice.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -382,16 +382,16 @@ const { reducer, actions, name } = createSlice({
382382
state.dataStatus = DataStatus.PENDING;
383383
});
384384
builder.addCase(generateScriptSpeech.fulfilled, (state, action) => {
385-
const { scriptId, audioUrl } = action.payload;
385+
const { id } = action.payload;
386386

387387
state.scripts = state.scripts.map((script) => {
388-
if (script.id !== scriptId) {
388+
if (script.id !== id) {
389389
return script;
390390
}
391391

392392
return {
393393
...script,
394-
url: audioUrl,
394+
...action.payload,
395395
iconName: PlayIconNames.READY,
396396
};
397397
});

0 commit comments

Comments
 (0)
Failed to load comments.