Receiver for device media buttons NOT "media button" - android

My goal is to start a service with a media button event received from another application (i.e., when to user selects play/pause in a given media app). The catch is, I need to target the media buttons on their device and not on their headset.
To clarify I am aware of the ACTION_MEDIA_BUTTON and am almost certain it is of no value for my purpose. I may be wrong though. But I'm pretty sure.
I need an approach that targets the media buttons of the device itself.
I'm completely lost and sleep deprived. Any help would be appreciated. Thanks.

The catch is, I need to target the media buttons on their device and not on their headset.
There are no hardware media buttons on their device, for hundreds of millions of devices, beyond perhaps volume buttons. If you are dealing with some specific device that has other hardware media buttons, you will need to contact the device's manufacturer for details.
If, by "media buttons" and "when to user selects play/pause in a given media app", you are trying to spy on other applications, this is not possible, for obvious privacy reasons. Some media players have an API for announcing track changes and the like, which you might be able to use, but there is no standard API that I am aware of, and neither the AOSP Music app nor Google's proprietary Play Music app have any such documented and supported API.

Related

Openvidu subscriber volume on android

So using openvidu to setup two way calling but I noticed an issue when it’s being used on an android device.
The android phone has multiple volume controls, one of them is the media volume, so if the user watching as a subscriber has their media volume low they can’t hear the publisher speaking until they turn it up, and a few people don’t even know this exists.
By default the volume up hardware button seems to control the phone volume, or rather it seems to control the last one that was used.
It’s a little concerning that many people won’t know about this and will complain they can’t hear anything, unlike on the iPhone where the one button controls the overall volume.
I doubt this is possible but are we able to increase the android media volume
With JavaScript somehow? I very much doubt it but I’m not sure how to solve this problem if we can’t. I know we can control the video element volume itself but that seems to have no impact on the phone volume itself. As in I can turn the phone media volume all the way up but control the video element separate instead of them working together.

How To disable system settings automatically while playing music in Android

This question is for anyone who knows about audio on Android devices.
We need an Android app for auditory training.
In this app, individualised music is downloaded for each user and then listened to for a while for trining purposes.
It is essential that this music is played unchanged, i.e. without the influence of equalisers, room sound, bass amplification, etc.
Is there a way to bypass the system audio settings in the app or to deactivate them automatically?
Different manufacturers seem to handle the system audio settings somewhat differently. We have noticed differences between Samsung, Google, Sony, Motorola, OnePlus, Redmi.
Therefore, it might make the most sense to bypass the system audio within the app.
We have made attempts with CONTENT-TYPE and USAGE_ because we had the hope that USAGE_VOICE-COMMUNICATION would bypass the equalisers. But that doesn't work and some manufacturers seem to activate compressors or noise reduction, which degrades the quality of the music.
So far we are working with the integrated player.
Does a self-programmed player make a difference?
Does anyone know a solution?
Thank you!

Android: Playing audio file though telephone line

I have been searching the internet for an answer, on how to play an audio file through the telephone line (See example if you wonder what I mean). Now I have come to this site to find the answer:
Is it possible to play an audio file located on your telephone, so that the caller can hear it, without turning on your speaker and let it blast it out loud? If so, does anybody know a site to look it up at?
Example:
Peter calls Annie. Annie answers the call, and decides to play her favorite music to Peter, but she doesn't want to turn on her speaker, because her parents are sleeping in the room next to her.
I know that a telecommunications server is able to play music when people are on hold, waiting for an employee or in a queue, but is an Android phone able to do the same?
You can't do this.
All audio calls are routed through the baseband chip at a hardware level. The underlying telephony technology isn't exposed to the OS, much less the Android APIs.
So basically, this is impossible, unless you're willing to settle for playing it over the loudspeaker and hoping it gets picked up clearly.

is it possible to play system sound through phone app?

Is there a way to play sound through the iPhone or android phone app. Can I play a sound so the other party can hear a song. Is there API access to the telephone stack.
Android does not allow you to modify the outgoing audio stream during a call. The best you can do is to play whatever you want to over the loudspeaker and hope the microphone picks it up.
Apple doesn't allow you to do anything except initiate calls on iOS, so it isn't possible on that either.

Android: Detect another application has started playing audio

My music application constantly plays music in the background, however I'd like to be able to detect when another application starts playing audio (such as the YouTube app) so I can pause/mute/stop the audio in my application.
This will allow a user to continue browsing the web whilst listening to music, but then if they wish to watch a video at any point, they can do so without audio conflict.
One solution might be to listen for a broadcast which states when an application begins using the AudioManager. Does such an Intent Action exist?
Edit: As in the answer provided below, there appears to be a method of detecting the loss of audio focus in 2.2 with AudioManager.OnAudioFocusChangeListener.
Great, but is there a solution for the more common versions of Android? Ideally 1.5+.
http://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener.html
this thread also has additional information that might get you heading in the right direction.
http://groups.google.com/group/android-developers/browse_thread/thread/db6822d84feaac6/219d8cba07795c61?hl=en&lnk=gst&q=OnAudioFocusChangeListener#219d8cba07795c61

Categories

Resources