I want to analyse the audio spectrum of my music player app for my bluetooth-Led project.
But as far as I understood this article:
https://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html#REMOTE_SUBMIX
There is no way for third party apps to capture the audiostream of other apps.
Does anybody know a solution?
As of Android Q, this is possible (in apps that allow it) with the AudioPlaybackCapture API:
This API gives apps the ability to copy the audio being played by other apps. This feature is the analog of screen capture, but for audio. The primary use case is for streaming apps that want to capture the audio being played by games.
Documentation
Related
In Live Game Streaming, only using cellphone I find both Game app like Honor of Kings and live streaming app can use microphone recording simultaneously. but it does not work in Android
Expect to know why it works in iOS
Yes it possible
in iOS using operating system's audio session management.more then one app will use microphone simultaneously.
I want to capture internal audio, programmatically. For instance, I want to play an audio file (on my device) and then capture the audio output - not using the microphone with the volume turned up.
Example use case: I want to make a library that other developers can use in their games, allowing users to record in-game audio.
Android says there is Playback Capture functionality, however, I just cannot find an example. I've googled for hours. Whenever I google 'android capture app sounds' or 'android record audio', I either get links to voice recording apps or some code recording from the microphone (usually nearly 10 years old)... e.g
Does anyone have a link to a working example?
You can reference MediareCorder with https://developer.android.com/guide/topics/media/mediarecorder
I have been searching for days but I am still not able to understand how exactly these differ in functionality and what role does each of them play in Media Playback? It would be very helpful if someone can explain the difference.
how exactly these differ in functionality
That is akin to asking how a shovel, a hammer, and a piece of rope differ in functionality. While all can be considered tools, they are not really replacements for one another in most use cases.
what role does each of them play in Media Playback?
MediaPlayer plays media on the Android device (audio and video, from local or streaming sources).
RemotePlaybackClient directs some other piece of hardware to play media. The classic example of this is using RemotePlaybackClient to tell a Chromecast to play a video.
While I have not dealt with MediaSession (or MediaSessionCompat), it appears to tie your media playback logic with media controllers that live outside your app, such as a Notification.MediaStyle notification (to control media playback from the Android 5.0+ lockscreen), Android Auto, etc.
In Android how can i pause video player from my application.
I am able to achieve this for music player but not for video.
(Note: my application is different from video player. Video is not running in my application. )
In Android how can i pause video player from my application
Contact the authors of the video player you want to control, and ask them if they have an API to allow third-party apps to control their video player.
In general, apps cannot control other apps this way.
I am able to achieve this for music player
It is possible that there is some music player that has a documented and supported API that you are using. Or, perhaps you are attacking some music player with security issues. Many Android developers are capable of creating a music player that cannot be controlled by third-party apps, so please do not assume that whatever you did will work across all music players.
Many people are asking for this, no one seems to have an answer so I do neither.
How is it possible that some apps serve the function to record the audio output of the android system? Everything I am finding is the very same tutorial on 1432 different sites where you can record MIC input. I don't care about mic input, I want the audio output and just can't imagine how to access it.
If everyone can get me on the right way, I would be so happy.
Seems to be currently there is no way to achieve this.
This is another question related to this : android get device overall audio output in pcm
The closest API available to you for these purposes is Visualizer. Which only captures "partial and low quality audio content".
I imagine direct audio capture functionality is omitted to prevent pro-piracy apps. It may be worth noting that there is a CAPTURE_AUDIO_OUTPUT permission, but it is "Not for use by third-party applications". So if you really do have legitimate apps that are capable of this, as you claim, they are likely system apps. Even if you wrote an app that generated its own musical sequences, for example, you would still have to write your own encoder/decoder to achieve anything close to what you're asking for (and that wouldn't even be considered audio capture at that point.)
To put it bluntly, it's currently impossible without breaking any ToS with Google or your phone provider, and will probably remain so indefinitely.
In Android 10, they have introduced Audio Playback Capture API using which we can capture the Audio being played by other applications. But it's not available in previous android versions.
An app X can also prevent any other app from listening, if that app hasn't added any constraint then this API can be used.
Just Use a bidirectional AUX Cable and hook it in your phone Headphone Port and hook it's another end to your Audio Interface "Line In" Channel (Or Whatever Input You have on your Audio Interface ) and then record that input by audacity or any good Audio Recorder.
TL;DR : use the SCR Screen Recorder app to capture video + internal audio (not microphone) [require root]
Long answer
Original answer: Record tablet's screen AND audio
Jeff's answer seems to be the only way you can use through adb. But that force you to do some work (merge video + audio).
I could do it this way :
- connect the Android device to computer with a jack cable (headphone output to microphone input);
- record video with adb shell;
- record audio with Audacity (or anything else)
- then merge video and audio with a video editor (pitivi, openshot, avconv...)
Another way is to directly use an android app:
SCR Screen Recorder - official website - XDA - short review
Mobizen for SAMSUNG - google play
RecMe - google play
SCR Screen Recorder:
pros :
the only app that truly works for recording video + internal audio with all devices
cons:
banned from google play because of SELinux policy (see XDA - Google Play ban and "Dangerous app" warning)
require root for recording internal audio
Mobizen for SAMSUNG:
pros
on google play store
cons
only the samsung version works for recording internal audio, the general or LG, XIAOMI version can't record internal audio
still a beta feature
require root for recording internal audio
RecMe:
pros
on google play store
cons
internal audio recording doesn't works on most devices
require root for recording internal audio
Personally I tried a lot of apps and the only working for me is SCR Screen Recorder.
PS : all these apps works without root if not using internal audio.