dev - hls

This commit is contained in:
Victor
2025-09-17 13:51:02 +02:00
parent 2d4642891d
commit 12f87f0c92
6 changed files with 443 additions and 139 deletions
+50 -54
View File
@@ -1,5 +1,5 @@
import { BlurView } from "expo-blur";
import React from "react";
import { BlurView } from 'expo-blur';
import React from 'react';
import {
Image,
Platform,
@@ -7,38 +7,38 @@ import {
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";
} 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 { size } from "../../styles/Style";
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
import { size } from '../../styles/Style';
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);
console.log('project id', project?.id);
const { setIsLoading, setTooltip } = useMinuit();
const handleDownloadUri = async () => {
if (action === "playback" && project?.id) {
if (action === 'playback' && project?.id) {
// Publication du playback
console.log("project id : ", project.id);
console.log('project id : ', project.id);
try {
setIsLoading(true);
const { resultURI = null } = await uploadFileToFirebase({
uri: uri,
path: `musics/${project.id}/playback.mp4`,
path: `musics/${project.id}/source.mp4`,
shouldCompress: true,
fileType: "VIDEO",
fileType: 'VIDEO',
});
if (!resultURI) throw new Error("Téléversement de l'image impossible");
@@ -52,20 +52,20 @@ const DownloadSongs = ({ route }) => {
{ merge: true }
);
setTooltip({
type: "success",
text: "Playback publié avec succès",
type: 'success',
text: 'Vidéo uploadée, conversion HLS en cours…',
});
} else {
setTooltip({
type: "error",
text: "Erreur lors de la publication du playback",
type: 'error',
text: 'Erreur lors de la publication du playback',
});
}
} catch (error) {
console.log("error upload playback", error);
console.log('error upload playback', error);
setTooltip({
type: "error",
text: "Erreur lors de la publication du playback",
type: 'error',
text: 'Erreur lors de la publication du playback',
});
} finally {
setIsLoading(false);
@@ -78,39 +78,37 @@ const DownloadSongs = ({ route }) => {
return (
<Page
backgroundImg={
action === "playback"
action === 'playback'
? background.playbackBG2
: background.productionBG2
}
headerType="NONE"
>
headerType='NONE'>
<MusicLandHeader onPressBack={goBack} progress={50} />
<View style={{ flex: 1, paddingTop: responsiveHeight(15) }}>
<CreateLyricsHeader
gradientProps={{
start: { x: 0, y: 0 },
end: { x: 0, y: 1 },
}}
>
}}>
<Image
source={img.placeholder2}
style={{
...size({ size: 158 }),
borderRadius: 13,
alignSelf: "center",
alignSelf: 'center',
}}
/>
<View style={{ gap: 12, paddingVertical: 12 }}>
<Text style={styles.title}>
Prêt à télécharger{" "}
{action === "playback" ? "ton Playback" : "ta chanson"} ?
Prêt à télécharger{' '}
{action === 'playback' ? 'ton Playback' : 'ta chanson'} ?
</Text>
<View style={{ gap: 10 }}>
<Pressable
style={styles.itemContainer}
onPress={
() => {
console.log("test");
console.log('test');
handleDownloadUri();
}
@@ -118,19 +116,18 @@ const DownloadSongs = ({ route }) => {
// action,
// uri,
// })
}
>
}>
<BlurView
style={styles.blurView}
intensity={Platform.OS !== "ios" ? 10 : 40}
tint="dark"
intensity={Platform.OS !== 'ios' ? 10 : 40}
tint='dark'
// experimentalBlurMethod={
// Platform.OS !== "ios" ? "dimezisBlurView" : "none"
// }
>
<Text style={styles.label}>
Télécharger{" "}
{action === "playback" ? "mon Playback" : "ma chanson"}
Télécharger{' '}
{action === 'playback' ? 'mon Playback' : 'ma chanson'}
</Text>
<Text style={styles.description}>Pour moi uniquement</Text>
</BlurView>
@@ -141,26 +138,25 @@ const DownloadSongs = ({ route }) => {
navigate(Routes.StreamSong, {
action,
})
}
>
}>
<BlurView
style={styles.blurView}
intensity={Platform.OS !== "ios" ? 10 : 40}
tint="dark"
intensity={Platform.OS !== 'ios' ? 10 : 40}
tint='dark'
// experimentalBlurMethod={
// Platform.OS !== "ios" ? "dimezisBlurView" : "none"
// }
>
<Text style={styles.label}>
Diffuser{" "}
{action === "playback" ? "mon Playback" : "ma chanson"} sur
Diffuser{' '}
{action === 'playback' ? 'mon Playback' : 'ma chanson'} sur
la plateforme de MusicLand (+ réseaux sociaux) et participer
au concours
</Text>
<Text style={styles.description}>
Top 3: 1er 15% du CA ML - 2ème 10% du CA ML - 3ème 5% du CA
ML (catégorie{" "}
{action === "playback" ? "Playback" : "chanson"})
ML (catégorie{' '}
{action === 'playback' ? 'Playback' : 'chanson'})
</Text>
</BlurView>
</Pressable>
@@ -197,9 +193,9 @@ const styles = StyleSheet.create({
},
itemContainer: {
borderRadius: 12,
overflow: "hidden",
backgroundColor: "#FFFFFF03",
shadowColor: "#0000001A",
overflow: 'hidden',
backgroundColor: '#FFFFFF03',
shadowColor: '#0000001A',
shadowOffset: {
width: 0,
height: 2,