mirror of
https://github.com/Jellify-Music/App.git
synced 2026-02-07 02:58:48 -06:00
add appKilledPlaybackBehavior to stop playback and remove notification on app kill (#720)
* add appKilledPlaybackBehavior to stop playback and remove notification on app kill * add additional RNTP mocks --------- Co-authored-by: Violet Caulfield <42452695+anultravioletaurora@users.noreply.github.com>
This commit is contained in:
6
App.tsx
6
App.tsx
@@ -11,6 +11,7 @@ import { ONE_DAY, queryClient } from './src/constants/query-client'
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
||||
import TrackPlayer, {
|
||||
AndroidAudioContentType,
|
||||
AppKilledPlaybackBehavior,
|
||||
IOSCategory,
|
||||
IOSCategoryOptions,
|
||||
} from 'react-native-track-player'
|
||||
@@ -63,6 +64,11 @@ export default function App(): React.JSX.Element {
|
||||
notificationCapabilities: CAPABILITIES,
|
||||
// Reduced interval for smoother progress tracking and earlier prefetch detection
|
||||
progressUpdateEventInterval: PROGRESS_UPDATE_EVENT_INTERVAL,
|
||||
// Stop playback and remove notification when app is killed to prevent battery drain
|
||||
android: {
|
||||
appKilledPlaybackBehavior:
|
||||
AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification,
|
||||
},
|
||||
}),
|
||||
)
|
||||
.finally(() => {
|
||||
|
||||
@@ -55,6 +55,9 @@ jest.mock('react-native-track-player', () => {
|
||||
useTrackPlayerEvents: (events: Event[], handler: (variables: any) => void) => {
|
||||
eventHandler = handler
|
||||
},
|
||||
AppKilledPlaybackBehavior: {
|
||||
StopPlaybackAndRemoveNotification: 'stopPlaybackAndRemoveNotification',
|
||||
},
|
||||
Capability: {
|
||||
Play: 1,
|
||||
PlayFromId: 2,
|
||||
|
||||
Reference in New Issue
Block a user