get music timestamps

This commit is contained in:
2025-09-03 09:52:52 +02:00
parent 289db21e53
commit 4cabe4df3c
8 changed files with 228 additions and 43 deletions
+18 -17
View File
@@ -1,21 +1,21 @@
import React, { useEffect, useRef, useState } from "react";
import Page from "../../layouts/Page";
import { background, icons } from "../../assets";
import MusicLandHeader from "../../components/MusicLandHeader";
import { goBack, navigate } from "../../navigation/NavigationService";
import Slider from "../../components/Slider";
import { Image, Platform, Pressable, View, Text } from "react-native";
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
import { useAudioPlayer } from "expo-audio";
import { BlurView } from "expo-blur";
import { Style } from "../../styles";
import { gutters, size } from "../../styles/Style";
import React, { useEffect, useRef, useState } from "react";
import { Image, Platform, Pressable, Text, View } from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions";
import { background, icons } from "../../assets";
import BorderGradientButton from "../../components/BorderGradientButton";
import GradientButton from "../../components/GradientButton";
import { Routes } from "../../navigation";
import ValidateModal from "../../components/modal/ValidateModal";
import MusicLandHeader from "../../components/MusicLandHeader";
import Slider from "../../components/Slider";
import firebase, { projectsRef } from "../../config/firebase";
import { useAudioPlayer } from "expo-audio";
import { responsiveHeight } from "react-native-responsive-dimensions";
import Page from "../../layouts/Page";
import { Routes } from "../../navigation";
import { goBack, navigate } from "../../navigation/NavigationService";
import { Style } from "../../styles";
import { gutters, size } from "../../styles/Style";
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
const SongReady = ({ route }) => {
const { projectId = null } = route?.params || {};
@@ -28,10 +28,10 @@ const SongReady = ({ route }) => {
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 });
@@ -119,10 +119,11 @@ const SongReady = ({ route }) => {
if (!projectId || !url) return;
await projectsRef.doc(projectId).set(
{
songIndex: selectedIndex,
songUrl: url,
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
},
{ merge: true },
{ merge: true }
);
navigate(Routes.FlowSelection, { projectId });
} catch (e) {
@@ -206,7 +207,7 @@ const SongReady = ({ route }) => {
} catch (e) {
console.log(
"SongReady pause on seek start",
e?.message,
e?.message
);
}
}}