This sample application of mine used to work just fine.
Somewhere in the past few months, though, Google updated Google Play Services (and Chromecast itself), and now when I call play()
on RemotePlaybackClient
for the Chromecast, Google Play Services itself crashes with:
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at com.google.android.gms.cast.media.aq.a(SourceFile:96)
at com.google.android.gms.cast.media.n.i(SourceFile:1856)
at com.google.android.gms.cast.media.u.run(SourceFile:2092)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Note that the play()
call itself has the desired effect, in that the Chromecast plays the media. But sometime after it calls the ItemActionCallback
with onResult()
, the aforementioned crash in Google PLay Services occurs. That, in turn, causes the connection to the Chromecast to collapse, so my MediaRouteActionProvider
vanishes and I have to re-run my app to connect again, despite the Chromecast actually playing the media that I requested.
I have tested this with two devices (Nexus 4 and Galaxy Nexus) with the same results.
I have even created a new app, trying to just show an image (instead of play a movie, as with the original sample), and I get the same crash.
Has anyone seen this and found some workaround/fix/whatever?