I am implementing webrtc in an Android project, and I'm based on this example on github .
This example uses the libjingle library. This creates a video rendering view:
// Create video renderers. VideoRendererGui.setView((GLSurfaceView)videoView, new Runnable() { @Override public void run() { createPeerConnectionFactory(); } }); remoteRender = VideoRendererGui.create( REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIGHT, scalingType, false); localRender = VideoRendererGui.create( LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING, scalingType, true);
My question is how can I configure remoteRender and localRender so that I can change its position in GLSurfaceView and its width and height
EDIT:
I made a listener and I tried this:
@Override public void onWidthHeightChange(int width, int height) { VideoRendererGui.update(remoteRender, REMOTE_X-width, REMOTE_X-height, REMOTE_WIDTH-width, REMOTE_HEIGHT-height, scalingType, false); if (iceConnected) { VideoRendererGui.update(localRender, LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED, LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED, ScalingType.SCALE_ASPECT_FIT, true); } else { VideoRendererGui.update(localRender, LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING, LOCAL_HEIGHT_CONNECTING, scalingType, true); } }
When I give a value of 150 both in width and in height, it gives me this error:
08-21 14:34:01.621 7636-7636/org.appspot.apprtc E/AppRTCDemoActivity๏น Fatal error: glUseProgram: GLES20 error: 1281 java.lang.RuntimeException: glUseProgram: GLES20 error: 1281 at org.webrtc.GlUtil.checkNoGLES2Error(GlUtil.java:48) at org.webrtc.GlShader.useProgram(GlShader.java:123) at org.webrtc.GlRectDrawer.drawOes(GlRectDrawer.java:132) at org.webrtc.VideoRendererGui$YuvImageRenderer.draw(VideoRendererGui.java:371) at org.webrtc.VideoRendererGui$YuvImageRenderer.access$800(VideoRendererGui.java:131) at org.webrtc.VideoRendererGui.onDrawFrame(VideoRendererGui.java:722) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
EDIT 2 with solution:
When I looked at the answer of mattm , I realized that he was right.
While I was looking for my exception, I found that this exception was selected from the libjingle library. I found this VideoRendererGui.java code snippet here on line 368, 347. I found a solution for my questions.
When adding the height and width of the view, it should be inside these ranges based on this code:
public static YuvImageRenderer create( int x, int y, int width, int height) {
So as long as I follow these rules, calling the VideoRendererGui.update(... method will work fine
thanks