JW Player plugin problem

Hi,

I’m trying to build a plugin for a client using the JWPlayer Android SDK. I’ve got it to work, except there is one annoying problem: I have no video, only sound. I do have all the controls and when I press fullscreen I do have video.

The problem I think is that the Corona layer is in the way of the videolayer. When I use

CoronaEnvironment.getCoronaActivity().setContentView(jwplayerView);

In stead of

CoronaEnvironment.getCoronaActivity().getOverlayView().addView(jwplayerView);

It works fine, but this is not a valid solution.

Is there a solution to this, because I really need it to work with Corona, not in stead of :frowning:

Thanks,

Arthur

Can you provide a better description of what’s happening with each option?

Rob

Hi Rob,

Thanks for your reply!

When I use setContentView it replaces the CoronaGLSurface, so I only see the JW Player with video on a black background.

When I use addView I see the JW player skin on top of the CoronaGLSurface, but the video is not visible. I do hear the audio and I can press play/pause.

I did some more research, and when I remove the CoronaGLSurface when the video starts playing and re-add it to the root view on z-index 0 it works and I see the video. The only annoying problem is that the screen flickers when this is done :frowning:

Is there a less ‘hacky’ way of getting this to work?

thanks.

Basically, .setContentView() throws away Corona’s view (OpenGL and our native UI views). You probably should not be using it.

.GetOverlayView() is what you should be doing. This is a container for child views that can be overlaid on top of our OpenGL view. This is how Ad plugins work. It’s also how we do native.* objects so they draw on top. One of our engineers added:

"The only other ugly issue he has to deal with is that Google’s SurfaceView derived classes such as VideoView and OpenGLView have problems coexisting together at the same time.  This is an issue on Gogole’s end.  But it can be done.  I believe Google’s hacky solution to this is to call the SurfaceView.setZOrderMediaOverlay(true) to force it on top of our OpenGL view.

   https://developer.android.com/reference/android/view/SurfaceView.html#setZOrderMediaOverlay(boolean)"

You can also look at our ExtendingUI example included with CoronaEnterprise. It will show how to add native things to the CoronaActivity.  There are also some layout parameters that can be used with .addView().  See:

https://developer.android.com/reference/android/view/ViewGroup.html#addView(android.view.View)

https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

Rob

Hi Rob,

Thanks!

I used the .GetOverlayView() to add the player, but then I have the problem of the Google issue you’ve described. Because the JWPlayer options are limited, I don’t know how to access the correct surface to call setZOrderMediaOverlay on… still digging :slight_smile:

If I find a solution, I’ll share it here, because other than this problem, the JW player is a solid mediaplayer to use in an Enterprise app.

Arthur

Can you provide a better description of what’s happening with each option?

Rob

Hi Rob,

Thanks for your reply!

When I use setContentView it replaces the CoronaGLSurface, so I only see the JW Player with video on a black background.

When I use addView I see the JW player skin on top of the CoronaGLSurface, but the video is not visible. I do hear the audio and I can press play/pause.

I did some more research, and when I remove the CoronaGLSurface when the video starts playing and re-add it to the root view on z-index 0 it works and I see the video. The only annoying problem is that the screen flickers when this is done :frowning:

Is there a less ‘hacky’ way of getting this to work?

thanks.

Basically, .setContentView() throws away Corona’s view (OpenGL and our native UI views). You probably should not be using it.

.GetOverlayView() is what you should be doing. This is a container for child views that can be overlaid on top of our OpenGL view. This is how Ad plugins work. It’s also how we do native.* objects so they draw on top. One of our engineers added:

"The only other ugly issue he has to deal with is that Google’s SurfaceView derived classes such as VideoView and OpenGLView have problems coexisting together at the same time.  This is an issue on Gogole’s end.  But it can be done.  I believe Google’s hacky solution to this is to call the SurfaceView.setZOrderMediaOverlay(true) to force it on top of our OpenGL view.

   https://developer.android.com/reference/android/view/SurfaceView.html#setZOrderMediaOverlay(boolean)"

You can also look at our ExtendingUI example included with CoronaEnterprise. It will show how to add native things to the CoronaActivity.  There are also some layout parameters that can be used with .addView().  See:

https://developer.android.com/reference/android/view/ViewGroup.html#addView(android.view.View)

https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html

Rob

Hi Rob,

Thanks!

I used the .GetOverlayView() to add the player, but then I have the problem of the Google issue you’ve described. Because the JWPlayer options are limited, I don’t know how to access the correct surface to call setZOrderMediaOverlay on… still digging :slight_smile:

If I find a solution, I’ll share it here, because other than this problem, the JW player is a solid mediaplayer to use in an Enterprise app.

Arthur