react-native-tpstreams 1.1.5 → 1.1.7
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.
|
@@ -13,6 +13,7 @@ import androidx.media3.common.Player
|
|
|
13
13
|
import androidx.media3.common.PlaybackParameters
|
|
14
14
|
import androidx.media3.common.PlaybackException
|
|
15
15
|
import android.media.MediaCodec
|
|
16
|
+
import android.view.View.MeasureSpec
|
|
16
17
|
|
|
17
18
|
class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context) {
|
|
18
19
|
private val playerView: TPStreamsPlayerView = TPStreamsPlayerView(context)
|
|
@@ -35,11 +36,27 @@ class TPStreamsRNPlayerView(context: ThemedReactContext) : FrameLayout(context)
|
|
|
35
36
|
private var downloadMetadata: Map<String, Any>? = null
|
|
36
37
|
private var offlineLicenseExpireTime: Long = DEFAULT_OFFLINE_LICENSE_EXPIRE_TIME
|
|
37
38
|
private var accessTokenCallback: ((String) -> Unit)? = null
|
|
39
|
+
private var isLayoutUpdatePosted = false
|
|
38
40
|
|
|
39
41
|
init {
|
|
40
42
|
addView(playerView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
override fun requestLayout() {
|
|
46
|
+
super.requestLayout()
|
|
47
|
+
if (!isLayoutUpdatePosted) {
|
|
48
|
+
isLayoutUpdatePosted = true
|
|
49
|
+
post {
|
|
50
|
+
isLayoutUpdatePosted = false
|
|
51
|
+
measure(
|
|
52
|
+
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
|
53
|
+
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
|
54
|
+
)
|
|
55
|
+
layout(left, top, right, bottom)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
43
60
|
// Emit React Native events
|
|
44
61
|
private fun emitEvent(eventName: String, data: Map<String, Any>) {
|
|
45
62
|
val event = Arguments.createMap()
|