Android CastCompanion锁和通知控件不起作用
嗨,我已经在我的项目中添加了CCL。通知和锁定屏幕将正确显示。但是小部件中的控件对当前在Chromecast上播放的视频没有任何作用Android CastCompanion锁和通知控件不起作用,android,google-cast,Android,Google Cast,嗨,我已经在我的项目中添加了CCL。通知和锁定屏幕将正确显示。但是小部件中的控件对当前在Chromecast上播放的视频没有任何作用 videoCastManager.enableFeatures(VideoCastManager.FEATURE_NOTIFICATION | VideoCastManager.FEATURE_LOCKSCREEN | VideoCastManager.FEATURE_DEBUGGING); 我在清单中添加了以下内容: <
videoCastManager.enableFeatures(VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN | VideoCastManager.FEATURE_DEBUGGING);
我在清单中添加了以下内容:
<activity android:name="com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerActivity"
android:screenOrientation="portrait" android:label="@string/app_name" android:launchMode="singleTask" android:parentActivityName=".activity.HubActivity" android:theme="@style/NGSNTheme"> <meta-data
android:name="android.support.PARENT_ACTIVITY" android:value=".activity.HubActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter> </activity>
<service android:name="com.google.sample.castcompanionlibrary.notification.VideoCastNotificationService"
android:exported="false"> <intent-filter>
<action android:name="com.google.sample.castcompanionlibrary.action.toggleplayback" />
<action android:name="com.google.sample.castcompanionlibrary.action.stop" />
<action android:name="com.google.sample.castcompanionlibrary.action.notificationvisibility" />
</intent-filter> </service>
<receiver android:name="com.google.sample.castcompanionlibrary.remotecontrol.MediaIntentReceiver" >
<intent-filter>
<action android:name="android.media.AUDIO_BECOMING_NOISY" /> <action android:name="android.intent.action.MEDIA_BUTTON" /> <action android:name="android.media.VOLUME_CHANGED_ACTION" /> <action
android:name="com.google.sample.castcompanionlibrary.action.toggleplayback" /> <action android:name="com.google.sample.castcompanionlibrary.action.stop" />
</intent-filter> </receiver>
您需要将清单中显示的代码替换为以下代码
<receiver android:name="com.google.android.libraries.cast.companionlibrary.remotecontrol.VideoIntentReceiver" >
<intent-filter>
<action android:name="android.media.AUDIO_BECOMING_NOISY" />
<action android:name="android.intent.action.MEDIA_BUTTON" />
<action android:name="com.google.android.libraries.cast.companionlibrary.action.toggleplayback" />
<action android:name="com.google.android.libraries.cast.companionlibrary.action.stop" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.libraries.cast.companionlibrary.notification.VideoCastNotificationService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.libraries.cast.companionlibrary.action.toggleplayback" />
<action android:name="com.google.android.libraries.cast.companionlibrary.action.stop" />
<action android:name="com.google.android.libraries.cast.companionlibrary.action.notificationvisibility" />
</intent-filter>
</service>
<service android:name="com.google.android.libraries.cast.companionlibrary.cast.reconnection.ReconnectionService"/>
您的日志显示了什么?另外,为什么您所显示的活动有两个android:name属性?请尝试在receiver标记中使用videointententreceiver而不是mediaententreceiver。这对我来说很有效。