How to Make A Custom Cast MediaRouter Dialog

前端 未结 1 1902
眼角桃花
眼角桃花 2021-01-27 04:10

I am currently using the CastCompanionLibrary in my project. It is working well, however I need to customize the behaviour of the Cast button.

Currently, a dialog button

相关标签:
1条回答
  • 2021-01-27 04:14

    You have a couple of options. First, you should note that when you are casting, you can build your app in a way that the act of stopping cast at that time would result in local playback so "stop casting" button should suffice. If you are fine with just hiding the "content" area of the existing dialog provided by CCL, you can copy the layout file "custom_media_route_controller_controls_dialog.xml" into your own project and just hide the area that you want (don't remove any components but wrap the content area in a simple layout and hide that layout). If you prefer to have your own, follow what CCL does; extend MediaRouteDialogFactory by overriding onCreateControllerDialogFragment(), and define your own extension of MediaRouteControllerDialog (see the package com.google.android.libraries.cast.companionlibrary.cast.dialog.video in CCL) and finally, extends VideoCastManager and override getMediaRouteDialogFactory() there to return your own factory.

    0 讨论(0)
提交回复
热议问题