Solving some bugs.

This commit is contained in:
Tristan Roux
2019-05-01 01:57:40 +02:00
parent 8e129d04d0
commit 26f4988e5f
2 changed files with 12 additions and 3 deletions

View File

@@ -69,6 +69,9 @@ namespace Opus.Api
/// <param name="folderPath">The path of a folder if you want to shuffle files from this folder only.</param>
public async static void ShuffleAll(string folderPath = null)
{
if (!await MainActivity.instance.GetReadPermission())
return;
List<Song> songs = new List<Song>();
await Task.Run(() =>

View File

@@ -171,8 +171,14 @@ namespace Opus
protected override void OnStart()
{
base.OnStart();
CastContext = CastContext.GetSharedInstance(this);
CastContext.SessionManager.AddSessionManagerListener(this);
if (GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this) == ConnectionResult.Success)
{
CastContext = CastContext.GetSharedInstance(this);
CastContext.SessionManager.AddSessionManagerListener(this);
}
else
CastContext = null;
}
protected override void OnResume()
@@ -181,7 +187,7 @@ namespace Opus
Paused = false;
instance = this;
if (CastContext.SessionManager.CurrentSession == null && MusicPlayer.CurrentID() == -1)
if ((CastContext == null || CastContext.SessionManager.CurrentSession == null) && MusicPlayer.CurrentID() == -1)
MusicPlayer.currentID = MusicPlayer.RetrieveQueueSlot();
else if (MusicPlayer.UseCastPlayer)
MusicPlayer.GetQueueFromCast();