In my program I'm recording audio with a microphone. And now I need to know when the user turns on a video record to release the microphone. How can I detect it. Is there any events?
And now I need to know when the user turns on a video record to release the microphone.
No, the user needs to know to shut down your app before trying to record a video.
How can I detect it. Is there any events?
You can try to use the audio focus stuff in AudioManager, though that was designed with playback in mind IIRC.
Beyond that, you have no way of knowing if anything is attempting to record video.
Related
I am trying to disable screen record and screenshot in my flutter app and I already did using flutter_windowmanager package.
my problem is with screen recording, the sound of the video inside th app is still running and recorded by screen recording !
any suggestions for also preventing sound record ?
No. If your app is playing loud enough the microphone can hear it, it can be recorded. There's no way to prevent that- algorithmically canceling out sound from one source in an audio recording like that would be difficult, if not impossible. Nor would it really buy you all that much- they could always just hold an external mic up to the phone (they can also just capture your app with a second camera, which makes removing video recording also of limited use, if done to prevent a user from recording).
The one thing you could do is claim the mic yourself and not give it up. But that would be annoying to anyone actually using your app. And wouldn't rpevent capture with an external device of course.
I am trying to do following functionality in my mobile app:
1) In my app I have record button. When pressed it starts camera recording
2) if I have music playing in my mobile phone in any of
players - this music should overlay the video
3) External microphone
in this situation should also record additional sound
So as a result we will have video record+music+microphone sound
Right now, I got stuck while trying to get access to android.permission.CAPTURE_AUDIO_OUTPUT
(I am not using root access btw and can't use it)
Is there a way to solve 1+2+3(record+music+microphone) ? If yes, how can one solve it?
Not really an answer, but too long for a comment.
Guess you should take a look at MediaRecorder here and the android.permission.RECORD_AUDIO permission. But MediaRecorder is only working with MediaPlayer. So if you are using Exoplayer or similar it's not a solution. Be aware, that this might not work on all hardware devices and with all Android Versions (I think you should test with Android 10 first)!
Be aware of AudioFocusManager on Android. If you start the camera, it will request the AudioFocus, so other music apps on your device will stop playing music if you request the camera with sound. (There are differences between Android 10 and below).
Furthermore, camera is using device microphone, so I think recording microphone and camera input at the same time might not work, but you can always use the video-sound in this case.
I want to test the music app with automation.
However, there is no way to verify that the music actually plays.
I created an app using the audio focus.
I think the audio focus is not related to real play back.
Because if it doesn't play, audio focus can hold onto the focus.
So, I want to create an app to confirm playback. What should I do?
Make the test app listen to the microphone. Play some special signal (a sweep or a click of some sort) that can be easily distinguished from the noise in the recorded signal.
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.
I'm using the simple app shown in the Android documentation to play around with recording and playing audio. Just to add a small feature, I want to get the volume of the microphone while it's recording to move a bar like how the voice recognition will fill the microphone while you are speaking into it. I looked around online, but no one seems to have a definitive answer, could someone point me in the right direction? Thanks!
i think there is no specific volume for mic. when you are recording that takes media volume as mic volume.