CastCompanion Lock和Notification控件不起作用

时间:2014-06-11 11:59:08

标签: android google-cast

您好我已经在我的项目中添加了CCL。通知和锁定屏幕显示正确。但是小部件中的控件对Chromecast上正在播放的视频不做任何事情

    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>

1 个答案:

答案 0 :(得分:1)

您需要在清单中替换以下所示的代码。

 <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"/>