Merge pull request #1927 from domingos86/uncastable-fix
fix NPE when media is 'uncastable'
This commit is contained in:
commit
bd8e94b3bc
|
@ -701,7 +701,7 @@ public class PlaybackService extends Service {
|
|||
boolean isInQueue = false;
|
||||
FeedItem nextItem = null;
|
||||
|
||||
if (playable instanceof FeedMedia) {
|
||||
if (playable instanceof FeedMedia && ((FeedMedia) playable).getItem() != null) {
|
||||
FeedMedia media = (FeedMedia) playable;
|
||||
FeedItem item = media.getItem();
|
||||
|
||||
|
|
|
@ -264,6 +264,11 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer {
|
|||
if (!CastUtils.isCastable(playable)) {
|
||||
Log.d(TAG, "media provided is not compatible with cast device");
|
||||
callback.onMediaPlayerInfo(CAST_ERROR_PRIORITY_HIGH, R.string.cast_not_castable);
|
||||
try {
|
||||
playable.loadMetadata();
|
||||
} catch (Playable.PlayableException e) {
|
||||
Log.e(TAG, "Unable to load metadata of playable", e);
|
||||
}
|
||||
callback.endPlayback(playable, startWhenPrepared, true, false);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue