[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Thu Sep 13 2018

Cast Migration Guide From Bitmovin Android SDK 2.6.0 And Below to 2.7.0+

OverviewLink Icon

With the update from Bitmovin Android SDK version 2.6.0 to 2.7.0, the cast framework was updated from CastV2 to CastV3. This also affects our API regarding the usage of the cast feature.

AndroidManifestLink Icon

Before, it was needed to declare a receiver and a service in the AndroidManifest.xml:

1<receiver android:name="com.google.android.libraries.cast.companionlibrary.remotecontrol.VideoIntentReceiver" />
2<service android:name="com.google.android.libraries.cast.companionlibrary.notification.VideoCastNotificationService" />

These two lines are no longer needed and can be removed.

The VideoCastControllerActivity which was needed up to version 2.6.0 is not needed anymore and should be removed:

1<activity
2 android:name="com.google.android.libraries.cast.companionlibrary.cast.player.VideoCastControllerActivity"
3 android:screenOrientation="portrait"
4 android:label="@string/app_name"
5 android:launchMode="singleTask"
6 android:theme="@style/NoActionBar">
7<intent-filter>
8 <action android:name="android.intent.action.MAIN" />
9</intent-filter>
10</activity>

It should be replaced by the ExpandedControllerActivity:

1<activity
2 android:name="com.bitmovin.player.cast.ExpandedControllerActivity"
3 android:label="@string/app_name"
4 android:launchMode="singleTask"
5 android:theme="@style/Theme.AppCompat.NoActionBar"
6 android:screenOrientation="portrait">
7<intent-filter>
8 <action android:name="android.intent.action.MAIN"/>
9</intent-filter>
10<meta-data
11 android:name="android.support.PARENT_ACTIVITY"
12 android:value="com.example.VideoBrowserActivity"/>
13</activity>

Note: The theme can be changed, but must extend the NoActionBar theme. We also recommend to set a PARENT_ACTIVITY.

If a custom implementation of a ExpandedControllerActivity is used, it must be declared instead.

The CastV3 framework uses a CastOptionsProvider for the setup process. The Bitmovin SDK provides an implementation of the CastOptionsProvider. It must be declared in the application tag of the AndroidManifest.xml:

1<meta-data
2 android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
3 android:value="com.bitmovin.player.cast.BitmovinCastOptionsProvider" />

For a flawless experience, we recommend to use the BitmovinCastOptionsProvider.

InitializationLink Icon

Up to 2.6.0 it was needed to initialize the BitmovinCastManager with the Context in the Application class.

1@Override
2public void onCreate()
3{
4 super.onCreate();
5
6 BitmovinCastManager.initialize(this);
7}

Since 2.7.0 the Context is no longer needed. However, you can still provide a custom application id and namespace.

1@Override
2public void onCreate()
3{
4 super.onCreate();
5
6 // To use a custom expanded cast controller Activity use:
7 // BitmovinCastManager.initialize(CustomCastControllerActivity.class);
8 // Or to use a custom cast application:
9 // BitmovinCastManager.initialize("APPID","MESSAGENAMESPACE");
10 BitmovinCastManager.initialize();
11}

Here it is also possible to define a CustomCastControllerActivity. Keep in mind that all Activities must be declared in the Manifest.

ActivitiesLink Icon

Up to 2.6.0 it was needed to call incrementUiCounter and decrementUiCounter in the onResume and onPause methods of every Activity. This is no longer needed and must be removed.

However, with 2.7.0+ it is needed to call updateContext in the onCreate of every Activity:

1@Override
2protected void onCreate(Bundle savedInstanceState)
3{
4 super.onCreate(savedInstanceState);
5 setContentView(R.layout.activity_player);
6
7 BitmovinCastManager.getInstance().updateContext(this);
8
9 ...
10}

Advanced settingsLink Icon

MiniPlayer

If a MiniPlayer was declared in a layout.xml, the snipped must be removed:

1<com.google.android.libraries.cast.companionlibrary.widgets.MiniController
2 android:id="@+id/miniController"
3 android:layout_width="fill_parent"
4 android:layout_height="wrap_content"
5 android:layout_alignParentBottom="true"
6 android:visibility="gone"
7 app:auto_setup="true"/>

The following snipped must be used instead:

1<fragment
2 android:id="@+id/cast_mini_controller"
3 android:layout_width="fill_parent"
4 android:layout_height="wrap_content"
5 android:layout_alignParentBottom="true"
6 app:castShowImageThumbnail="true"
7 android:visibility="gone"
8 class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment" />

CastButton

CastButtons must be added as described in the official GoogleCast documentation: Add a CastButton

Styling

For guidance on how to customize the style, we recommend having a look at the cast documentation: Advanced Features

Give us feedback