Play sound through speakers when playing music through headphones

I have streaming AudioTrackthrough headphones. I should send SoundPoolonly the built-in speakers without interrupting playback AudioTrackthrough the headphones. Any hacking gangsters?

+5
source share
1 answer

Many Android devices use the same output stream in AudioFlinger / audio HAL for all local playbacks (headphone, speaker, wired headset / headphones), which makes it impossible to route two tracks differently (therefore, on many devices, media streams are forcibly muted if a notification is heard, and you have a wired headset is connected, because otherwise you heard music in the speaker during notification playback).

, , setForceUse(FOR_MEDIA, FORCE_SPEAKER) MUSIC , , VOICE_CALL , .
, setForceUse. , handleMessage AudioService MSG_SET_FORCE_USE. , .

: setForceUse MEDIA , , ( , ). . Android 4.0 , .

+11

All Articles