Reputation: 472
The pause button in the Cast Dialog doesn't seem to be working. I noticed the same issue with the CastVideos-android sample app. Has anyone worked around this?
Upvotes: 2
Views: 1226
Reputation: 1
Please update your google play services.Faced same issue when using 9.8.0. Updated to 10.2.1, it got resolved.
Upvotes: 0
Reputation: 36
I had the exactly same issue, I worked around by making classess extending MediaRouteDialogFactory, MediaRouteControllerDialogFragment, and MediaRouteControllerDialog.
public class MyMediaRouteDialogFactory extends MediaRouteDialogFactory {
@NonNull @Override
public MediaRouteControllerDialogFragment onCreateControllerDialogFragment() {
return new MyMediaControllerDialogFragment();
}
}
public class MyMediaControllerDialogFragment extends MediaRouteControllerDialogFragment {
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_FRAME, android.R.style.Theme_NoTitleBar_Fullscreen);
}
@Override
public MediaRouteControllerDialog onCreateControllerDialog(Context context, Bundle savedInstanceState) {
return new MyMediaRouteControllerDialog(context);
}
}
public class MyMediaRouteControllerDialog extends MediaRouteControllerDialog {
public MyMediaRouteControllerDialog(Context context) {
super(context);
}
public MyMediaRouteControllerDialog(Context context, int theme) {
super(context, theme);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
if (window != null) {
window.getAttributes().dimAmount = 0.5f;
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
View playPause = findById(this, R.id.mr_control_play_pause);
if (playPause != null && playPause instanceof ImageView && getOwnerActivity() != null) {
UIMediaController mediaController = new UIMediaController(getOwnerActivity());
mediaController.bindImageViewToPlayPauseToggle((ImageView) playPause, mPlayArrowDrawable, mPauseDrawable, mStopDrawable, null, false);
}
}
}
{
// On initializing MediaRouteButton
((MediaRouteButton) mCastButton).setDialogFactory(new MyMediaRouteDialogFactory());
CastButtonFactory.setUpMediaRouteButton(getActivity(), mCastButton);
}
In short, I bound play/pause button to UIMediaController.
Upvotes: 2