Playing 2 musics through 2 different sound cards at same time

后端 未结 2 1238
梦如初夏
梦如初夏 2021-02-12 18:46

Trying something pretty out of the box... I have a simple app with a button that when pushed, plays music out of the audio jack of my android tablet.

public voi         


        
2条回答
  •  滥情空心
    2021-02-12 19:49

    According to the MediaPlayer documentation, you can set the audio device using setPreferredDevice which receive an AudioDeviceInfo as a parameter, see https://developer.android.com/reference/android/media/MediaPlayer.html#setPreferredDevice(android.media.AudioDeviceInfo).

    You will then have to create one MediaPlayer to play on each device.

提交回复
热议问题