Is it possible to play audio trough the phone speaker of an android device? The smaller speaker inside a phone that produces a low volume sound which can only be heard when listing closely with your ear against the phone.
Hopefully my description is clear enough to understand my question.
If it is possible, a example for how to accomplish this would be really helpful.
EDIT Currently i'm using the following code to initialize my MediaPlayer.
mediaPlayer = new MediaPlayer();
mediaPlayer.setOnBufferingUpdateListener(this);
mediaPlayer.setOnCompletionListener(this);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
mediaPlayer.setDataSource(audioPath);
mediaPlayer.prepare();
Tap the small button at the top right of the player notification tile. In the media player pop-up, you'll see a list of connected audio devices. Tap the one you want to switch to.
All you need to do is install SoundWire, which is an audio mirroring app on your laptop, as well as your Android. After that, connect the devices to the same WiFi network and set up the app. Tweak settings as required, and you'll be able to stream the audio from your laptop or PC through your phone's speakers.
Mirror your Android phone or tablet music From your Android phone or tablet, open the Google Home app. Tap the left hand navigation to open the menu. Tap “Cast screen / audio” and select your speakers.
If you want to play audio through the earpiece, use the STREAM_VOICE_CALL
stream type. If you use the MediaPlayer
class there's a setAudioStreamType
method that you can use for this purpose, and for the AudioTrack
class you pass the stream type to the constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With