auto timestamp lyricks when song selected

This commit is contained in:
Thomas Demirdjian
2025-09-09 13:51:20 +02:00
parent 9a9de33ef2
commit ea9bfb0f05
7 changed files with 158 additions and 181 deletions
+3 -3
View File
@@ -27,9 +27,9 @@ if (!firebase?.apps?.filter(({ name_ }) => name_ === "[DEFAULT]").length) {
persistence: getReactNativePersistence(AsyncStorage),
});
if (__DEV__) {
firebase.functions().useEmulator("localhost", 5001);
}
// if (__DEV__) {
// firebase.functions().useEmulator("localhost", 5001);
// }
console.log("Firebase init");
}
+4 -24
View File
@@ -34,10 +34,10 @@ const SongReady = () => {
1: { pos: 0, dur: 0 },
});
const player0 = useAudioPlayer(
musicUrls[0] ? { uri: musicUrls[0] } : undefined
musicUrls[0] ? { uri: musicUrls[0] } : undefined,
);
const player1 = useAudioPlayer(
musicUrls[1] ? { uri: musicUrls[1] } : undefined
musicUrls[1] ? { uri: musicUrls[1] } : undefined,
);
const wasPlayingBeforeSeek = useRef({ 0: false, 1: false });
@@ -120,26 +120,6 @@ const SongReady = () => {
songUrl: url,
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
});
// Déclenche la génération des timestamps immédiatement après avoir fixé la songUrl
try {
console.log("task id is : ", selectedProject?.sunoTaskId);
const taskId = selectedProject?.sunoTaskId || null;
if (taskId) {
const callable = firebase
.functions()
.httpsCallable("music-getSunoTimestamps");
// Fire-and-forget (ne bloque pas l'UI)
callable({
taskId,
musicIndex: Number(selectedIndex) || 0,
projectId,
}).catch((e) =>
console.log("getSunoTimestamps (non-blocking)", e?.message)
);
}
} catch (e) {
console.log("getSunoTimestamps init error", e?.message);
}
await player0?.pause?.();
await player1?.pause?.();
navigate(Routes.FlowSelection);
@@ -157,7 +137,7 @@ const SongReady = () => {
player1?.pause?.();
} catch {}
};
}, [player0, player1])
}, [player0, player1]),
);
useEffect(() => {
@@ -241,7 +221,7 @@ const SongReady = () => {
} catch (e) {
console.log(
"SongReady pause on seek start",
e?.message
e?.message,
);
}
}}