save playback
This commit is contained in:
@@ -141,7 +141,16 @@ const RecordedPlayback = ({ route }) => {
|
|||||||
<View
|
<View
|
||||||
style={{ width: "80%", alignSelf: "center", marginTop: 4, gap: 12 }}
|
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
|
<BorderGradientButton
|
||||||
title="Recommencer"
|
title="Recommencer"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
|
|||||||
@@ -1,29 +1,76 @@
|
|||||||
import {
|
import { BlurView } from "expo-blur";
|
||||||
View,
|
|
||||||
Text,
|
|
||||||
StyleSheet,
|
|
||||||
Image,
|
|
||||||
Pressable,
|
|
||||||
Platform,
|
|
||||||
} from "react-native";
|
|
||||||
import React from "react";
|
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 { background, img } from "../../assets";
|
||||||
import MusicLandHeader from "../../components/MusicLandHeader";
|
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 { goBack, navigate } from "../../navigation/NavigationService";
|
||||||
import { Palette } from "../../styles";
|
import { Palette } from "../../styles";
|
||||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||||
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
|
||||||
import { size } from "../../styles/Style";
|
import { size } from "../../styles/Style";
|
||||||
import { BlurView } from "expo-blur";
|
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
||||||
import { responsiveHeight } from "react-native-responsive-dimensions";
|
const DownloadSongs = ({ route }) => {
|
||||||
import { Routes } from "../../navigation";
|
// const params = useRoute().params;
|
||||||
import { useRoute } from "@react-navigation/core";
|
const { action, uri, project } = route.params || {};
|
||||||
|
console.log("project id", project?.id);
|
||||||
|
const { setIsLoading, setTooltip } = useMinuit();
|
||||||
|
|
||||||
const DownloadSongs = () => {
|
const handleDownloadUri = async () => {
|
||||||
const params = useRoute().params;
|
if (action === "playback" && project?.id) {
|
||||||
const action = params?.action;
|
// 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 (
|
return (
|
||||||
<Page
|
<Page
|
||||||
backgroundImg={
|
backgroundImg={
|
||||||
@@ -57,10 +104,16 @@ const DownloadSongs = () => {
|
|||||||
<View style={{ gap: 10 }}>
|
<View style={{ gap: 10 }}>
|
||||||
<Pressable
|
<Pressable
|
||||||
style={styles.itemContainer}
|
style={styles.itemContainer}
|
||||||
onPress={() =>
|
onPress={
|
||||||
navigate(Routes.DownloadPrices, {
|
() => {
|
||||||
action,
|
console.log("test");
|
||||||
})
|
handleDownloadUri();
|
||||||
|
}
|
||||||
|
|
||||||
|
// navigate(Routes.DownloadPrices, {
|
||||||
|
// action,
|
||||||
|
// uri,
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<BlurView
|
<BlurView
|
||||||
|
|||||||
@@ -1,26 +1,27 @@
|
|||||||
import React, { useState } from "reactn";
|
|
||||||
import { Text, Pressable } from "react-native";
|
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
|
import { Pressable, Text } from "react-native";
|
||||||
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
|
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 { responsiveWidth } from "../actions/responsiveSizes.js";
|
||||||
|
import Page from "../layouts/Page";
|
||||||
|
|
||||||
|
import alert from "../components/Alert.js";
|
||||||
import Avatar from "../components/Avatar";
|
import Avatar from "../components/Avatar";
|
||||||
import InputRow from "../components/InputRow.js";
|
import InputRow from "../components/InputRow.js";
|
||||||
import ItemRowList from "../components/ItemRowList.js";
|
import ItemRowList from "../components/ItemRowList.js";
|
||||||
import alert from "../components/Alert.js";
|
|
||||||
|
|
||||||
import { Fonts, gutters, Palette, Style } from "../styles";
|
import { Fonts, gutters, Palette, Style } from "../styles";
|
||||||
|
|
||||||
import { projectsRef } from "../config/firebase";
|
import { projectsRef } from "../config/firebase";
|
||||||
|
|
||||||
import { uploadFileToFirebase } from "../helpers/uploadToFirebase";
|
|
||||||
import { getValueFromKeyState } from "../helpers/index.js";
|
import { getValueFromKeyState } from "../helpers/index.js";
|
||||||
|
import { uploadFileToFirebase } from "../helpers/uploadToFirebase";
|
||||||
|
|
||||||
import { useUserData } from "../providers/UserDataProvider.js";
|
|
||||||
import { Routes } from "../navigation/Routes.js";
|
import { Routes } from "../navigation/Routes.js";
|
||||||
|
import { useUserData } from "../providers/UserDataProvider.js";
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/display-name
|
||||||
export default ({ navigation }) => {
|
export default ({ navigation }) => {
|
||||||
const { setIsLoading, setTooltip } = useMinuit();
|
const { setIsLoading, setTooltip } = useMinuit();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user