Simple ongoing notification to allow audio to continue playing in the background - android

I've decided to try to make a little Android application that streams live audio from my server. I'm using a HTML5 audio tag for the audio. But, on some devices when the user goes to the browser or their messages the music stops playing. Would I need to create an ongoing notification so the audio would continue to play? Or, would something else be better? I'm using PhoneGap too, I don't know if there's a plug-in out there that I've missed that could solve this. I'm trying to learn all of this on my own, but I'm just confused at this point.

I think it ended up being a problem with the app manager just closing the app.

Related

How to disable audio capabilities for entire app

I have an app that plays videos using the video_player package. These videos have sound, but I don't want to play it. To achieve this, I use:
controller.setVolume(0.0)
The problem is whenever I open the app, even before playing a video, any background music stops.
I figure there must be a way to say "this app does not have sound capability" and then the OS won't pause any background music.
Is there a flutter specific way to do this, or should I look for iOS and Android specific solutions?
Thanks!

Process music being played by another Android app?

I'm looking to make an Android app that can process music being played by another app. More specifically I want to analyze the raw audio. I've done some research and looked around, but I'm beginning to think this isn't possible, and maybe for good reason.
Does anyone have any ideas on how I might be able to achieve this capability?
as your requirement is to analyse all aps audio and want to process raw audio too.only one possibility is there which is to start recorder in background service and analyse audio all the time like many of the call recorder app on play store is doing to record a call.
it does have some drawbacks too
background noise
you will not able to know when music starts and when stops.

Playing video on background, using cordova for android

I've created a cordova android application that stream video content from a ustream channel, and its working fine, I now want the app to keep playing the stream when its on a background. At the moment the video stream stops about 2 or 3 seconds after the app goes to background.
Is there a plugin that I can use to achieve that ? I believe this issue is not specific to ustream channels.
Thanks
Android platform has a right to passivate or terminate an application when it's no longer visible. If you need to perform actions when the application is not visible, you have to implement and register a service to do it. More information about Android services can be read here: http://developer.android.com/guide/components/services.html

How to turn off all other music when my Android app is playing music?

I was wondering how to exactly stop all other music that may be playing when my app is opened whenever there is music being played in my application. I have a couple instances where I just have sound effects, so is there anyway I can stop music that may be playing already whenever these sound effects pop up? I know I'm not giving any code, however, I have no idea how to approach this and haven't found many other questions asking similar things.Thanks!
Look at the AudioManager.requestAudioFocus API. Remember to release the focus when you're done with it, or other apps may not be able to play sounds correctly.

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