I'm currently developing application and i want to control playing sound file on different headphones sides ex the first time on the left side and second time on the right side is there any way to achieve this ?
how to play sound file in single headphone side
1.4k views Asked by user101530 At
1
Yes there is a way.
MediaPlayer
.setVolume(float leftVolume,float rightVolume)
.In the following snippet we're playing an .mp3 file contained in assets folder(note if you have multiple files in the folder you should check this answer). By pressing one of the
Button
objects the song is played only out of the left or the right headphone :P.S.
The audio file must be stereo.
Whether you want to check if the headset are plugged or not before playing the audio in order to prompt a message or do something else :