Wowza Community

By using go coder SDK not able to live stream GLSurfaceview for camera live stream

Hello, I have followed your GoCoder SDK Samples in which I have found Live Streaming with GLSurfaceView.

Now, I want to render Camera preview with GLSurfaceview and live to stream that camera preview. I am not able to live stream camera preview. Can you please help me on that how to stream my camera view.

Hello @parth shah, we do have this GitHub example on how to do this. Please let me know if this helps you or if you need more guidance. Thanks!

https://github.com/WowzaMediaSystems/gocoder-sdk-samples-android/search?q=GLSurfaceView&unscoped_q=GLSurfaceView

https://github.com/WowzaMediaSystems/gocoder-sdk-samples-android/blob/b6d6bed7afad05331791a89cab8767680cb98030/gocoder-sdk-sample-app/src/main/java/com/wowza/gocoder/sdk/sampleapp/graphics/OpenGLActivity.java

This shows you how to initialize the surface view:

 // Initialize the OpenGL ES surface view
        mGLSurfaceView = (GLSurfaceView)findViewById(R.id.gl_surface_view);
        mGLSurfaceView.setEGLContextClientVersion(2);

        mOpenGLRenderer = new OpenGLRenderer();
        mGLSurfaceView.setRenderer(mOpenGLRenderer);

hi, @Rose Power Thank you for your response. Yes, I am using this sample. It has one class called OpenGLRenderer but here I want to stream my camera preview by using GLSurfaceview. Here in the example, they have draw cubes and lights on the surface. But I need to show my camera preview. so can you help me with that? i want to stream my camera preview on GlSurfaceview, and after that, I will put objects using ARcore on that and draw some stuff on the surface and I want to stream all this.

mGLSurfaceView.setRenderer(this);

// onSurfacecreated I am using below code

if (mGLBroadcaster == null) {

mGLBroadcaster=new WOWZGLBroadcaster(EGL14.eglGetCurrentContext());

mGLBroadcaster.setVideoFrameRenderer(this);

configmSurfaceSize = new WOWZSize(width,height);

mGLBroadcaster.getVideoSourceConfig().setVideoFrameSize(mSurfaceSize);

} else {

mSurfaceSize.set(width, height);

if (!isStreaming()) streamingmGLBroadcaster.getVideoSourceConfig().setVideoFrameSize(mSurfaceSize)}

// onDrawFrame I am using below code @Rose Power

session.setCameraTextureName(backgroundRenderer.getTextureId());
Frame frame = session.update();Camera camera = frame.getCamera();

TrackingState cameraTrackingState = camera.getTrackingState();

backgroundRenderer.draw(frame);

camera.getProjectionMatrix(projectionMatrix, 0, 0.1f, 100.0f);

camera.getViewMatrix(viewMatrix, 0);

PointCloud pointCloud = frame.acquirePointCloud();

pointCloudRenderer.update(pointCloud);

pointCloudRenderer.draw(viewMatrix, projectionMatrix);

planeRenderer.drawPlanes(session.getAllTrackables(Plane.class), camera.getDisplayOrientedPose(), projectionMatrix);<br>

@Rose Power looks into the code, I am trying to render camera preview and draw on the frame. but it’s not able to live stream my camera preview.

when I am hitting RTSP URL on VLC media player it shows a black screen and not streaming my camera frame.

Did this work for you?

Hi, @Rose Power no I am not able to stream my camera preview with GLSufaceview by using this code. That’s why i need your help on this. can you provide any sample code where i can stream my camera preview with GLSurfaceview using go coder for stream.

Hello @parth shah, I checked with my team and we only have the GitHub sample I shared. But, what you can do is submit a support ticket and we can assign you to an engineer that may be able to troubleshoot the code with you. We can’t do that through the forum, but again through a ticket they can run some tests with you and provide suggestions.

You can do that here: