PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.42k stars 759 forks source link

Volume Control For Chromecast #364

Open thatfullstop opened 5 years ago

thatfullstop commented 5 years ago

Hi All,

Firstly, thank you for your contributing to this project! It is indeed very useful for so many of us.

I would like to ask about the Chromecast feature using this library. Our team is using this library in our Android App because of its flexibility in the UI in displaying YouTube videos

Right now, we would like to have Chromecast feature as part of the App. However, it seems that we cannot have the phone's physical volume button to control the chromecast volume?

When we use the YouTube App to do casting, when we click on the volume button, the Android OS will show the volume bar and the chromecast volume is selected by default.

Can this be done using this library?

Thank you once again for all contributions in this project!

PierfrancescoSoffritti commented 5 years ago

Hey, thanks to you for using the library :)

I'm pretty sure there must be a way to control Chromecast volume with the phone buttons. Unfortunately while I was working on Chromecast support I didn't have enough time to find a way to do it. So I can't really help you here. But the source code is available, you are welcome to extend it however you want! if you find a solution let me know, it would be very helpful to implement it in the library!

thatfullstop commented 5 years ago

hi Soffritti,

Thank you for your prompt reply!

I am not that proficient in Chromecast, but I got a team looking into this. Would you be able to point me in the right direction? Some links etc?

Thank you so much again!

PierfrancescoSoffritti commented 5 years ago

The library is using a custom caf receiver, so everything needs to be done manually. If you find a way to hook into Android volume controls it should be trivial, at that point you just need to send the events to the cast receiver and change the volume of the youtube player.

If you find a way to hook into Android volume controls I can do the rest :)

thatfullstop commented 5 years ago

hi. I am so sorry to disturb you again. I have some quick questions again .. do you think i can email you?

PierfrancescoSoffritti commented 5 years ago

I suggest opening issues on GitHub.

thatfullstop commented 5 years ago

Hi Soffritti,

My android team took a look at trying to hook into the volume controls for the chromecast. Their findings is that... they cant separate the volume control of the phone from the volume of the chromecast. This mean to say ... if they mute the volume, it will become muted for both chromecast and the phone. This is, of course, not ideal.

Hence I would like to seek your opinion... that via this library, it would be possible to emulate the actual behavior of a native chromecast? Ie: When I click on the physical volume key on the phone, it will popup the volume control for the chromecast itself. (and not affecting the volume of the phone)

If its possible, would you be able to point me in some direction or some documents?

Thank you soooo much!

PierfrancescoSoffritti commented 5 years ago

Hi, unfortunately the only thing i can do right now is to point you to my previous answers.

thatfullstop commented 5 years ago

Thank you! But my team cant seem to figure out volume controls part :( Hopefully 1 day we can revisit this