[Android-development] Audio to Earpeice

Jason H jhihn at gmx.com
Thu Jan 17 21:30:23 CET 2019


I had a peak at the Qt source on gitlab (assuming it's up to date) and it looks like it does not support Roles, or Android's Streams. They map pretty closely:

Android AudioManager 	: Qt Audio Role
STREAM_ACCESSIBILITY	: AccessibilityRole	
STREAM_ALARM		: AlarmRole	
STREAM_DTMF		: ** no match **
STREAM_MUSIC		: MusicRole	
STREAM_NOTIFICATION	: NotificationRole 	
STREAM_RING		: RingtoneRole	
STREAM_SYSTEM		: SonificationRole	
STREAM_VOICE_CALL	: VoiceCommunicationRole
** no match ** 		: VideoRole	
** no match ** 		: GameRole
** no match ** 		: UnknownRole

supportedAudioRoles should be: [AccessibilityRole, AlarmRole, MusicRole, NotificationRole, RingtoneRole, SonificationRole, VoiceCommunicationRole]

It should be an easy add... Would this have to wait until 5.13?


> Sent: Thursday, January 17, 2019 at 3:04 PM
> From: "Jason H" <jhihn at gmx.com>
> To: android-development at lists.qt-project.org
> Subject: [Android-development] Audio to Earpeice
>
> 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.
> 
> 
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> https://lists.qt-project.org/listinfo/android-development
> 



More information about the Android-development mailing list