Jonathan S.
Jonathan S.

Reputation: 1550

How do you implement volume control using Cast Companion LIbrary?

I am trying to implement volume control using the Cast Companion Library. I am a bit confused how it should be done though.

Originally, I had been using VideoCastManager.onDispatchVolumeKeyEvent, which worked fine, until I turned on the lockscreen feature, which apparently prevents this method from actually doing anything:

https://github.com/googlecast/CastCompanionLibrary-android/blob/master/src/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java#L2074

It is not really clear in any of the instructions how one is to implement volume control, other than using the method I tried. I would basically like to default to controlling the cast device via the hardware buttons in all cases possible, while casting. Any suggestions?

Upvotes: 1

Views: 956

Answers (1)

Jonathan S.
Jonathan S.

Reputation: 1550

Turns out my problem was that I using

setVolumeControlStream(AudioManager.STREAM_MUSIC);

in my base activity which was overriding what the CCL was doing for me. Remember to remove any calls to this when you implement this.

Thanks to ali-naddaf for being very helpful.

Upvotes: 1

Related Questions