diff options
author | ByteHamster <info@bytehamster.com> | 2023-05-05 19:42:51 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2023-05-05 19:43:45 +0200 |
commit | f8be7d596d098e534039908ade8270e13168fd23 (patch) | |
tree | aa168885671cf49293c8a5eec088f0fedfaaa54b /playback | |
parent | 967e289f91f51d0b5a91fdd598c3f42bd995299a (diff) | |
parent | b063f0508f6e6439509f22769374c57f77cb499f (diff) | |
download | AntennaPod-f8be7d596d098e534039908ade8270e13168fd23.zip |
Merge branch 'master' into develop
Diffstat (limited to 'playback')
3 files changed, 22 insertions, 7 deletions
diff --git a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java index 83abd98b7..91ce3315c 100644 --- a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java +++ b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java @@ -20,7 +20,12 @@ public abstract class CastEnabledActivity extends AppCompatActivity { super.onCreate(savedInstanceState); canCast = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS; if (canCast) { - CastContext.getSharedInstance(this); + try { + CastContext.getSharedInstance(this); + } catch (Exception e) { + e.printStackTrace(); + canCast = false; + } } } diff --git a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java index c5bb0a205..8f0738e53 100644 --- a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java +++ b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java @@ -59,11 +59,14 @@ public class CastPsmp extends PlaybackServiceMediaPlayer { if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) != ConnectionResult.SUCCESS) { return null; } - if (CastContext.getSharedInstance(context).getCastState() == CastState.CONNECTED) { - return new CastPsmp(context, callback); - } else { - return null; + try { + if (CastContext.getSharedInstance(context).getCastState() == CastState.CONNECTED) { + return new CastPsmp(context, callback); + } + } catch (Exception e) { + e.printStackTrace(); } + return null; } public CastPsmp(@NonNull Context context, @NonNull PSMPCallback callback) { diff --git a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastStateListener.java b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastStateListener.java index 39f54b11c..c9e8c84aa 100644 --- a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastStateListener.java +++ b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastStateListener.java @@ -16,8 +16,15 @@ public class CastStateListener implements SessionManagerListener<CastSession> { castContext = null; return; } - castContext = CastContext.getSharedInstance(context); - castContext.getSessionManager().addSessionManagerListener(this, CastSession.class); + CastContext castCtx; + try { + castCtx = CastContext.getSharedInstance(context); + castCtx.getSessionManager().addSessionManagerListener(this, CastSession.class); + } catch (Exception e) { + e.printStackTrace(); + castCtx = null; + } + castContext = castCtx; } public void destroy() { |