Unable to load remote video track in VideoRenderer, When onAddStream() invoked

2.1k Views Asked by At

I'm implementing webrtc in android. I could not load the remote video stream after setting the remoteDescription in peerConnection object. I'm getting the remote audio,video track , When onAddStream() involked(org.webrtc.VideoTrack@37471a54). But could not load that in Videorenderer.

@Override
        public void onAddStream(final MediaStream stream) {
            Log.d("checklog","onaddstream"+stream.audioTracks.get(0)+stream.videoTracks.get(0));
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    if (peerConnection == null ) {
                        return;
                    }
                    if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
                        Log.d("onAddstreamerror","Weird-looking stream: " + stream);
                        return;
                    }
                    if (stream.videoTracks.size() == 1) {
                        remoteVideoTrack = stream.videoTracks.get(0);
                        remoteVideoTrack.setEnabled(true);
                        remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
                    }
                }
            });
        }
0

There are 0 best solutions below