1

I´m using this project example for casting a video content on the TV screen. There are strange issues when I try to cast a video that is already playing in LocalPlayerActivity. So, in LocalPlayerActivity I click on play button in order to play video in the local player, after that, I click on the Cast button and select a device for casting the video content. The ExpandedControlsActivity, which should be afterwards shown, appears for one second and then immediately disappears. The thing is that I didn´t touch anything in the code.

Here is the video as well for better understanding, does anyone know what could be the problem?

Android log:

I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead. D/LocalPlayerActivity: Setting url of the VideoView to: https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4 D/LocalPlayerActivity: Controls: PlayBackState: IDLE D/LocalPlayerActivity: onStart was called D/LocalPlayerActivity: onResume() was called D/ViewRootImpl[LocalPlayerActivity]: changeCanvasOpacity: opaque=true D/ViewRootImpl[LocalPlayerActivity]: changeCanvasOpacity: opaque=false D/LocalPlayerActivity: Stopped TrickPlay Timer D/LocalPlayerActivity: Restarted TrickPlay Timer W/MediaPlayer: Couldn't open https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4: java.io.FileNotFoundException: No content provider: https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4 D/LocalPlayerActivity: Controls: PlayBackState: PLAYING D/MediaPlayer: getMetadata D/LocalPlayerActivity: onPrepared is reached D/LocalPlayerActivity: Stopped TrickPlay Timer D/LocalPlayerActivity: Restarted TrickPlay Timer V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=Nexus Player, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } D/OpenGLRenderer: endAllActiveAnimators on 0x7ca1451c00 (ListView) with handle 0x7ca20e1d80 I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=Nexus Player, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } D/onSessionStarted: sessionId: 5ee20da4-e9cf-4f99-ba97-bf3937df8246 D/LocalPlayerActivity: onPause() was called D/LocalPlayerActivity: Controls: PlayBackState: PAUSED I/art: Do partial code cache collection, code=122KB, data=114KB I/art: After code cache collection, code=120KB, data=113KB I/art: Increasing code cache capacity to 512KB D/LocalPlayerActivity: onResume() was called I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=CastVideos, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=Ready To Cast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Kantine TV, description=Chromecast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Kantine TV, description=Chromecast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=Ready To Cast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 D/skia: libjpeg error 102 from read_header D/skia: --- SkAndroidCodec::NewFromStream returned null I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. D/skia: libjpeg error 102 from read_header D/skia: --- SkAndroidCodec::NewFromStream returned null I/DynamiteModule: Considering local module com.google.android.gms.cast.framework.dynamite:0 and remote module com.google.android.gms.cast.framework.dynamite:5 I/DynamiteModule: Selected remote version of com.google.android.gms.cast.framework.dynamite, version >= 5 I/CastDynamiteModuleImpl: xv created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000005/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000005/n/arm64-v8a, /system/lib64, /vendor/lib64]]]. D/skia: libjpeg error 102 from read_header D/skia: --- SkAndroidCodec::NewFromStream returned null V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=Ready To Cast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Nexus Player, description=Now Casting: Designing For Google Cast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null } V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Kantine TV, description=Chromecast, status=null, category=RouteCategory{ name=Devices types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }

1
  • 1
    If you believe there is a bug in that sample, file a ticket on GitHub for that project.
    – Ali Naddaf
    Commented Nov 2, 2016 at 17:32

1 Answer 1

-1

After some researching and debugging, I think I found a workaround. I just stopped the thread for 500ms in method onStatusUpdated in LocalPlayerActivity before executing the code for showing ExpandedControlsActivity.

remoteMediaClient.addListener(new RemoteMediaClient.Listener()
            {
                @Override
                public void onStatusUpdated()
                {
                    try
                    {
                        Thread.sleep(500); // add this line
                        Intent intent = new Intent(LocalPlayerActivity.this, ExpandedControlsActivity.class);
                        startActivity(intent);
                        remoteMediaClient.removeListener(this);
                    }
                    catch (Exception e)
                    {
                        Log.e("onStatusUpdated", e.toString());
                    }
                }
                ...

After that, ExpandedControlsActivity isn't disappearing anymore.

Not the answer you're looking for? Browse other questions tagged or ask your own question.