【问题标题】:on tap of minicontroller is not taking to extended controller in android chromecast微型控制器的水龙头没有使用 android chromecast 中的扩展控制器
【发布时间】:2020-06-04 05:25:27
【问题描述】:

为什么 minicontroller 没有在 Tap 时使用扩展控制器。 我为小控制器添加了以下代码,如Codelabs中给出的@

<fragment
            android:id="@+id/castMiniController"
            class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

但在我的情况下,迷你控制器的进度条不在底部,它位于迷你控制器块的顶部。

点击它时它不会进入扩展控制器活动,为什么?

【问题讨论】:

    标签: android chromecast


    【解决方案1】:

    您必须参考代码实验室的notification and lockscreen 部分。

    检查你有没有注册NotificationOptions 没有。那部分会做你的工作

    import com.google.android.gms.cast.framework.media.CastMediaOptions;
    import com.google.android.gms.cast.framework.media.NotificationOptions;
    
    public CastOptions getCastOptions(Context context) {
        NotificationOptions notificationOptions = new NotificationOptions.Builder()
                .setTargetActivityClassName(VideoBrowserActivity.class.getName())
                .build();
        CastMediaOptions mediaOptions = new CastMediaOptions.Builder()
                .setNotificationOptions(notificationOptions)
                .build();
    
        return new CastOptions.Builder()
                .setReceiverApplicationId(context.getString(R.string.app_id))
                .setCastMediaOptions(mediaOptions)
                .build();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-29
      • 1970-01-01
      • 2021-05-15
      • 2020-04-08
      • 1970-01-01
      • 2012-01-05
      相关资源
      最近更新 更多