bitmovin-player-react-native 0.7.1 → 0.7.2
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.
|
@@ -2,6 +2,7 @@ package com.bitmovin.player.reactnative
|
|
|
2
2
|
|
|
3
3
|
import android.os.Handler
|
|
4
4
|
import android.os.Looper
|
|
5
|
+
import android.util.Log
|
|
5
6
|
import android.view.ViewGroup.LayoutParams
|
|
6
7
|
import com.bitmovin.player.PlayerView
|
|
7
8
|
import com.bitmovin.player.reactnative.extensions.getBooleanOrNull
|
|
@@ -200,7 +201,13 @@ class RNPlayerViewManager(private val context: ReactApplicationContext) : Simple
|
|
|
200
201
|
if (view.playerView != null) {
|
|
201
202
|
view.player = player
|
|
202
203
|
} else {
|
|
203
|
-
|
|
204
|
+
// PlayerView has to be initialized with Activity context
|
|
205
|
+
val currentActivity = context.currentActivity
|
|
206
|
+
if (currentActivity == null) {
|
|
207
|
+
Log.e(MODULE_NAME, "Cannot create a PlayerView, because no activity is attached.")
|
|
208
|
+
return@post
|
|
209
|
+
}
|
|
210
|
+
val playerView = PlayerView(currentActivity, player)
|
|
204
211
|
playerView.layoutParams = LayoutParams(
|
|
205
212
|
LayoutParams.MATCH_PARENT,
|
|
206
213
|
LayoutParams.MATCH_PARENT
|