3

I've written a native UI component for Android that basically consists of a custom view (RelativeLayout) which in turn contains JWPlayer. The component as well as the player itself are both rendered properly in my RN project (dimensions, colors, etc have the correct values) but when I start the playback I get sound without any image.

However, when I rotate the phone I get video image as well and everything seems to be working fine. I tried things like invalidate() and requestLayout() in my Android project but nothing changed. I also tried calling render() again in the RN component (by updating its state) that contains the native component and still no luck. I created a native Android project with an Activity that contains the exact same custom RelativeLayout that I wrote and everything works fine. So the problem seems to be on the side of the React Native project.

Since everything works fine after rotating the phone, there must be some lifecycle method that re-renders/re-layouts the RN component.

So my question is: Is there such a method?

Thanks very much in advance.

PS. JWPlayer is based on ExoPlayer.

Georgios
  • 4,764
  • 35
  • 48

1 Answers1

6

I found that the actual problem is not the playback but how my custom view is rendered. I add the answer here in case someone runs into the same issue but cannot find the problem's real source. This solution solved my problem.

Community
  • 1
  • 1
Georgios
  • 4,764
  • 35
  • 48