mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-05 18:40:01 -06:00
add background runtime to jellify
This commit is contained in:
5
App.tsx
5
App.tsx
@@ -11,8 +11,9 @@ import { queryClient } from './constants/query-client';
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import TrackPlayer, { IOSCategory, IOSCategoryOptions } from 'react-native-track-player';
|
||||
import { CAPABILITIES } from './player/constants';
|
||||
import { createWorkletRuntime } from 'react-native-reanimated';
|
||||
|
||||
// export const backgroundRuntime = createWorkletRuntime('background');
|
||||
export const backgroundRuntime = createWorkletRuntime('background');
|
||||
|
||||
export default function App(): React.JSX.Element {
|
||||
|
||||
@@ -51,7 +52,7 @@ export default function App(): React.JSX.Element {
|
||||
<PersistQueryClientProvider
|
||||
client={queryClient}
|
||||
persistOptions={{
|
||||
persister: clientPersister
|
||||
persister: clientPersister,
|
||||
}}>
|
||||
<GestureHandlerRootView>
|
||||
<TamaguiProvider config={jellifyConfig}>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// import { backgroundRuntime } from "@/App";
|
||||
import { backgroundRuntime } from "../App";
|
||||
import { runOnRuntime } from "react-native-reanimated";
|
||||
|
||||
/**
|
||||
@@ -9,11 +10,11 @@ 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) {
|
||||
// return runOnRuntime(backgroundRuntime, (runTimeSeconds: number) => {
|
||||
const runTimeMilliseconds = seconds * 1000 * 10000;
|
||||
return runOnRuntime(backgroundRuntime, (runTimeSeconds: number) => {
|
||||
const runTimeMilliseconds = runTimeSeconds * 1000 * 10000;
|
||||
|
||||
return runTimeMilliseconds;
|
||||
// })(seconds);
|
||||
})(seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,9 +25,9 @@ export function convertSecondsToRunTimeTicks(seconds: number) {
|
||||
* @see https://emby.media/community/index.php?/topic/63357-runtimeticks-microseconds-milliseconds-or-nanoseconds/
|
||||
*/
|
||||
export function convertRunTimeTicksToSeconds(ticks: number) {
|
||||
// return runOnRuntime(backgroundRuntime, (runTimeTicks : number) => {
|
||||
const runTimeMilliseconds = ticks / 10000;
|
||||
return runOnRuntime(backgroundRuntime, (runTimeTicks : number) => {
|
||||
const runTimeMilliseconds = runTimeTicks / 10000;
|
||||
const runTimeTotalSeconds = Math.floor(runTimeMilliseconds / 1000);
|
||||
return runTimeTotalSeconds;
|
||||
// })(ticks);
|
||||
})(ticks);
|
||||
}
|
||||
Reference in New Issue
Block a user