Android native webrtc: add video after already connected -
i have been running webrtc in android app while, using libjingle.so , peerconnectionclient.java, etc., google's code library. however, running problem user starts connection audio (i.e., audio call), toggles video on. augmented existing setvideoenabled() in peerconnectionclient such:
public void setvideoenabled(final boolean enable) { executor.execute(new runnable() { @override public void run() { rendervideo = enable; if (localvideotrack != null) { localvideotrack.setenabled(rendervideo); } else { if (rendervideo) { //ac: create video track string cameradevicename = videocapturerandroid.getdevicename(0); string frontcameradevicename = videocapturerandroid.getnameoffrontfacingdevice(); if (numberofcameras > 1 && frontcameradevicename != null) { cameradevicename = frontcameradevicename; } log.i(tag, "opening camera: " + cameradevicename); videocapturer = videocapturerandroid.create(cameradevicename); if (createvideotrack(videocapturer) != null) { mediastream.addtrack(localvideotrack); localvideotrack.setenabled(rendervideo); peerconnection.addstream(mediastream); } else { log.d(tag, "local video track still null"); } } else { log.d(tag, "local video track null"); } } if (remotevideotrack != null) { remotevideotrack.setenabled(rendervideo); } else { log.d(tag,"remote video track null"); } } });
}
this allows me see local inset of device's video camera, doesn't send video remove client. thought peerconnection.addstream() call that, perhaps missing else?
to avoid building external mechanism of communication between peers involve answer second peer new stream can added, can start existing (but empty) video stream. matter of filling stream content when (and if) necessary.
Comments
Post a Comment