I'm using the ExoPlayer Google Cast extension v2.8.4. When playing content using the CastPlayer, the device's physical volume buttons should control the receiver device's volume. This behaves as expected when the CastPlayer is contained within an Activity. However, when the CastPlayer is contained within a Service (such as a MediaBrowserServiceCompat) the physical volume buttons change the sender device's media volume.
I've created 2 sample projects demonstrating the issue:
- CastVolumeControlTest shows the proper volume control stream behavior while casting.
- CastVolumeControlServiceTest shows the incorrect volume control stream behavior while casting.
As seen in the image below, the cast device volume does appear in the full volume controls view, but the phone's media volume is the active control stream when the CastPlayer is in a service.
Is there a way to set the proper volume control stream in the Service implementation?