Bitmovin Cast is not working

Hi, I am integrating cast in my application and having a single base code for both mobile and tv, while launching the application on mobile it is working as expected but on launching the same apk on TV it is crashing.
I tried the same with the Bitmovin sample code
main/BasicCastingKotlin
it is crashing for TV.

Any help will be appreciated.

Thanks
Kalyani

Hi @kalyani.singh , thanks for raising this issue and apologies for late reply. The issue that you seem to be facing is because when Casting feature is used i.e. when Casting dependencies are added, the player looks for Android GMS services which may not be available of Android TV devices. One way to fix is this is to separate your Android Mobile and Android TV projects and not add Casting dependencies in TV project.

Another way to do this for common project is as follows.

  • No call to BitmovinCastManager should be done from application for TV application.
  • The Bitmovin player needs to be created with Cast disabled for TV app. Code snippet below.
        var remoteControlConfig = RemoteControlConfig()
        remoteControlConfig.isCastEnabled = false
        var playerConfig = PlayerConfig(remoteControlConfig=remoteControlConfig)
        player = Player.create(this, playerConfig)
        binding.bitmovinPlayerView.player = player
  • If you are using com.bitmovin.player.PlayerView in your app’s layout, add below 2 lines to it.

xmlns:bitmovin=“http://schemas.android.com/apk/res-auto
bitmovin:initialize_player=“false”

Below is the updated activity_player.xml compared to the one in BasicCastingKotlin sample app.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:keepScreenOn="true"
        tools:context="com.bitmovin.player.samples.casting.basic.PlayerActivity">

    <com.bitmovin.player.PlayerView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/bitmovinPlayerView"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            app:initialize_player="false">
    </com.bitmovin.player.PlayerView>
</RelativeLayout>

Hope this helps you solve the issue.