save playback

This commit is contained in:
2025-09-02 15:08:59 +02:00
parent 6694425707
commit 8223b572b9
3 changed files with 91 additions and 28 deletions
+10 -1
View File
@@ -141,7 +141,16 @@ const RecordedPlayback = ({ route }) => {
<View
style={{ width: "80%", alignSelf: "center", marginTop: 4, gap: 12 }}
>
<GradientButton title="Je valide" />
<GradientButton
title="Je valide"
onPress={() => {
navigate(Routes.DownloadSongs, {
action: "playback",
uri: videoUri,
project,
});
}}
/>
<BorderGradientButton
title="Recommencer"
onPress={async () => {
+74 -21
View File
@@ -1,29 +1,76 @@
import {
View,
Text,
StyleSheet,
Image,
Pressable,
Platform,
} from "react-native";
import { BlurView } from "expo-blur";
import React from "react";
import Page from "../../layouts/Page";
import {
Image,
Platform,
Pressable,
StyleSheet,
Text,
View,
} from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { responsiveHeight } from "react-native-responsive-dimensions";
import { background, img } from "../../assets";
import MusicLandHeader from "../../components/MusicLandHeader";
import { projectsRef, serverTimestamp } from "../../config/firebase";
import { uploadFileToFirebase } from "../../helpers/uploadToFirebase";
import Page from "../../layouts/Page";
import { Routes } from "../../navigation";
import { goBack, navigate } from "../../navigation/NavigationService";
import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
import { size } from "../../styles/Style";
import { BlurView } from "expo-blur";
import { responsiveHeight } from "react-native-responsive-dimensions";
import { Routes } from "../../navigation";
import { useRoute } from "@react-navigation/core";
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
const DownloadSongs = ({ route }) => {
// const params = useRoute().params;
const { action, uri, project } = route.params || {};
console.log("project id", project?.id);
const { setIsLoading, setTooltip } = useMinuit();
const DownloadSongs = () => {
const params = useRoute().params;
const action = params?.action;
const handleDownloadUri = async () => {
if (action === "playback" && project?.id) {
// Publication du playback
try {
setIsLoading(true);
const { resultURI = null } = await uploadFileToFirebase({
uri: uri,
path: `musics/${project.id}/playback.mp4`,
});
if (!resultURI) throw new Error("Téléversement de l'image impossible");
if (resultURI) {
await projectsRef.doc(project.id).set(
{
playbackUrl: resultURI,
updatedAt: serverTimestamp(),
},
{ merge: true }
);
setTooltip({
type: "success",
text: "Playback publié avec succès",
});
} else {
setTooltip({
type: "error",
text: "Erreur lors de la publication du playback",
});
}
} catch (error) {
setTooltip({
type: "error",
text: "Erreur lors de la publication du playback",
});
} finally {
setIsLoading(false);
}
// Handle playback download
} else {
// Handle song download
}
};
return (
<Page
backgroundImg={
@@ -57,10 +104,16 @@ const DownloadSongs = () => {
<View style={{ gap: 10 }}>
<Pressable
style={styles.itemContainer}
onPress={() =>
navigate(Routes.DownloadPrices, {
action,
})
onPress={
() => {
console.log("test");
handleDownloadUri();
}
// navigate(Routes.DownloadPrices, {
// action,
// uri,
// })
}
>
<BlurView
+7 -6
View File
@@ -1,26 +1,27 @@
import React, { useState } from "reactn";
import { Text, Pressable } from "react-native";
import * as ImagePicker from "expo-image-picker";
import { Pressable, Text } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import React, { useState } from "reactn";
import Page from "../layouts/Page";
import { responsiveWidth } from "../actions/responsiveSizes.js";
import Page from "../layouts/Page";
import alert from "../components/Alert.js";
import Avatar from "../components/Avatar";
import InputRow from "../components/InputRow.js";
import ItemRowList from "../components/ItemRowList.js";
import alert from "../components/Alert.js";
import { Fonts, gutters, Palette, Style } from "../styles";
import { projectsRef } from "../config/firebase";
import { uploadFileToFirebase } from "../helpers/uploadToFirebase";
import { getValueFromKeyState } from "../helpers/index.js";
import { uploadFileToFirebase } from "../helpers/uploadToFirebase";
import { useUserData } from "../providers/UserDataProvider.js";
import { Routes } from "../navigation/Routes.js";
import { useUserData } from "../providers/UserDataProvider.js";
// eslint-disable-next-line react/display-name
export default ({ navigation }) => {
const { setIsLoading, setTooltip } = useMinuit();