bitmovin-player-react-native 0.31.0 → 0.32.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.
@@ -105,6 +105,6 @@ dependencies {
105
105
  // Bitmovin
106
106
  implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.33.0'
107
107
  implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
108
- implementation 'com.bitmovin.player:player:3.91.0+jason'
109
- implementation 'com.bitmovin.player:player-media-session:3.91.0+jason'
108
+ implementation 'com.bitmovin.player:player:3.92.0+jason'
109
+ implementation 'com.bitmovin.player:player-media-session:3.92.0+jason'
110
110
  }
@@ -1,5 +1,6 @@
1
1
  package com.bitmovin.player.reactnative
2
2
 
3
+ import android.util.Log
3
4
  import androidx.concurrent.futures.CallbackToFutureAdapter
4
5
  import androidx.concurrent.futures.CallbackToFutureAdapter.Completer
5
6
  import com.bitmovin.player.api.network.HttpRequest
@@ -14,6 +15,7 @@ import com.bitmovin.player.reactnative.converter.toJson
14
15
  import com.bitmovin.player.reactnative.converter.toNetworkConfig
15
16
  import com.facebook.react.bridge.*
16
17
  import com.facebook.react.module.annotations.ReactModule
18
+ import java.util.concurrent.ConcurrentHashMap
17
19
  import java.util.concurrent.Future
18
20
 
19
21
  private const val MODULE_NAME = "NetworkModule"
@@ -25,8 +27,9 @@ class NetworkModule(context: ReactApplicationContext) : BitmovinBaseModule(conte
25
27
  * In-memory mapping from `nativeId`s to `NetworkConfig` instances.
26
28
  */
27
29
  private val networkConfigs: Registry<NetworkConfig> = mutableMapOf()
28
- private val preprocessHttpRequestCompleters: MutableMap<String, Completer<HttpRequest>> = mutableMapOf()
29
- private val preprocessHttpResponseCompleters: MutableMap<String, Completer<HttpResponse>> = mutableMapOf()
30
+ private val preprocessHttpRequestCompleters = ConcurrentHashMap<String, Completer<HttpRequest>>()
31
+ private val preprocessHttpResponseCompleters = ConcurrentHashMap<String, Completer<HttpResponse>>()
32
+
30
33
  override fun getName() = MODULE_NAME
31
34
 
32
35
  fun getConfig(nativeId: NativeId?): NetworkConfig? = nativeId?.let { networkConfigs[it] }
@@ -94,9 +97,14 @@ class NetworkModule(context: ReactApplicationContext) : BitmovinBaseModule(conte
94
97
 
95
98
  @ReactMethod
96
99
  fun setPreprocessedHttpRequest(requestId: String, request: ReadableMap) {
97
- preprocessHttpRequestCompleters[requestId]?.set(request.toHttpRequest())
98
- preprocessHttpRequestCompleters.remove(requestId)
100
+ val completer = preprocessHttpRequestCompleters.remove(requestId)
101
+ if (completer == null) {
102
+ Log.e(MODULE_NAME, "Completer is null for requestId: $requestId, this can cause stuck network requests")
103
+ return
104
+ }
105
+ completer.set(request.toHttpRequest())
99
106
  }
107
+
100
108
  private fun preprocessHttpResponseFromJS(
101
109
  nativeId: NativeId,
102
110
  type: HttpRequestType,
@@ -248,7 +248,7 @@ class RNPlayerViewManager(private val context: ReactApplicationContext) : Simple
248
248
  val playbackConfig = playerConfig?.getMap("playbackConfig")
249
249
  val isPictureInPictureEnabled = view.config?.pictureInPictureConfig?.isEnabled == true ||
250
250
  playbackConfig?.getBooleanOrNull("isPictureInPictureEnabled") == true
251
- view.enableBackgroundPlayback = playbackConfig?.getBoolean("isBackgroundPlaybackEnabled") ?: false
251
+ view.enableBackgroundPlayback = playbackConfig?.getBooleanOrNull("isBackgroundPlaybackEnabled") == true
252
252
 
253
253
  val rnStyleConfigWrapper = playerConfig?.toRNStyleConfigWrapperFromPlayerConfig()
254
254
  val configuredPlayerViewConfig = view.config?.playerViewConfig ?: PlayerViewConfig()
@@ -4,6 +4,7 @@ import android.content.Intent
4
4
  import android.os.Binder
5
5
  import android.os.IBinder
6
6
  import com.bitmovin.player.api.Player
7
+ import com.bitmovin.player.api.media.session.ControllerInfo
7
8
  import com.bitmovin.player.api.media.session.MediaSession
8
9
  import com.bitmovin.player.api.media.session.MediaSessionService
9
10
 
@@ -29,7 +30,7 @@ class MediaSessionPlaybackService : MediaSessionService() {
29
30
  private val binder = ServiceBinder()
30
31
  private var mediaSession: MediaSession? = null
31
32
 
32
- override fun onGetSession(): MediaSession? = null
33
+ override fun onGetSession(controllerInfo: ControllerInfo) = null
33
34
 
34
35
  override fun onDestroy() {
35
36
  disconnectSession()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitmovin-player-react-native",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Official React Native bindings for Bitmovin's mobile Player SDKs.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",