playbacks record

This commit is contained in:
2025-10-06 10:31:03 +02:00
parent 45b7571c14
commit 3cfe079e9f
7 changed files with 73 additions and 37 deletions
+1
View File
@@ -45,6 +45,7 @@
"expo-dev-client": "~5.0.20", "expo-dev-client": "~5.0.20",
"expo-device": "~7.0.3", "expo-device": "~7.0.3",
"expo-document-picker": "~13.0.3", "expo-document-picker": "~13.0.3",
"expo-file-system": "~18.0.12",
"expo-font": "~13.0.4", "expo-font": "~13.0.4",
"expo-haptics": "~14.0.1", "expo-haptics": "~14.0.1",
"expo-image": "~2.0.7", "expo-image": "~2.0.7",
+1 -1
View File
@@ -16,7 +16,7 @@ import ChooseDecor from "../screens/Playback/ChooseDecor";
import CreatingDecor from "../screens/Playback/CreatingDecor"; import CreatingDecor from "../screens/Playback/CreatingDecor";
import Playback from "../screens/Playback/Playback"; import Playback from "../screens/Playback/Playback";
import PlaybackOnboarding from "../screens/Playback/PlaybackOnboarding"; import PlaybackOnboarding from "../screens/Playback/PlaybackOnboarding";
import RecordPlayback from "../screens/Playback/RecordPlayback.web"; import RecordPlayback from "../screens/Playback/RecordPlayback";
import RecordedPlayback from "../screens/Playback/RecordedPlayback"; import RecordedPlayback from "../screens/Playback/RecordedPlayback";
import VideoFinalize from "../screens/Playback/VideoFinalize"; import VideoFinalize from "../screens/Playback/VideoFinalize";
import PrivacyPolicy from "../screens/PrivacyPolicy"; import PrivacyPolicy from "../screens/PrivacyPolicy";
-10
View File
@@ -217,34 +217,24 @@ const Library = () => {
...Style.defaultBorder, ...Style.defaultBorder,
}} }}
> >
{hasMyMusic && (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<MyMusic /> <MyMusic />
</View> </View>
)}
{hasPlaylists && (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<MyPlaylist /> <MyPlaylist />
</View> </View>
)}
</BlurView> </BlurView>
<View style={{ flexDirection: "row", gap: 20 }}> <View style={{ flexDirection: "row", gap: 20 }}>
{hasBackTracks && (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<BackTracks /> <BackTracks />
</View> </View>
)}
{hasLikedMusic && (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<LikedMusic /> <LikedMusic />
</View> </View>
)}
{hasLikedPlayback && (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<LikedPlayback /> <LikedPlayback />
</View> </View>
)}
</View> </View>
{!hasAnySection && ( {!hasAnySection && (
@@ -35,6 +35,7 @@ const LikedPlayback = () => {
liked: true, liked: true,
}) })
} }
onPressPlus={() => navigate(Routes.WritingLyrics)}
> >
<View> <View>
{items.length > 0 && ( {items.length > 0 && (
+39 -6
View File
@@ -32,12 +32,23 @@ const guessExtension = (inputUri = "") => {
}; };
const uploadSourceRecording = async ({ uri, uid, projectId }) => { const uploadSourceRecording = async ({ uri, uid, projectId }) => {
console.log("[DownloadSongs] uploadSourceRecording params", {
hasUri: Boolean(uri),
uid,
projectId,
});
if (!uri) throw new Error("Aucune vidéo trouvée"); if (!uri) throw new Error("Aucune vidéo trouvée");
if (!uid) throw new Error("Utilisateur non authentifié"); if (!uid) throw new Error("Utilisateur non authentifié");
const extension = guessExtension(uri); const extension = guessExtension(uri);
const sourcePath = `users/${uid}/projects/${projectId}/recordings/source-${Date.now()}.${extension}`; const sourcePath = `users/${uid}/projects/${projectId}/recordings/source-${Date.now()}.${extension}`;
console.log("[DownloadSongs] uploadSourceRecording source path", {
extension,
sourcePath,
});
await uploadFileToFirebase({ await uploadFileToFirebase({
uri, uri,
path: sourcePath, path: sourcePath,
@@ -51,13 +62,22 @@ const uploadSourceRecording = async ({ uri, uid, projectId }) => {
const DownloadSongs = ({ route }) => { const DownloadSongs = ({ route }) => {
const { currentUID } = useUserData(); const { currentUID } = useUserData();
const { action, uri, project } = route.params || {}; const { action, uri, project } = route.params || {};
console.log("project id", project?.id); console.log("[DownloadSongs] route params", {
action,
projectId: project?.id,
hasUri: Boolean(uri),
currentUID,
});
const { setIsLoading, setTooltip } = useMinuit(); const { setIsLoading, setTooltip } = useMinuit();
const handleDownloadUri = async () => { const handleDownloadUri = async () => {
if (action === "playback" && project?.id) { if (action === "playback" && project?.id) {
// Publication du playback // Publication du playback
console.log("project id : ", project.id); console.log("[DownloadSongs] handleDownloadUri playback", {
projectId: project.id,
uri,
currentUID,
});
let tempSourcePath = null; let tempSourcePath = null;
try { try {
setIsLoading(true); setIsLoading(true);
@@ -72,14 +92,20 @@ const DownloadSongs = ({ route }) => {
.functions() .functions()
.httpsCallable("upload-uploadProjectMedia"); .httpsCallable("upload-uploadProjectMedia");
const { data: result } = await callable({ const payload = {
sourcePath, sourcePath,
projectId: project.id, projectId: project.id,
storagePath: `users/${currentUID}/projects/${project.id}/playback.mp4`, storagePath: `users/${currentUID}/projects/${project.id}/playback.mp4`,
projectField: "playbackUrl", projectField: "playbackUrl",
deleteSource: true, deleteSource: true,
metadata: { source: "downloadSongs" }, metadata: { source: "downloadSongs" },
}); };
console.log("[DownloadSongs] calling upload-uploadProjectMedia", payload);
const { data: result } = await callable(payload);
console.log("[DownloadSongs] upload-uploadProjectMedia result", result);
const resultURI = result?.url || null; const resultURI = result?.url || null;
@@ -102,7 +128,12 @@ const DownloadSongs = ({ route }) => {
}); });
} }
} catch (error) { } catch (error) {
console.log("[DownloadSongs] error upload playback", error); console.log("[DownloadSongs] error upload playback", {
message: error?.message,
code: error?.code,
name: error?.name,
details: error?.details,
});
if (tempSourcePath) { if (tempSourcePath) {
try { try {
await firebase.storage().ref(tempSourcePath).delete(); await firebase.storage().ref(tempSourcePath).delete();
@@ -110,7 +141,9 @@ const DownloadSongs = ({ route }) => {
} }
setTooltip({ setTooltip({
type: "error", type: "error",
text: String(error?.message || "Erreur lors de la publication du playback"), text: String(
error?.message || "Erreur lors de la publication du playback"
),
}); });
} finally { } finally {
setIsLoading(false); setIsLoading(false);
+2 -1
View File
@@ -236,8 +236,9 @@ const GeneratingSong = () => {
source={ai.theo} source={ai.theo}
style={{ style={{
width: "100%", width: "100%",
height: isWeb ? 300 : "100%", height: isWeb ? 300 : "60%",
right: -10, right: -10,
top: 50,
}} }}
resizeMode="contain" resizeMode="contain"
/> />
+14 -4
View File
@@ -1,6 +1,6 @@
import { useIsFocused } from "@react-navigation/native"; import { useIsFocused } from "@react-navigation/native";
import { Image as ExpoImage } from "expo-image"; import { Image as ExpoImage } from "expo-image";
import React, { useEffect } from "react"; import React, { useCallback, useEffect } from "react";
import { ActivityIndicator, Alert, Text, View } from "react-native"; import { ActivityIndicator, Alert, Text, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { background, icons } from "../../assets"; import { background, icons } from "../../assets";
@@ -22,7 +22,7 @@ const PouchReady = () => {
const isGenerating = selectedProject?.coverStatus === "GENERATING"; const isGenerating = selectedProject?.coverStatus === "GENERATING";
const isFocused = useIsFocused(); const isFocused = useIsFocused();
const generateCover = async () => { const generateCover = useCallback(async () => {
if (!selectedProjectId) return; if (!selectedProjectId) return;
try { try {
await setIsLoading(true); await setIsLoading(true);
@@ -37,7 +37,7 @@ const PouchReady = () => {
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
}; }, [selectedProjectId, setIsLoading]);
async function validateCover() { async function validateCover() {
try { try {
@@ -62,6 +62,16 @@ const PouchReady = () => {
!selectedProject?.cover?.generatedBackground && !selectedProject?.cover?.generatedBackground &&
selectedProject?.coverStatus !== "GENERATING" selectedProject?.coverStatus !== "GENERATING"
) { ) {
if (isWeb) {
if (typeof window !== "undefined") {
const shouldGenerate = window.confirm("Générer une pochette ?");
if (shouldGenerate) {
generateCover();
}
}
return;
}
Alert.alert("Attention", "Générer une pochette ?", [ Alert.alert("Attention", "Générer une pochette ?", [
{ {
text: "Oui", text: "Oui",
@@ -72,7 +82,7 @@ const PouchReady = () => {
}, },
]); ]);
} }
}, [selectedProject, isFocused]); }, [generateCover, isFocused, selectedProject]);
return ( return (
<Page backgroundImg={background.studioBG2} headerType="NONE"> <Page backgroundImg={background.studioBG2} headerType="NONE">