From 2765d09cb93541d89be94a4809320e4df33c0d47 Mon Sep 17 00:00:00 2001 From: Jacob Spizziri Date: Fri, 20 Dec 2024 15:40:29 -0500 Subject: [PATCH] feat(web): add setQueue method (#2394) --- example/src/components/PlaybackError.tsx | 2 +- web/TrackPlayerModule.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/example/src/components/PlaybackError.tsx b/example/src/components/PlaybackError.tsx index 0d469c6a8..2becb92e7 100644 --- a/example/src/components/PlaybackError.tsx +++ b/example/src/components/PlaybackError.tsx @@ -15,7 +15,7 @@ const styles = StyleSheet.create({ container: { width: '100%', marginVertical: 24, - alignSelf: 'center' + alignSelf: 'center', }, text: { color: 'red', diff --git a/web/TrackPlayerModule.ts b/web/TrackPlayerModule.ts index 9d198a11d..6150e2bf9 100644 --- a/web/TrackPlayerModule.ts +++ b/web/TrackPlayerModule.ts @@ -152,6 +152,11 @@ export class TrackPlayerModule extends PlaylistPlayer { return this.playlist; } + public async setQueue(queue: Track[]) { + await this.stop(); + this.playlist = queue; + } + public getActiveTrack(): Track | undefined { return this.current; }