summaryrefslogtreecommitdiff
path: root/playback
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2023-05-05 19:42:51 +0200
committerByteHamster <info@bytehamster.com>2023-05-05 19:43:45 +0200
commitf8be7d596d098e534039908ade8270e13168fd23 (patch)
treeaa168885671cf49293c8a5eec088f0fedfaaa54b /playback
parent967e289f91f51d0b5a91fdd598c3f42bd995299a (diff)
parentb063f0508f6e6439509f22769374c57f77cb499f (diff)
downloadAntennaPod-f8be7d596d098e534039908ade8270e13168fd23.zip
Merge branch 'master' into develop
Diffstat (limited to 'playback')
-rw-r--r--playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java7
-rw-r--r--playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java11
-rw-r--r--playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastStateListener.java11
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() {