check if timestamps exits
This commit is contained in:
@@ -15,16 +15,29 @@ const Playback = ({ route }) => {
|
|||||||
const { project } = route.params;
|
const { project } = route.params;
|
||||||
const projectId = project?.id;
|
const projectId = project?.id;
|
||||||
const songIndex = project?.songIndex;
|
const songIndex = project?.songIndex;
|
||||||
|
console.log("sonindex", songIndex);
|
||||||
const sunoTaskId = project?.sunoTaskId;
|
const sunoTaskId = project?.sunoTaskId;
|
||||||
const { setIsLoading } = useMinuit();
|
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 () => {
|
const onPressRecord = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
|
console.log(
|
||||||
|
"project",
|
||||||
|
songIndex,
|
||||||
|
"project id",
|
||||||
|
projectId,
|
||||||
|
"sunoTaskId",
|
||||||
|
sunoTaskId
|
||||||
|
);
|
||||||
if (!projectId || songIndex === undefined || !sunoTaskId) {
|
if (!projectId || songIndex === undefined || !sunoTaskId) {
|
||||||
return;
|
return;
|
||||||
// return navigate(Routes.RecordPlayback, { project });
|
// return navigate(Routes.RecordPlayback, { project });
|
||||||
}
|
}
|
||||||
if (project.musicTimeStamps.songIndex) {
|
if (project?.[`musicTimestamps.${songIndex}`]) {
|
||||||
console.log("exists");
|
console.log("exists");
|
||||||
return navigate(Routes.RecordPlayback, { project });
|
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."
|
"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) {
|
} catch (e) {
|
||||||
console.log("getSunoTimestamps error", e?.message || e);
|
console.log("getSunoTimestamps error", e?.message || e);
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
"Timestamps",
|
"Timestamps",
|
||||||
"Une erreur est survenue lors de la génération des timestamps. Tu peux quand même continuer."
|
"Une erreur est survenue lors de la génération des timestamps. Tu peux quand même continuer."
|
||||||
);
|
);
|
||||||
} finally {
|
|
||||||
await setIsLoading(false);
|
await setIsLoading(false);
|
||||||
navigate(Routes.RecordPlayback, { project });
|
|
||||||
}
|
}
|
||||||
}, [projectId, songIndex, sunoTaskId, project]);
|
}, [projectId, songIndex, sunoTaskId, project, setIsLoading]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page headerType="NONE" backgroundImg={background.playbackBG2}>
|
<Page headerType="NONE" backgroundImg={background.playbackBG2}>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useFocusEffect } from "@react-navigation/native";
|
|||||||
import { useAudioPlayer } from "expo-audio";
|
import { useAudioPlayer } from "expo-audio";
|
||||||
import { CameraView, useCameraPermissions } from "expo-camera";
|
import { CameraView, useCameraPermissions } from "expo-camera";
|
||||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
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 { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import Svg, { Circle } from "react-native-svg";
|
import Svg, { Circle } from "react-native-svg";
|
||||||
import GradientButton from "../../components/GradientButton";
|
import GradientButton from "../../components/GradientButton";
|
||||||
@@ -25,7 +25,7 @@ import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
|||||||
const TIME_BEFORE_INCREMENT_MS = 20000; // 20s
|
const TIME_BEFORE_INCREMENT_MS = 20000; // 20s
|
||||||
|
|
||||||
const RecordPlayback = ({ route }) => {
|
const RecordPlayback = ({ route }) => {
|
||||||
const { top } = useSafeAreaInsets();
|
const { top, bottom } = useSafeAreaInsets();
|
||||||
const { project } = route.params || {};
|
const { project } = route.params || {};
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
@@ -298,22 +298,6 @@ const RecordPlayback = ({ route }) => {
|
|||||||
<MusicLandHeader progress={9} onPressBack={goBack} />
|
<MusicLandHeader progress={9} onPressBack={goBack} />
|
||||||
|
|
||||||
<View style={{ flex: 1, marginTop: 11 }}>
|
<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 */}
|
{/* Overlay de compte à rebours : on affiche 5→1 pour éviter l'effet visuel à 1 */}
|
||||||
{isPreparing && countdown >= 1 && !showProgress && (
|
{isPreparing && countdown >= 1 && !showProgress && (
|
||||||
<View
|
<View
|
||||||
@@ -417,6 +401,33 @@ const RecordPlayback = ({ route }) => {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</CameraView>
|
</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>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ const Profile = () => {
|
|||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
{selected === "Playbacks" && (
|
{selected === "Playbacks" && (
|
||||||
<MusicàListàSection
|
<MusicListSection
|
||||||
data={userPlaybacks}
|
data={userPlaybacks}
|
||||||
emptyText="Aucun playback pour le moment"
|
emptyText="Aucun playback pour le moment"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user