From 1e513441dced325dd9e6a20be41229877bfe42dd Mon Sep 17 00:00:00 2001 From: Chris Szurgot Date: Thu, 14 Sep 2023 09:16:25 -0700 Subject: [PATCH 1/2] Adds step to prepare() when calling PlayQueueItem Upgrading Windows SDK version to address version downgrade --- MediaManager.Forms/MediaManager.Forms.csproj | 2 +- MediaManager/Platforms/Android/MediaManagerImplementation.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MediaManager.Forms/MediaManager.Forms.csproj b/MediaManager.Forms/MediaManager.Forms.csproj index 92b57c28..e13ec2c1 100644 --- a/MediaManager.Forms/MediaManager.Forms.csproj +++ b/MediaManager.Forms/MediaManager.Forms.csproj @@ -34,7 +34,7 @@ - + diff --git a/MediaManager/Platforms/Android/MediaManagerImplementation.cs b/MediaManager/Platforms/Android/MediaManagerImplementation.cs index ec4374f3..e2da2a13 100644 --- a/MediaManager/Platforms/Android/MediaManagerImplementation.cs +++ b/MediaManager/Platforms/Android/MediaManagerImplementation.cs @@ -299,6 +299,9 @@ public override async Task PlayQueueItem(IMediaItem mediaItem) Queue.CurrentIndex = Queue.IndexOf(mediaItem); + if (this.IsStopped()) + MediaController.GetTransportControls().Prepare(); + MediaController.GetTransportControls().SkipToQueueItem(Queue.IndexOf(mediaItem)); return true; } From 08e9e81ae047f69028f56796573af19f4fbac27e Mon Sep 17 00:00:00 2001 From: Chris Szurgot Date: Thu, 5 Oct 2023 09:24:44 -0700 Subject: [PATCH 2/2] Updates PlayQueueItem(index) to correctly prepare queue Refactors PlayQueueItem(mediaItem) to use PlayQueueItem(index) to reduce duplicated code --- .../Android/MediaManagerImplementation.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/MediaManager/Platforms/Android/MediaManagerImplementation.cs b/MediaManager/Platforms/Android/MediaManagerImplementation.cs index e2da2a13..31cbe074 100644 --- a/MediaManager/Platforms/Android/MediaManagerImplementation.cs +++ b/MediaManager/Platforms/Android/MediaManagerImplementation.cs @@ -290,20 +290,9 @@ public override async Task PlayPrevious() return false; } - public override async Task PlayQueueItem(IMediaItem mediaItem) + public override Task PlayQueueItem(IMediaItem mediaItem) { - await EnsureInit(); - - if (mediaItem == null || !Queue.Contains(mediaItem)) - return false; - - Queue.CurrentIndex = Queue.IndexOf(mediaItem); - - if (this.IsStopped()) - MediaController.GetTransportControls().Prepare(); - - MediaController.GetTransportControls().SkipToQueueItem(Queue.IndexOf(mediaItem)); - return true; + return PlayQueueItem(Queue.IndexOf(mediaItem)); } public override async Task PlayQueueItem(int index) @@ -316,6 +305,9 @@ public override async Task PlayQueueItem(int index) Queue.CurrentIndex = index; + if (this.IsStopped()) + MediaController.GetTransportControls().Prepare(); + MediaController.GetTransportControls().SkipToQueueItem(index); return true; }