does someone know what is the best way to implement the audio loop-back functionality in an android app?
I need to start recording sound and play that recorded sound through the headphones at the same time.
I was thinking of storing the recorded data in an buffer, and passing that buffer to mediaPlayer object within the while loop. What do you guys think, would it be feasible or is there a better approach to this(some lib,etc.)?
I would suggest you take a look at Exoplayer since it provides you ways to implement your custom data source by implementing DataSource class. So you can implement the DataSource to use a stream to play the audio. The documentation is a little vague on how to override it but if you are willing to invest a bit of time to look into exoplayer code you will easily figure it out. Though not exactly your scenarion here is one of the POCs to show how custom source can be implemented CustomDataSource