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