feat: tickets

This commit is contained in:
2025-12-12 09:21:09 +01:00
parent b1ab6a549f
commit c39aaf3f15
6 changed files with 62 additions and 58 deletions
+31 -30
View File
@@ -51,7 +51,7 @@ const pickRecorderMimeType = () => {
for (const mimeType of candidates) {
try {
if (MediaRecorder.isTypeSupported(mimeType)) return mimeType;
} catch {}
} catch { }
}
return undefined;
@@ -135,7 +135,7 @@ const RecordPlayback = ({ route }) => {
progressTimerRef.current =
listenTimerRef.current =
countdownTimerRef.current =
null;
null;
};
const resetUI = () => {
@@ -176,7 +176,7 @@ const RecordPlayback = ({ route }) => {
) {
mediaRecorderRef.current.stop();
}
} catch (e) {}
} catch (e) { }
recordedChunksRef.current = [];
releaseRecordingUrl();
@@ -262,7 +262,7 @@ const RecordPlayback = ({ route }) => {
}
recorder.stop();
}
} catch (e) {}
} catch (e) { }
if (!waitPromise) {
return recordedUrlRef.current || null;
@@ -286,10 +286,10 @@ const RecordPlayback = ({ route }) => {
try {
await player?.pause?.();
await player?.seekTo?.(0);
} catch (e) {}
} catch (e) { }
try {
await stopRecorderAndGetUrl();
} catch (e) {}
} catch (e) { }
if (!preserveRecordingForNextScreenRef.current) {
releaseRecordingUrl();
}
@@ -337,7 +337,7 @@ const RecordPlayback = ({ route }) => {
if (!cameraPermission?.granted) {
await requestCameraPermission();
}
} catch (e) {}
} catch (e) { }
})();
return () => {
clearAllTimers();
@@ -404,13 +404,13 @@ const RecordPlayback = ({ route }) => {
}
const playPromise = video.play?.();
if (playPromise && typeof playPromise.catch === "function") {
playPromise.catch(() => {});
playPromise.catch(() => { });
}
} catch (e) {}
} catch (e) { }
} else {
try {
video.srcObject = null;
} catch {}
} catch { }
}
}, [mediaReady, mediaError]);
@@ -423,7 +423,7 @@ const RecordPlayback = ({ route }) => {
) {
mediaRecorderRef.current.stop();
}
} catch {}
} catch { }
if (mediaStreamRef.current) {
mediaStreamRef.current.getTracks().forEach((track) => track.stop());
mediaStreamRef.current = null;
@@ -439,7 +439,7 @@ const RecordPlayback = ({ route }) => {
clearAllTimers();
try {
await player?.pause?.();
} catch (e) {}
} catch (e) { }
let videoUrl = null;
try {
@@ -447,7 +447,7 @@ const RecordPlayback = ({ route }) => {
if (!videoUrl) {
videoUrl = recordedUrlRef.current || null;
}
} catch (e) {}
} catch (e) { }
setIsRecording(false);
setIsPaused(false);
@@ -473,9 +473,9 @@ const RecordPlayback = ({ route }) => {
const fallback =
perfStartRef.current != null
? Math.max(
0,
(performance.now() - perfStartRef.current - pausedTotal) / 1000,
)
0,
(performance.now() - perfStartRef.current - pausedTotal) / 1000,
)
: 0;
let nextDur = rawDur > 0 ? rawDur : dur || 0;
@@ -492,7 +492,7 @@ const RecordPlayback = ({ route }) => {
await player?.seekTo?.(0);
correctedInitialJumpRef.current = true;
nextPos = 0;
} catch (e) {}
} catch (e) { }
}
const timeSinceStart =
@@ -543,11 +543,11 @@ const RecordPlayback = ({ route }) => {
await projectsRef
.doc(project.id)
.set({ views: increment(1) }, { merge: true });
} catch (e) {}
} catch (e) { }
}
}
}
} catch (e) {}
} catch (e) { }
}, 500);
}, [player, project?.id]);
@@ -585,7 +585,7 @@ const RecordPlayback = ({ route }) => {
onPress: () => {
try {
goBack();
} catch {}
} catch { }
},
},
],
@@ -630,13 +630,13 @@ const RecordPlayback = ({ route }) => {
pausedAtRef.current = performance.now();
try {
await player?.pause?.();
} catch (e) {}
} catch (e) { }
try {
const recorder = mediaRecorderRef.current;
if (recorder && recorder.state === "recording") {
recorder.pause?.();
}
} catch (e) {}
} catch (e) { }
return;
}
const pausedAt = pausedAtRef.current;
@@ -651,17 +651,17 @@ const RecordPlayback = ({ route }) => {
if (recorder && recorder.state === "paused") {
recorder.resume?.();
}
} catch (e) {}
} catch (e) { }
try {
await player?.play?.();
} catch (e) {}
} catch (e) {}
} catch (e) { }
} catch (e) { }
}, [isRecording, player]);
const handleRestartRecording = useCallback(async () => {
try {
await startCountdownThenRecord();
} catch (e) {}
} catch (e) { }
}, [startCountdownThenRecord]);
const progressRatio = dur > 0 ? Math.min(1, pos / dur) : 0;
@@ -669,9 +669,10 @@ const RecordPlayback = ({ route }) => {
return (
<Page
style={{ flex: 1 }}
containerStyle={{ backgroundColor: Palette.tran }}
// containerStyle={{ backgroundColor: Palette.gray }}
headerType="NONE"
backgroundImg={background.playbackBG2}
backgroundColor={Palette.grayMid}
// backgroundImg={background.playbackBG2}
>
<MusicLandHeader progress={9} onPressBack={goBack} />
@@ -895,7 +896,7 @@ const RecordPlayback = ({ route }) => {
try {
if (!cameraPermission?.granted)
await requestCameraPermission();
} catch {}
} catch { }
}}
/>
</View>
@@ -909,7 +910,7 @@ const RecordPlayback = ({ route }) => {
position: "absolute",
left: 0,
right: 0,
bottom: bottom + 130,
bottom: bottom + 180,
paddingHorizontal: gutters,
}}
>
+2 -2
View File
@@ -11,7 +11,7 @@ import ProgressSlider from "../../components/player/ProgressSlider";
import Page from "../../layouts/Page";
import { Routes } from "../../navigation";
import { goBack, navigate } from "../../navigation/NavigationService";
import { gutters } from "../../styles";
import { gutters, Palette } from "../../styles";
const RecordedPlayback = ({ route }) => {
const { videoUri, project } = route.params || {};
const songUrl = project?.songUrl || null;
@@ -163,7 +163,7 @@ const RecordedPlayback = ({ route }) => {
};
return (
<Page backgroundImg={background.playbackBG2} headerType="NONE">
<Page backgroundColor={Palette.grayMid} headerType="NONE">
<MusicLandHeader progress={19} onPressBack={goBack} />
<View
style={{ flex: 1, paddingTop: 12, gap: 14, paddingBottom: gutters * 2 }}
+16 -16
View File
@@ -69,12 +69,12 @@ const RecordedPlayback = ({ route }) => {
const stopPlayback = useCallback(async () => {
try {
if (audioPlayer?.playing) await audioPlayer.pause?.();
} catch {}
} catch { }
try {
if (videoElRef.current && !videoElRef.current.paused) {
videoElRef.current.pause();
}
} catch {}
} catch { }
}, [audioPlayer]);
useEffect(() => {
@@ -96,9 +96,9 @@ const RecordedPlayback = ({ route }) => {
if (videoElRef.current && videoUri) {
// Lecture vidéo HTML5 (muet pour éviter les policies)
videoElRef.current.muted = true;
videoElRef.current.play().catch(() => {});
videoElRef.current.play().catch(() => { });
}
} catch {}
} catch { }
};
start();
@@ -133,7 +133,7 @@ const RecordedPlayback = ({ route }) => {
videoElRef.current.currentTime = Math.max(0, posS);
}
}
} catch {}
} catch { }
}, 250);
return () => clearInterval(id);
}, [audioPlayer, videoUri]);
@@ -159,12 +159,12 @@ const RecordedPlayback = ({ route }) => {
await stopPlayback();
try {
if (audioPlayer) await audioPlayer.seekTo?.(0);
} catch {}
} catch { }
try {
if (videoElRef.current) {
videoElRef.current.currentTime = 0;
}
} catch {}
} catch { }
})();
}
}, [progress, stopPlayback, audioPlayer]);
@@ -181,7 +181,7 @@ const RecordedPlayback = ({ route }) => {
if (videoElRef.current && videoUri) {
videoElRef.current.currentTime = Math.max(0, target);
}
} catch {}
} catch { }
})();
pendingSeekRef.current = promise;
await promise;
@@ -195,7 +195,7 @@ const RecordedPlayback = ({ route }) => {
if (!promise) return;
try {
await promise;
} catch {}
} catch { }
}, []);
const wasPlayingRef = useRef(false);
@@ -211,7 +211,7 @@ const RecordedPlayback = ({ route }) => {
if (videoElRef.current && !videoElRef.current.paused) {
videoElRef.current.pause();
}
} catch {}
} catch { }
}, [audioPlayer]);
const onSeekEnd = useCallback(async () => {
try {
@@ -221,9 +221,9 @@ const RecordedPlayback = ({ route }) => {
if (wasPlayingRef.current) {
if (audioPlayer) await audioPlayer.resume?.();
if (videoElRef.current && videoUri)
videoElRef.current.play().catch(() => {});
videoElRef.current.play().catch(() => { });
}
} catch {}
} catch { }
}, [audioPlayer, videoUri, waitForPendingSeek]);
const handleTogglePlayback = useCallback(async () => {
@@ -252,9 +252,9 @@ const RecordedPlayback = ({ route }) => {
}
if (videoElRef.current && videoUri) {
videoElRef.current.muted = true;
videoElRef.current.play().catch(() => {});
videoElRef.current.play().catch(() => { });
}
} catch {}
} catch { }
}, [audioPlayer, songUrl, stopPlayback, progress, videoUri]);
return (
@@ -262,7 +262,7 @@ const RecordedPlayback = ({ route }) => {
containerStyle={{
alignItems: "none",
}}
backgroundImg={background.playbackBG2}
backgroundColor={Palette.grayMid}
headerType="NONE"
>
<MusicLandHeader
@@ -396,7 +396,7 @@ const RecordedPlayback = ({ route }) => {
onPress={async () => {
try {
await stopPlayback();
} catch {}
} catch { }
navigate(Routes.RecordPlayback, { project });
}}
/>
+8 -7
View File
@@ -80,7 +80,7 @@ const triggerWebDownload = async (url, title) => {
}
try {
window.open(url, "_blank", "noopener,noreferrer");
} catch {}
} catch { }
}
};
@@ -266,7 +266,7 @@ const PlaybackDownload = ({ route }) => {
if (tempSourcePath) {
try {
await firebase.storage().ref(tempSourcePath).delete();
} catch {}
} catch { }
}
setTooltip({
type: "error",
@@ -399,11 +399,12 @@ const PlaybackDownload = ({ route }) => {
return (
<>
<Page
backgroundImg={
action === "playback"
? background.playbackBG2
: background.productionBG2
}
// backgroundImg={
// action === "playback"
// ? background.playbackBG2
// : background.productionBG2
// }
backgroundColor={Palette.grayMid}
headerType="NONE"
>
<MusicLandHeader onPressBack={goBack} progress={50} />
+4 -3
View File
@@ -1,4 +1,4 @@
import { useIsFocused } from "@react-navigation/native";
import { useIsFocused, useNavigation, StackActions } from "@react-navigation/native";
import { BlurView } from "expo-blur";
import moment from "moment";
import React, { useEffect, useMemo, useRef, useState } from "react";
@@ -21,6 +21,7 @@ import { FONT_FAMILY } from "../../styles/Fonts";
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
const GeneratingSong = () => {
const navigation = useNavigation();
const { selectedProjectId, selectedProject } = useUser();
const [progress, setProgress] = useState(0);
const { setIsLoading } = useMinuit();
@@ -117,9 +118,9 @@ const GeneratingSong = () => {
if (!selectedProjectId) return;
if (selectedProject?.musicStatus === "GENERATED" && !navigatedRef.current) {
navigatedRef.current = true;
navigate(Routes.SongReady);
navigation.dispatch(StackActions.replace(Routes.SongReady));
}
}, [selectedProject?.musicStatus, selectedProjectId]);
}, [selectedProject?.musicStatus, selectedProjectId, navigation]);
const effectiveConfig = useMemo(() => {
// Use selectedProject.musicConfig only
+1
View File
@@ -38,6 +38,7 @@ const Palette = {
glass: "#73737324",
grayMid: "#8C8C8C",
gray: "#E5E5E5",
};
export default Palette;