Hello, apologies for creating this “ticket” in the Discussion area, but I do not have permission to create in the Bugs category.
We have found a timing hazard related to Chromecast playback on Android. If the Player object is created before we call BitmovinCastManager.initialize() then that Player reference does not invoke the Casting behavior as expected.
I have recreated this in the BasicCastingKotlin project by creating a “global” instance of a Player inside the SampleApplication class before calling BitmovinCastManager.initialize(). Then inside the PlayerActivity, I use the global player instead of the default player included in the PlayerView. Local playback still works, but Cast playback does not work.
This mimics the problem we have in our app. We have a Singleton Player object that is initialized for various reasons upon being injected into our Application class. It seems that because the Player is created before we call BitmovinCastManager.initialize() that the same bug occurs for us.
Any advice would be helpful. This is on the Bitmovin Android SDK version 3.104.1
Hi @jwatson, thanks for reaching out.
Generally, we highly recommend to initialize the BitmovinCastManager before player usage. The Applications onCreate should be called by the Android System very early in the Apps lifecycle and is suited for the cast manager initialization.
I think I am missing some details on when/where you are creating your Player instance. Isn’t it possible to initialize the cast manager just before the player creation?
Can you please provide more details on the behaviour you are seeing and how it is different from what you expect? i.e. what exactly is not working
You probably know, but just for reference: Besides the initialize call, the BitmovinCastManager also needs an updateContext for every context change. This is needed for the media router dialog to work properly.
As I could not see details on how you manage your player instance: Would it make sense to have the Player instance in a background/foreground service, similar to our media session sample?
Once we have more details, I can create an internal ticket.