clear lot of tickets
This commit is contained in:
@@ -16,6 +16,7 @@ import KaraokeLyrics from "../../components/KaraokeLyrics";
|
||||
import MusicLandHeader from "../../components/MusicLandHeader";
|
||||
import { increment, projectsRef } from "../../config/firebase";
|
||||
import { isWeb } from "../../hooks/useLayoutType";
|
||||
import usePlayer from "../../hooks/usePlayer";
|
||||
import useSharedAudioPlayer from "../../hooks/useSharedAudioPlayer";
|
||||
import Page from "../../layouts/Page";
|
||||
import { Routes } from "../../navigation";
|
||||
@@ -59,6 +60,7 @@ const RecordPlayback = ({ route }) => {
|
||||
const { project } = route.params || {};
|
||||
const songIndex = Number(project?.songIndex ?? 0) || 0;
|
||||
const [cameraPermission, requestCameraPermission] = useCameraPermissions();
|
||||
const { setLooping, isLooping } = usePlayer() || {};
|
||||
|
||||
// Player
|
||||
const songUrl = project?.songUrl || null;
|
||||
@@ -80,6 +82,8 @@ const RecordPlayback = ({ route }) => {
|
||||
const stopRecordingPromiseRef = useRef(null);
|
||||
const stopRecordingResolveRef = useRef(null);
|
||||
const recordedUrlRef = useRef(null);
|
||||
const originalLoopingValueRef = useRef({ hasValue: false, value: false });
|
||||
const latestLoopingValueRef = useRef(isLooping ?? false);
|
||||
const [mediaReady, setMediaReady] = useState(false);
|
||||
const [mediaError, setMediaError] = useState(null);
|
||||
|
||||
@@ -100,6 +104,10 @@ const RecordPlayback = ({ route }) => {
|
||||
const correctedInitialJumpRef = useRef(false);
|
||||
const progressDebugCounterRef = useRef(0);
|
||||
|
||||
useEffect(() => {
|
||||
latestLoopingValueRef.current = isLooping ?? false;
|
||||
}, [isLooping]);
|
||||
|
||||
// Lyrics
|
||||
const alignedWords = useMemo(() => {
|
||||
const ts = project?.musicTimestamps?.[songIndex];
|
||||
@@ -328,11 +336,41 @@ const RecordPlayback = ({ route }) => {
|
||||
console.log(LOG_PREFIX, "resetSession:end");
|
||||
}, [player, releaseRecordingUrl, stopRecorderAndGetUrl]);
|
||||
|
||||
const resetSessionRef = useRef(resetSession);
|
||||
useEffect(() => {
|
||||
resetSessionRef.current = resetSession;
|
||||
}, [resetSession]);
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
void resetSession();
|
||||
return () => {};
|
||||
}, [resetSession])
|
||||
if (typeof setLooping === "function") {
|
||||
originalLoopingValueRef.current = {
|
||||
hasValue: true,
|
||||
value: latestLoopingValueRef.current,
|
||||
};
|
||||
if (latestLoopingValueRef.current) {
|
||||
setLooping(false);
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
if (
|
||||
typeof setLooping === "function" &&
|
||||
originalLoopingValueRef.current?.hasValue
|
||||
) {
|
||||
setLooping(!!originalLoopingValueRef.current.value);
|
||||
}
|
||||
};
|
||||
}, [setLooping])
|
||||
);
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
void resetSessionRef.current?.();
|
||||
return () => {
|
||||
console.log(LOG_PREFIX, "focusEffect:cleanup");
|
||||
void resetSessionRef.current?.();
|
||||
};
|
||||
}, [])
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user