playbacks ok web

This commit is contained in:
2025-10-23 14:34:37 +02:00
parent efa6c07cef
commit d1be65cb3f
3 changed files with 49 additions and 22 deletions
+3 -1
View File
@@ -26,6 +26,7 @@ import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
const TIME_BEFORE_INCREMENT_MS = 20000; const TIME_BEFORE_INCREMENT_MS = 20000;
const LOG_PREFIX = "[RecordPlayback.web]"; const LOG_PREFIX = "[RecordPlayback.web]";
const WEB_PREVIEW_WIDTH = 360;
const toSeconds = (v) => { const toSeconds = (v) => {
const n = Number(v ?? 0); const n = Number(v ?? 0);
@@ -709,7 +710,8 @@ const RecordPlayback = ({ route }) => {
<View <View
style={{ style={{
width: isWeb ? 420 : "100%", width: isWeb ? WEB_PREVIEW_WIDTH : "100%",
maxWidth: "100%",
aspectRatio: 9 / 16, aspectRatio: 9 / 16,
overflow: "hidden", overflow: "hidden",
borderRadius: 12, borderRadius: 12,
+38 -16
View File
@@ -1,4 +1,3 @@
import useSharedAudioPlayer from "../../hooks/useSharedAudioPlayer";
import React, { useEffect, useMemo, useRef, useState } from "react"; import React, { useEffect, useMemo, useRef, useState } from "react";
import { Text, View } from "react-native"; import { Text, View } from "react-native";
import { background } from "../../assets"; import { background } from "../../assets";
@@ -10,6 +9,8 @@ import Page from "../../layouts/Page";
import { Routes } from "../../navigation"; import { Routes } from "../../navigation";
import { goBack, navigate } from "../../navigation/NavigationService"; import { goBack, navigate } from "../../navigation/NavigationService";
import { gutters, Palette } from "../../styles"; import { gutters, Palette } from "../../styles";
import { isWeb } from "../../hooks/useLayoutType";
import useSharedAudioPlayer from "../../hooks/useSharedAudioPlayer";
const fmtSeconds = (s) => { const fmtSeconds = (s) => {
const total = Math.max(0, Math.floor(Number(s || 0))); const total = Math.max(0, Math.floor(Number(s || 0)));
@@ -24,6 +25,8 @@ const toSeconds = (value) => {
return n > 10000 ? n / 1000 : n; // heuristique ms → s return n > 10000 ? n / 1000 : n; // heuristique ms → s
}; };
const WEB_PREVIEW_WIDTH = 360;
const RecordedPlayback = ({ route }) => { const RecordedPlayback = ({ route }) => {
const { videoUri, project } = route.params || {}; const { videoUri, project } = route.params || {};
const songUrl = project?.songUrl || null; const songUrl = project?.songUrl || null;
@@ -156,11 +159,14 @@ const RecordedPlayback = ({ route }) => {
{videoUri ? ( {videoUri ? (
<View <View
style={{ style={{
width: "80%", width: isWeb ? WEB_PREVIEW_WIDTH : "80%",
maxWidth: "100%",
aspectRatio: 9 / 16, aspectRatio: 9 / 16,
borderRadius: 16, borderRadius: 12,
backgroundColor: "#00000066", backgroundColor: "#00000066",
overflow: "hidden", overflow: "hidden",
alignSelf: "center",
position: "relative",
}} }}
> >
<video <video
@@ -171,7 +177,7 @@ const RecordedPlayback = ({ route }) => {
style={{ style={{
width: "100%", width: "100%",
height: "100%", height: "100%",
objectFit: "contain", objectFit: "cover",
backgroundColor: "black", backgroundColor: "black",
}} }}
controls={false} controls={false}
@@ -181,13 +187,15 @@ const RecordedPlayback = ({ route }) => {
// Placeholder quand pas de vidéo sur web // Placeholder quand pas de vidéo sur web
<View <View
style={{ style={{
width: "80%", width: isWeb ? WEB_PREVIEW_WIDTH : "80%",
maxWidth: "100%",
aspectRatio: 9 / 16, aspectRatio: 9 / 16,
borderRadius: 16, borderRadius: 12,
backgroundColor: "#00000066", backgroundColor: "#00000066",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
overflow: "hidden", overflow: "hidden",
alignSelf: "center",
}} }}
> >
<Text style={{ color: Palette.white, opacity: 0.8 }}> <Text style={{ color: Palette.white, opacity: 0.8 }}>
@@ -196,19 +204,33 @@ const RecordedPlayback = ({ route }) => {
</View> </View>
)} )}
<Slider <View
value={fmtSeconds(progress.posS)} // mm:ss (seconds) style={{
maxValue={fmtSeconds(progress.durS)} // mm:ss (seconds) width: isWeb ? WEB_PREVIEW_WIDTH : "80%",
progress={sliderProgress} maxWidth: "100%",
seekEnabled={!!songUrl} alignSelf: "center",
onSeek={onSeek} }}
onSeekStart={onSeekStart} >
onSeekEnd={onSeekEnd} <Slider
/> value={fmtSeconds(progress.posS)} // mm:ss (seconds)
maxValue={fmtSeconds(progress.durS)} // mm:ss (seconds)
progress={sliderProgress}
seekEnabled={!!songUrl}
onSeek={onSeek}
onSeekStart={onSeekStart}
onSeekEnd={onSeekEnd}
/>
</View>
</View> </View>
<View <View
style={{ width: "80%", alignSelf: "center", marginTop: 4, gap: 12 }} style={{
width: isWeb ? WEB_PREVIEW_WIDTH : "80%",
maxWidth: "100%",
alignSelf: "center",
marginTop: 4,
gap: 12,
}}
> >
<GradientButton <GradientButton
title="Je valide" title="Je valide"
+8 -5
View File
@@ -10,7 +10,7 @@ import {
} from "react-native"; } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js"; import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { responsiveHeight } from "react-native-responsive-dimensions"; import { responsiveHeight } from "react-native-responsive-dimensions";
import { background, img } from "../../assets"; import { background } from "../../assets";
import MusicLandHeader from "../../components/MusicLandHeader"; import MusicLandHeader from "../../components/MusicLandHeader";
import firebase, { projectsRef, serverTimestamp } from "../../config/firebase"; import firebase, { projectsRef, serverTimestamp } from "../../config/firebase";
import { uploadFileToFirebase } from "../../helpers/uploadToFirebase"; import { uploadFileToFirebase } from "../../helpers/uploadToFirebase";
@@ -106,7 +106,10 @@ const DownloadSongs = ({ route }) => {
storagePath: `users/${currentUID}/projects/${project.id}/playback.mp4`, storagePath: `users/${currentUID}/projects/${project.id}/playback.mp4`,
}; };
console.log("[DownloadSongs] calling upload-mergeVideoAndAudio", payload); console.log(
"[DownloadSongs] calling upload-mergeVideoAndAudio",
payload
);
const { data: result } = await callable(payload); const { data: result } = await callable(payload);
@@ -186,7 +189,7 @@ const DownloadSongs = ({ route }) => {
}} }}
> >
<Image <Image
source={img.placeholder2} source={{ uri: project?.coverUrl }}
style={{ style={{
...size({ size: 158 }), ...size({ size: 158 }),
borderRadius: 13, borderRadius: 13,
@@ -195,8 +198,8 @@ const DownloadSongs = ({ route }) => {
/> />
<View style={{ gap: 12, paddingVertical: 12 }}> <View style={{ gap: 12, paddingVertical: 12 }}>
<Text style={styles.title}> <Text style={styles.title}>
Prêt à télécharger{" "} Prêt à télécharger
{action === "playback" ? "ton Playback" : "ta chanson"} ? {action === "playback" ? " ton Playback" : " ta chanson"} ?
</Text> </Text>
<View style={{ gap: 10 }}> <View style={{ gap: 10 }}>
<Pressable <Pressable