@@ -161,7 +161,7 @@ object MediaSessionManager {
161161 return checkRecordingPermissions()
162162 }
163163
164- fun parseAudioFocusOptionMap (request : ReadableMap ): Map <String , Int > {
164+ private fun parseAudioFocusOptionMap (request : ReadableMap ): Map <String , Int > {
165165 val audioFocusOptions = HashMap <String , Int >()
166166 if (request.hasKey(" focusGain" )) {
167167 when (request.getString(" focusGain" )) {
@@ -183,7 +183,7 @@ object MediaSessionManager {
183183 }
184184 if (request.hasKey(" audioAttributes" )) {
185185 val values: ReadableMap ? = request.getMap(" audioAttributes" )
186- if (values?.hasKey(" allowedCapturePolicy" ) == true ) {
186+ if (values?.hasKey(" allowedCapturePolicy" ) == true && Build . VERSION . SDK_INT >= Build . VERSION_CODES . Q ) {
187187 when (values.getString(" allowedCapturePolicy" )) {
188188 " allow_capture_by_all" ->
189189 audioFocusOptions[" allowedCapturePolicy" ] =
@@ -208,9 +208,9 @@ object MediaSessionManager {
208208 audioFocusOptions[" contentType" ] =
209209 AudioAttributes .CONTENT_TYPE_MOVIE
210210
211- " content_type_music " ->
211+ " content_type_sonification " ->
212212 audioFocusOptions[" contentType" ] =
213- AudioAttributes .CONTENT_TYPE_MUSIC
213+ AudioAttributes .CONTENT_TYPE_SONIFICATION
214214
215215 " content_type_speech" ->
216216 audioFocusOptions[" contentType" ] =
@@ -235,7 +235,7 @@ object MediaSessionManager {
235235 if (values?.hasKey(" isContentSpatialized" ) == true ) {
236236 audioFocusOptions[" isContentSpatialized" ] = if (values.getBoolean(" isContentSpatialized" )) 1 else 0
237237 }
238- if (values?.hasKey(" spatializationBehavior" ) == true ) {
238+ if (values?.hasKey(" spatializationBehavior" ) == true && Build . VERSION . SDK_INT >= Build . VERSION_CODES . S_V2 ) {
239239 when (values.getString(" spatializationBehavior" )) {
240240 " spatialization_behavior_auto" ->
241241 audioFocusOptions[" spatializationBehavior" ] =
@@ -253,7 +253,9 @@ object MediaSessionManager {
253253 " usage_assistance_navigation_guidance" -> audioFocusOptions[" usage" ] = AudioAttributes .USAGE_ASSISTANCE_NAVIGATION_GUIDANCE
254254 " usage_assistance_sonification" ->
255255 audioFocusOptions[" usage" ] = AudioAttributes .USAGE_ASSISTANCE_SONIFICATION
256- " usage_assistant" -> audioFocusOptions[" usage" ] = AudioAttributes .USAGE_ASSISTANT
256+ " usage_assistant" -> {
257+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) audioFocusOptions[" usage" ] = AudioAttributes .USAGE_ASSISTANT
258+ }
257259 " usage_game" -> audioFocusOptions[" usage" ] = AudioAttributes .USAGE_GAME
258260 " usage_media" -> audioFocusOptions[" usage" ] = AudioAttributes .USAGE_MEDIA
259261 " usage_notification" -> audioFocusOptions[" usage" ] = AudioAttributes .USAGE_NOTIFICATION
0 commit comments