background stuff

This commit is contained in:
Violet Caulfield
2025-02-16 11:52:45 -06:00
parent 6f87918af8
commit f41a21bb0f
2 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -1,6 +1,8 @@
import { runOnRuntime } from "react-native-reanimated";
import { convertRunTimeTicksToSeconds } from "../../../helpers/runtimeticks";
import { Text } from "./text";
import React from "react";
import { backgroundRuntime } from "@/App";
export function RunTimeSeconds({ children }: { children: number }) : React.JSX.Element {
return <Text bold>{ calculateRunTimeFromSeconds(children) }</Text>
@@ -10,7 +12,9 @@ export function RunTimeTicks({ children } : { children?: number | null | undefin
if (!!!children)
return <Text>0:00</Text>
let time = calculateRunTimeFromTicks(children);
let time = runOnRuntime(backgroundRuntime, (ticks : number) => {
return calculateRunTimeFromTicks(ticks)
})(children);
return (
<Text
+2 -2
View File
@@ -9,7 +9,7 @@ import { runOnRuntime } from "react-native-reanimated";
*
* @see https://emby.media/community/index.php?/topic/63357-runtimeticks-microseconds-milliseconds-or-nanoseconds/
*/
export function convertSecondsToRunTimeTicks(seconds: number) {
export function convertSecondsToRunTimeTicks(seconds: number) : number {
return runOnRuntime(backgroundRuntime, (runTimeSeconds: number) => {
'worklet';
const runTimeMilliseconds = runTimeSeconds * 1000 * 10000;
@@ -25,7 +25,7 @@ export function convertSecondsToRunTimeTicks(seconds: number) {
*
* @see https://emby.media/community/index.php?/topic/63357-runtimeticks-microseconds-milliseconds-or-nanoseconds/
*/
export function convertRunTimeTicksToSeconds(ticks: number) {
export function convertRunTimeTicksToSeconds(ticks: number) : number {
return runOnRuntime(backgroundRuntime, (runTimeTicks : number) => {
'worklet';
const runTimeMilliseconds = runTimeTicks / 10000;