Skip to content

Commit

Permalink
Merge pull request #186 from bitmovin/PRN-26/180-video-not-playing-au…
Browse files Browse the repository at this point in the history
…dio-playing

Player sometimes plays sound but no video
  • Loading branch information
zigavehovec authored Aug 11, 2023
2 parents f5e45c2 + 0e733d3 commit 73839b9
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ private val EVENT_CLASS_TO_REACT_NATIVE_NAME_MAPPING_UI = mapOf<KClass<out Event
@SuppressLint("ViewConstructor")
class RNPlayerView(val context: ReactApplicationContext) : LinearLayout(context),
LifecycleEventListener, View.OnLayoutChangeListener, RNPictureInPictureDelegate {

init {
// React Native has a bug that dynamically added views sometimes aren't laid out again properly.
// Since we dynamically add and remove SurfaceView under the hood this caused the player
// to suddenly not show the video anymore because SurfaceView was not laid out properly.
// Bitmovin player issue: https://github.com/bitmovin/bitmovin-player-react-native/issues/180
// React Native layout issue: https://github.com/facebook/react-native/issues/17968
getViewTreeObserver().addOnGlobalLayoutListener { requestLayout() }
}

/**
* Relays the provided set of events, emitted by the player, together with the associated name
* to the `eventOutput` callback.
Expand Down

0 comments on commit 73839b9

Please sign in to comment.