Adjusting chromecast tv volume through mobile device volume up down buttons - android

I have integrated chromecast in my app.When video is running on tv i am able to change volume by clicking on chromcast icon which shows dialog box which allows to adjust volume.But i am not able to adjust the volume through my mobile device volume keys which are working fine when playing video locally.How can I program it in such a way that i am able to adjust volume through volume up down keys of mobile?

If your app is in front, then your activity can override dispatchKeyEvent() and use the Cast SDK Apis to increase or decrease the volume:
Cast.CastApi.setVolume(mApiClient, volume)
If your app is not in front, then you need to use MediaRouter with either MediaSession or RemoteControlClient to achieve that; that is more involved , you can take a look at this library to see how it does that.

Related

Android TV/FireOS TV volume control

I want to create a TV app to control output volume. For FireOS TV to be precise.
FireTV Stick does not have any system volume control for its users. So I tried creating a normal TV application to programmatically set volume using AudioManager.setStreamVolume() but it does not works.
To my surprise there is already an App called Precise Volume Control for phones (not optimized for TV) which actually works with FireTV Stick too by sideloading. Not just that, it allows to fine control volume upto 100 levels.
How is precise volume control able to do this in FireTV Stick. Can you point me in the right direction how to achieve this?
Transport controls are probably what you are looking for. They provide access to media playback controls. Can be found here
On TV apps, usually the UI is provided by some Leanback libraries. Which can be found here
There are Leanback Transport controls here
Usually, you would also be responsible for the media that is being played if you use the transport controls.

How can I use call sound not media sound with agora on the android web browser?

On Android Web Browser (Chrome or other browsers as well), the sound comes out to media sound, not the call sound. (in Demo too)
So, when the user controls the volume up/down buttons, it controls the call sound not the media sound. So, this misleads the users behaviours and it cause a lot of uncomfortable situations. And it's a bit difficult to control it on old android devices. Is there any way to solve this problem?
I tried with appRTC demo(https://appr.tc/). And the sound comes out to the call sound. And I can control the volume with the volume up/down buttons.
Please help me out. Thanks.
There isn't an API method to play audio as a call volume on the Agora Web SDK as of now. Media volume is the intended way of playing media on the browser. If you want to use the call volume you can check out the Android SDK instead.

How to change audio volume level for only Spotify alone on Android?

As I change audio volume on my device, Spotify changes it's volume as well.
However, I want to lower the audio volume of Spotify alone, is there any tricks to do that?
Infact, computer version of Spotify has a sweet slider at the bottom right side of player, which lets me adjust volume for Spotify ONLY!
It can be done by using the sound equalizer. Spotify > Settings > playback > Equalizer.
Turn on the equalizer and manually set the line graph to bottom. It doesn’t effectively help but it does the trick.

How to Set Media Volume Control for Android Adobe AIR?

In General, JAVA based android app development. we may use...
setVolumeControlStream(AudioManager.STREAM_MUSIC);
So that activity makes volume controller to control MEDIA Volume.
If I want to achieve this in Adobe Air based android app.
How do I do that?
How about building an AIR native extension to interact with the system volume for Android.
Like: https://github.com/nweber/SystemVolumeNativeExtension
Related Explanation article: http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html
Expected behaviour from the github readme
When changing the volume using the hardware volume keys the system
volume popup will be displayed. The AIR application will be notified
of the new volume after the system volume popup disappears. This
means that the user can press the hardware volume buttons several
times before AIR is notified of a volume change. When changing the
volume from AIR the system volume is changed, but the system volume
popup is not displayed.

Using volume buttons while in sleep mode ( music player style )

I need to use volume buttons in my application while sleep mode is active( black screen, locked).
I am using onDispachKeyEvent to capture volume buttons and it works perfectly while in normal state.
In music player if you close the screen, you can still change volume. Any idea how is done ?
Thanks
I've recently experimented quite a lot with that at my HTC Desire (and this got confirmed at several phones from another vendors).
The summary is the following: when screen is off – the volume buttons are listened by system only in case music is currently being played.
Even in this case you wouldn't get volume button key press events in Activity when the screen is off - system just modifies the volume level of AudioManager.STREAM_MUSIC when music is playing (and other corresponding audiostreams in different situations: alarm, phone call) - and doesn't do it when there's no music/alarm/call

Categories

Resources