[Android-development] Audio to Earpeice

Jason H jhihn at gmx.com
Thu Jan 17 21:04:12 CET 2019


I'm trying to get audio to play from the earpiece only. After investigating Android's SDK and Qt's API, it seems that I should be able to set audioRole. 

Audio {
	id: audioEar
	audioRole: Audio.VoiceCommunicationRole
	Component.onCompleted:  {
		audioEar.source = "sound.mp4" // "The audio role must be set before setting the source property."
	}
}

then some time later, audioEar.play()

But no matter what I do, it _always_ uses the speaker.

Also, while experimenting the audioRole property never "changed" I set an onAudioRoleChanged: console.log(audioRole) and it never got invoked. Looking into this further, supportedAudioRoles is emptry, so I guess I'm lucky I'm even able to get a sound....


Is there a way to get this to work? Qt5.12.





More information about the Android-development mailing list