mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-07 20:09:28 -05:00
player fixes, test fixes
This commit is contained in:
@@ -59,7 +59,7 @@ export default function App(): React.JSX.Element {
|
||||
capabilities: CAPABILITIES,
|
||||
notificationCapabilities: CAPABILITIES,
|
||||
// Reduced interval for smoother progress tracking and earlier prefetch detection
|
||||
progressUpdateEventInterval: 8,
|
||||
progressUpdateEventInterval: 10,
|
||||
}),
|
||||
)
|
||||
.finally(() => {
|
||||
|
||||
@@ -24,7 +24,7 @@ export const queryClient = new QueryClient({
|
||||
* 24 hours as a default.
|
||||
*/
|
||||
staleTime: 1000 * 60 * 60 * 24, // 24 hours
|
||||
retry(failureCount, error) {
|
||||
retry(failureCount: number, error: Error) {
|
||||
if (failureCount > 2) return false
|
||||
|
||||
if (error.message.includes('Network Error')) return false
|
||||
|
||||
@@ -36,8 +36,12 @@ import {
|
||||
getTracksToPreload,
|
||||
shouldStartPrefetching,
|
||||
ensureUpcomingTracksInQueue,
|
||||
optimizePlayerQueue,
|
||||
} from '../../player/helpers/gapless'
|
||||
import { PREFETCH_THRESHOLD_SECONDS } from '../../player/gapless-config'
|
||||
import {
|
||||
PREFETCH_THRESHOLD_SECONDS,
|
||||
QUEUE_PREPARATION_THRESHOLD_SECONDS,
|
||||
} from '../../player/gapless-config'
|
||||
import Toast from 'react-native-toast-message'
|
||||
import { shuffleJellifyTracks } from './utils/shuffle'
|
||||
import calculateTrackVolume from './utils/normalization'
|
||||
@@ -524,14 +528,14 @@ const PlayerContextInitializer = () => {
|
||||
}
|
||||
|
||||
// Optimize the TrackPlayer queue for smooth transitions
|
||||
// if (timeRemaining <= QUEUE_PREPARATION_THRESHOLD_SECONDS) {
|
||||
// console.debug(
|
||||
// `Gapless: Optimizing player queue (${timeRemaining}s remaining)`,
|
||||
// )
|
||||
// optimizePlayerQueue(playQueue, currentIndex).catch((error) =>
|
||||
// console.warn('Failed to optimize player queue:', error),
|
||||
// )
|
||||
// }
|
||||
if (timeRemaining <= QUEUE_PREPARATION_THRESHOLD_SECONDS) {
|
||||
console.debug(
|
||||
`Gapless: Optimizing player queue (${timeRemaining}s remaining)`,
|
||||
)
|
||||
optimizePlayerQueue(playQueue, currentIndex).catch((error) =>
|
||||
console.warn('Failed to optimize player queue:', error),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
break
|
||||
|
||||
@@ -47,29 +47,31 @@ export async function handlePlaybackProgress(
|
||||
track: JellifyTrack,
|
||||
progress: Progress,
|
||||
) {
|
||||
console.debug('Playback progress updated')
|
||||
if (Math.floor(progress.duration) - Math.floor(progress.position) <= 9) {
|
||||
console.debug(`Track finished. ${playstateApi ? 'scrobbling...' : ''}`)
|
||||
if (playstateApi) {
|
||||
console.debug('Playback progress updated')
|
||||
if (Math.floor(progress.duration) - Math.floor(progress.position) <= 10) {
|
||||
console.debug(`Track finished. ${playstateApi ? 'scrobbling...' : ''}`)
|
||||
|
||||
if (playstateApi)
|
||||
await playstateApi.reportPlaybackStopped({
|
||||
playbackStopInfo: {
|
||||
SessionId: sessionId,
|
||||
ItemId: track.item.Id,
|
||||
PositionTicks: convertSecondsToRunTimeTicks(track.duration!),
|
||||
},
|
||||
})
|
||||
} else {
|
||||
// DO NOTHING, reporting playback will just eat up power
|
||||
// Jellyfin can keep track of progress, we're going to intentionally
|
||||
// only give it the "greatest hits" (i.e., anything that involves user interaction)
|
||||
// console.debug("Reporting playback position");
|
||||
// await playstateApi.reportPlaybackProgress({
|
||||
// playbackProgressInfo: {
|
||||
// SessionId: sessionId,
|
||||
// ItemId: track.ItemId,
|
||||
// PositionTicks: convertSecondsToRunTimeTicks(progress.position)
|
||||
// }
|
||||
// });
|
||||
if (playstateApi)
|
||||
await playstateApi.reportPlaybackStopped({
|
||||
playbackStopInfo: {
|
||||
SessionId: sessionId,
|
||||
ItemId: track.item.Id,
|
||||
PositionTicks: convertSecondsToRunTimeTicks(track.duration!),
|
||||
},
|
||||
})
|
||||
} else {
|
||||
// DO NOTHING, reporting playback will just eat up power
|
||||
// Jellyfin can keep track of progress, we're going to intentionally
|
||||
// only give it the "greatest hits" (i.e., anything that involves user interaction)
|
||||
// console.debug("Reporting playback position")
|
||||
// await playstateApi.reportPlaybackProgress({
|
||||
// playbackProgressInfo: {
|
||||
// SessionId: sessionId,
|
||||
// ItemId: track.ItemId,
|
||||
// PositionTicks: convertSecondsToRunTimeTicks(progress.position)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,8 @@ export default function SignOutModal({ navigation }: SignOutModalProps): React.J
|
||||
borderColor={'$danger'}
|
||||
onPress={() => {
|
||||
navigation.goBack()
|
||||
navigate('Tabs', {
|
||||
screen: 'Login',
|
||||
params: {
|
||||
screen: 'ServerAddress',
|
||||
},
|
||||
navigate('Login', {
|
||||
screen: 'ServerAddress',
|
||||
})
|
||||
|
||||
clearDownloads()
|
||||
|
||||
@@ -10,7 +10,6 @@ import { useNowPlayingContext } from '../../providers/Player'
|
||||
import SearchStack from '../Search'
|
||||
import LibraryStack from '../Library'
|
||||
import InternetConnectionWatcher from '../../components/Network/internetConnectionWatcher'
|
||||
import { Platform } from 'react-native'
|
||||
import TabParamList from './types'
|
||||
|
||||
const Tab = createBottomTabNavigator<TabParamList>()
|
||||
@@ -26,7 +25,6 @@ export function Tabs(): React.JSX.Element {
|
||||
animation: 'shift',
|
||||
tabBarActiveTintColor: theme.primary.val,
|
||||
tabBarInactiveTintColor: theme.neutral.val,
|
||||
lazy: Platform.OS === 'ios',
|
||||
}}
|
||||
tabBar={(props) => (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user