check if timestamps exits

This commit is contained in:
2025-09-03 10:31:36 +02:00
parent 5de9b347aa
commit 50dba49808
3 changed files with 49 additions and 24 deletions
+19 -5
View File
@@ -15,16 +15,29 @@ const Playback = ({ route }) => {
const { project } = route.params;
const projectId = project?.id;
const songIndex = project?.songIndex;
console.log("sonindex", songIndex);
const sunoTaskId = project?.sunoTaskId;
const { setIsLoading } = useMinuit();
// console.log("musicTimestamps avec songIndex:", {
// // Accès avec la clé dot notation
// musicTimeStamps: project?.[`musicTimestamps.${songIndex}`],
// // Toutes les clés qui commencent par musicTimestamps
// });
const onPressRecord = useCallback(async () => {
try {
console.log(
"project",
songIndex,
"project id",
projectId,
"sunoTaskId",
sunoTaskId
);
if (!projectId || songIndex === undefined || !sunoTaskId) {
return;
// return navigate(Routes.RecordPlayback, { project });
}
if (project.musicTimeStamps.songIndex) {
if (project?.[`musicTimestamps.${songIndex}`]) {
console.log("exists");
return navigate(Routes.RecordPlayback, { project });
}
@@ -46,17 +59,18 @@ const Playback = ({ route }) => {
"Impossible de récupérer les timestamps pour ce playback pour le moment. Tu peux quand même continuer."
);
}
await setIsLoading(false);
navigate(Routes.RecordPlayback, { project });
} catch (e) {
console.log("getSunoTimestamps error", e?.message || e);
Alert.alert(
"Timestamps",
"Une erreur est survenue lors de la génération des timestamps. Tu peux quand même continuer."
);
} finally {
await setIsLoading(false);
navigate(Routes.RecordPlayback, { project });
}
}, [projectId, songIndex, sunoTaskId, project]);
}, [projectId, songIndex, sunoTaskId, project, setIsLoading]);
return (
<Page headerType="NONE" backgroundImg={background.playbackBG2}>
+29 -18
View File
@@ -2,7 +2,7 @@ import { useFocusEffect } from "@react-navigation/native";
import { useAudioPlayer } from "expo-audio";
import { CameraView, useCameraPermissions } from "expo-camera";
import React, { useCallback, useEffect, useRef, useState } from "react";
import { Platform, Text, View } from "react-native";
import { Text, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import Svg, { Circle } from "react-native-svg";
import GradientButton from "../../components/GradientButton";
@@ -25,7 +25,7 @@ import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
const TIME_BEFORE_INCREMENT_MS = 20000; // 20s
const RecordPlayback = ({ route }) => {
const { top } = useSafeAreaInsets();
const { top, bottom } = useSafeAreaInsets();
const { project } = route.params || {};
// Permissions
@@ -298,22 +298,6 @@ const RecordPlayback = ({ route }) => {
<MusicLandHeader progress={9} onPressBack={goBack} />
<View style={{ flex: 1, marginTop: 11 }}>
<CreateLyricsHeader
disableBlur={Platform.OS !== "ios"}
containerStyle={{ backgroundColor: Palette.ultraLightBlack }}
>
<Text
style={{
fontSize: 16,
color: Palette.white,
fontFamily: FONT_FAMILY.InterMedium,
}}
>
L'enregistrement de ta vidéo commencera lorsque tu lanceras ta
musique, et s'arrêtera à la fin du morceau.
</Text>
</CreateLyricsHeader>
{/* Overlay de compte à rebours : on affiche 5→1 pour éviter l'effet visuel à 1 */}
{isPreparing && countdown >= 1 && !showProgress && (
<View
@@ -417,6 +401,33 @@ const RecordPlayback = ({ route }) => {
)}
</View>
</CameraView>
{/* CreateLyricsHeader overlay outside of CameraView */}
<View
pointerEvents="box-none"
style={{
position: "absolute",
left: 0,
right: 0,
bottom: bottom + 100,
paddingHorizontal: gutters,
}}
>
<CreateLyricsHeader
// disableBlur={Platform.OS !== "ios"}
// containerStyle={{ backgroundColor: Palette.ultraLightBlack }}
>
<Text
style={{
fontSize: 16,
color: Palette.white,
fontFamily: FONT_FAMILY.InterMedium,
}}
>
L'enregistrement de ta vidéo commencera lorsque tu lanceras ta
musique, et s'arrêtera à la fin du morceau.
</Text>
</CreateLyricsHeader>
</View>
</View>
);
};
+1 -1
View File
@@ -245,7 +245,7 @@ const Profile = () => {
))}
</View>
{selected === "Playbacks" && (
<MusicàListàSection
<MusicListSection
data={userPlaybacks}
emptyText="Aucun playback pour le moment"
/>