Skip to content

feat: add audio usage type so it's possible to force audio from earpiece speaker#105

Open
Egbert-Jan wants to merge 1 commit into
doublesymmetry:mainfrom
Egbert-Jan:feat/add-audio-usage
Open

feat: add audio usage type so it's possible to force audio from earpiece speaker#105
Egbert-Jan wants to merge 1 commit into
doublesymmetry:mainfrom
Egbert-Jan:feat/add-audio-usage

Conversation

@Egbert-Jan
Copy link
Copy Markdown

Makes it possible to set the audio usage attribute. By doing this it is possible to force the audio to come from the earpiece speaker. A useful use case is listening to voice messages.

* The audio usage type.
*/
var audioUsageType: AudioUsageType = AudioUsageType.MEDIA
) No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a newline at the end of the file.

}
}

private fun setAudioAttributes() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't personally love the function overloading here. Perhaps we could name this function something like applyAudioAttribute().


fun setAudioAttributes(audioAttributeConfig: AudioAttributeConfig) {
scope.launch {
playerConfig = PlayerConfig(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps handleAudioFocus, audioUsageType, audioContentType should be updated to var's so that they could simply be mutated rather than replacing the entire PlayerConfig object. Not sure.

@@ -0,0 +1,18 @@
package com.doublesymmetry.kotlinaudio.models

data class AudioAttributeConfig(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit on the fence about introducing this intermediate class just to encapsulate the arguments passed to the setAudio function. @dcvz will need to weigh in on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants