Skip to content

Commit 3e4a867

Browse files
maciejmakowski2003Maciej Makowski
andauthored
Fix/old arch/android/blocking synchronous method (#395)
* fix: marked getPreferredDeviceSample rate as blocking synchronous * ci: yarn format --------- Co-authored-by: Maciej Makowski <[email protected]>
1 parent 636561c commit 3e4a867

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/react-native-audio-api/android/src/main/java/com/swmansion/audioapi/AudioManagerModule.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ class AudioManagerModule(
4949
) {
5050
}
5151

52-
@ReactMethod
53-
fun getDevicePreferredSampleRate(): Double = this.audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE).toDouble()
52+
@ReactMethod(isBlockingSynchronousMethod = true)
53+
fun getDevicePreferredSampleRate(): Double {
54+
val sampleRate = this.audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE)
55+
return sampleRate.toDouble()
56+
}
5457

5558
override fun getName(): String = NAME
5659
}

0 commit comments

Comments
 (0)