Compare commits
1 Commits
main
...
front/play
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48724fd554 |
@@ -77,7 +77,7 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
const webSocket = useRef<WebSocket>();
|
const webSocket = useRef<WebSocket>();
|
||||||
const [paused, setPause] = useState<boolean>(true);
|
const [paused, setPause] = useState<boolean>(true);
|
||||||
const stopwatch = useStopwatch();
|
const stopwatch = useStopwatch();
|
||||||
const [time, setTime] = useState(0);
|
const time = useRef(0);
|
||||||
const [partitionRendered, setPartitionRendered] = useState(false); // Used to know when partitionview can render
|
const [partitionRendered, setPartitionRendered] = useState(false); // Used to know when partitionview can render
|
||||||
const [score, setScore] = useState(0); // Between 0 and 100
|
const [score, setScore] = useState(0); // Between 0 and 100
|
||||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
||||||
@@ -236,7 +236,7 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE).catch(() => {});
|
ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE).catch(() => {});
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
setTime(() => getElapsedTime()); // Countdown
|
time.current = getElapsedTime(); // Countdown
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@@ -289,7 +289,7 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
<View style={{ flexGrow: 1, justifyContent: 'center' }}>
|
<View style={{ flexGrow: 1, justifyContent: 'center' }}>
|
||||||
<PartitionCoord
|
<PartitionCoord
|
||||||
file={musixml.data}
|
file={musixml.data}
|
||||||
timestamp={time}
|
timestamp={time.current}
|
||||||
onEndReached={onEnd}
|
onEndReached={onEnd}
|
||||||
onPause={onPause}
|
onPause={onPause}
|
||||||
onResume={onResume}
|
onResume={onResume}
|
||||||
@@ -342,14 +342,14 @@ const PlayView = ({ songId, type, route }: RouteProps<PlayViewProps>) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text>
|
<Text>
|
||||||
{time < 0
|
{time.current < 0
|
||||||
? paused
|
? paused
|
||||||
? '0:00'
|
? '0:00'
|
||||||
: Math.floor((time % 60000) / 1000)
|
: Math.floor((time.current % 60000) / 1000)
|
||||||
.toFixed(0)
|
.toFixed(0)
|
||||||
.toString()
|
.toString()
|
||||||
: `${Math.floor(time / 60000)}:${Math.floor(
|
: `${Math.floor(time.current / 60000)}:${Math.floor(
|
||||||
(time % 60000) / 1000
|
(time.current % 60000) / 1000
|
||||||
)
|
)
|
||||||
.toFixed(0)
|
.toFixed(0)
|
||||||
.toString()
|
.toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user