bitmovin-player-react-native 0.36.0 → 0.38.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.
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
20
20
 
21
21
  s.swift_version = "5.10"
22
22
  s.dependency "React-Core"
23
- s.dependency "BitmovinPlayer", "3.81.0"
23
+ s.dependency "BitmovinPlayer", "3.85.0"
24
24
  s.ios.dependency "GoogleAds-IMA-iOS-SDK", "3.23.0"
25
25
  s.tvos.dependency "GoogleAds-IMA-tvOS-SDK", "4.13.0"
26
26
  end
@@ -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.98.0+jason'
109
- implementation 'com.bitmovin.player:player-media-session:3.98.0+jason'
108
+ implementation 'com.bitmovin.player:player:3.104.1+jason'
109
+ implementation 'com.bitmovin.player:player-media-session:3.104.1+jason'
110
110
  }
@@ -12,7 +12,7 @@ import com.facebook.react.bridge.*
12
12
 
13
13
  class MediaSessionPlaybackManager(val context: ReactApplicationContext) {
14
14
  private var serviceBinder: MediaSessionPlaybackService.ServiceBinder? = null
15
- private lateinit var playerId: NativeId
15
+ private var playerId: NativeId? = null
16
16
  val player: Player?
17
17
  get() = serviceBinder?.player
18
18
 
@@ -24,7 +24,9 @@ class MediaSessionPlaybackManager(val context: ReactApplicationContext) {
24
24
  }
25
25
 
26
26
  override fun onServiceDisconnected(name: ComponentName) {
27
- destroy(playerId)
27
+ playerId?.let {
28
+ destroy(it)
29
+ }
28
30
  }
29
31
  }
30
32
 
@@ -38,13 +40,16 @@ class MediaSessionPlaybackManager(val context: ReactApplicationContext) {
38
40
  }
39
41
 
40
42
  fun destroy(nativeId: NativeId) {
41
- if (nativeId != playerId) { return }
43
+ if (nativeId != playerId) {
44
+ return
45
+ }
42
46
  serviceBinder?.player = null
43
47
  serviceBinder = null
44
48
  }
45
49
 
46
50
  private fun getPlayer(
47
- nativeId: NativeId = playerId,
51
+ nativeId: NativeId? = playerId,
48
52
  playerModule: PlayerModule? = context.playerModule,
49
- ): Player = playerModule?.getPlayerOrNull(nativeId) ?: throw IllegalArgumentException("Invalid PlayerId $nativeId")
53
+ ): Player = nativeId?.let { playerModule?.getPlayerOrNull(nativeId) }
54
+ ?: throw IllegalArgumentException("Invalid PlayerId $nativeId")
50
55
  }
@@ -97,9 +97,7 @@ class PlayerModule(context: ReactApplicationContext) : BitmovinBaseModule(contex
97
97
  }
98
98
 
99
99
  if (enableMediaSession) {
100
- promise.unit.resolveOnUiThread {
101
- mediaSessionPlaybackManager.setupMediaSessionPlayback(nativeId)
102
- }
100
+ mediaSessionPlaybackManager.setupMediaSessionPlayback(nativeId)
103
101
  }
104
102
  }
105
103
 
@@ -5,6 +5,7 @@ import com.bitmovin.analytics.api.AnalyticsConfig
5
5
  import com.bitmovin.analytics.api.CustomData
6
6
  import com.bitmovin.analytics.api.DefaultMetadata
7
7
  import com.bitmovin.analytics.api.SourceMetadata
8
+ import com.bitmovin.player.api.BandwidthMeterType
8
9
  import com.bitmovin.player.api.DeviceDescription.DeviceName
9
10
  import com.bitmovin.player.api.ForceReuseVideoCodecReason
10
11
  import com.bitmovin.player.api.PlaybackConfig
@@ -184,7 +185,11 @@ private fun String.toForceReuseVideoCodecReason(): ForceReuseVideoCodecReason? =
184
185
  */
185
186
  fun ReadableMap.toTweaksConfig(): TweaksConfig = TweaksConfig().apply {
186
187
  withDouble("timeChangedInterval") { timeChangedInterval = it }
187
- withInt("bandwidthEstimateWeightLimit") { bandwidthEstimateWeightLimit = it }
188
+ withInt("bandwidthEstimateWeightLimit") {
189
+ bandwidthMeterType = BandwidthMeterType.Default(
190
+ bandwidthEstimateWeightLimit = it,
191
+ )
192
+ }
188
193
  withMap("devicesThatRequireSurfaceWorkaround") { devices ->
189
194
  val deviceNames = devices.withStringArray("deviceNames") {
190
195
  it.filterNotNull().map(::DeviceName)
@@ -28,11 +28,11 @@ extension NSError: JsonConvertible {
28
28
 
29
29
  extension DeficiencyData: JsonConvertible {
30
30
  func toJSON() -> [AnyHashable: Any] {
31
- var json: [AnyHashable: Any] = ["code": code, "message": message]
32
- if let underlyingError {
33
- json["underlyingError"] = underlyingError.toJSON()
34
- }
35
- return json
31
+ [
32
+ "code": code,
33
+ "message": message,
34
+ "underlyingError": underlyingError.toJSON()
35
+ ]
36
36
  }
37
37
  }
38
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitmovin-player-react-native",
3
- "version": "0.36.0",
3
+ "version": "0.38.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",