react-native-audio-api 0.6.4 → 0.6.5-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,13 @@ void AudioAPIModule::invokeHandlerWithEventNameAndEventBody(
58
58
  } else if (value->isInstanceOf(jni::JFloat::javaClassStatic())) {
59
59
  body[name] = jni::static_ref_cast<jni::JFloat>(value)->value();
60
60
  } else if (value->isInstanceOf(jni::JBoolean::javaClassStatic())) {
61
- body[name] = jni::static_ref_cast<jni::JBoolean>(value)->value();
61
+ auto booleanValue = jni::static_ref_cast<jni::JBoolean>(value)->value();
62
+
63
+ if (booleanValue) {
64
+ body[name] = true;
65
+ } else {
66
+ body[name] = false;
67
+ }
62
68
  }
63
69
  }
64
70
 
@@ -13,7 +13,7 @@ class AudioFocusListener(
13
13
  private val audioAPIModule: WeakReference<AudioAPIModule>,
14
14
  private val lockScreenManager: WeakReference<LockScreenManager>,
15
15
  ) : AudioManager.OnAudioFocusChangeListener {
16
- private var playOnAudioFocus = false
16
+ private var playOnAudioFocus: Boolean = false
17
17
  private var focusRequest: AudioFocusRequest? = null
18
18
 
19
19
  override fun onAudioFocusChange(focusChange: Int) {
@@ -23,7 +23,7 @@ class AudioFocusListener(
23
23
  playOnAudioFocus = false
24
24
  val body =
25
25
  HashMap<String, Any>().apply {
26
- put("value", "began")
26
+ put("type", "began")
27
27
  put("shouldResume", false)
28
28
  }
29
29
  audioAPIModule.get()?.invokeHandlerWithEventNameAndEventBody("interruption", body)
@@ -32,7 +32,7 @@ class AudioFocusListener(
32
32
  playOnAudioFocus = lockScreenManager.get()?.isPlaying == true
33
33
  val body =
34
34
  HashMap<String, Any>().apply {
35
- put("value", "began")
35
+ put("type", "began")
36
36
  put("shouldResume", playOnAudioFocus)
37
37
  }
38
38
  audioAPIModule.get()?.invokeHandlerWithEventNameAndEventBody("interruption", body)
@@ -41,14 +41,14 @@ class AudioFocusListener(
41
41
  if (playOnAudioFocus) {
42
42
  val body =
43
43
  HashMap<String, Any>().apply {
44
- put("value", "ended")
44
+ put("type", "ended")
45
45
  put("shouldResume", true)
46
46
  }
47
47
  audioAPIModule.get()?.invokeHandlerWithEventNameAndEventBody("interruption", body)
48
48
  } else {
49
49
  val body =
50
50
  HashMap<String, Any>().apply {
51
- put("value", "ended")
51
+ put("type", "ended")
52
52
  put("shouldResume", false)
53
53
  }
54
54
  audioAPIModule.get()?.invokeHandlerWithEventNameAndEventBody("interruption", body)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-audio-api",
3
- "version": "0.6.4",
3
+ "version": "0.6.5-rc.0",
4
4
  "description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
5
5
  "bin": {
6
6
  "setup-rn-audio-api-web": "./scripts/setup-rn-audio-api-web.js"