From 7aceac79c57ffe9aee5aac2ae0e676d96c1ea118 Mon Sep 17 00:00:00 2001 From: Lei Nelissen Date: Wed, 17 Jun 2020 15:28:21 +0200 Subject: [PATCH] Allow for seeking outside of the app --- src/components/App.tsx | 1 + src/utility/PlaybackService.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/components/App.tsx b/src/components/App.tsx index e573b67..fbb4791 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -24,6 +24,7 @@ export default class App extends Component { TrackPlayer.CAPABILITY_SKIP_TO_NEXT, TrackPlayer.CAPABILITY_SKIP_TO_PREVIOUS, TrackPlayer.CAPABILITY_STOP, + TrackPlayer.CAPABILITY_SEEK_TO, ] }); this.setState({ isReady: true }); diff --git a/src/utility/PlaybackService.ts b/src/utility/PlaybackService.ts index 848af26..5b6ce2b 100644 --- a/src/utility/PlaybackService.ts +++ b/src/utility/PlaybackService.ts @@ -29,4 +29,9 @@ export default async function() { TrackPlayer.addEventListener('remote-stop', () => { TrackPlayer.destroy(); }); + + TrackPlayer.addEventListener('remote-seek', (event) => { + TrackPlayer.seekTo(event.position); + }); + } \ No newline at end of file