openvidu-android: same code as in openvidu.io-docs snippets
This commit is contained in:
parent
7f313bc86b
commit
eb1629882e
@ -43,20 +43,22 @@ public class LocalParticipant extends Participant {
|
||||
final EglBase.Context eglBaseContext = EglBase.create().getEglBaseContext();
|
||||
PeerConnectionFactory peerConnectionFactory = this.session.getPeerConnectionFactory();
|
||||
|
||||
// create AudioSource
|
||||
// Create AudioSource
|
||||
AudioSource audioSource = peerConnectionFactory.createAudioSource(new MediaConstraints());
|
||||
this.audioTrack = peerConnectionFactory.createAudioTrack("101", audioSource);
|
||||
|
||||
surfaceTextureHelper = SurfaceTextureHelper.create("CaptureThread", eglBaseContext);
|
||||
// create VideoCapturer
|
||||
|
||||
// Create VideoCapturer
|
||||
VideoCapturer videoCapturer = createCameraCapturer();
|
||||
VideoSource videoSource = peerConnectionFactory.createVideoSource(videoCapturer.isScreencast());
|
||||
videoCapturer.initialize(surfaceTextureHelper, context, videoSource.getCapturerObserver());
|
||||
videoCapturer.startCapture(480, 640, 30);
|
||||
|
||||
// create VideoTrack
|
||||
// Create VideoTrack
|
||||
this.videoTrack = peerConnectionFactory.createVideoTrack("100", videoSource);
|
||||
// display in localView
|
||||
|
||||
// Display in localView
|
||||
this.videoTrack.addSink(localVideoView);
|
||||
}
|
||||
|
||||
|
||||
@ -54,12 +54,14 @@ public class Session {
|
||||
this.views_container = views_container;
|
||||
this.activity = activity;
|
||||
|
||||
// Creating a new PeerConnectionFactory instance
|
||||
PeerConnectionFactory.InitializationOptions.Builder optionsBuilder = PeerConnectionFactory.InitializationOptions.builder(activity.getApplicationContext());
|
||||
optionsBuilder.setEnableInternalTracer(true);
|
||||
PeerConnectionFactory.InitializationOptions opt = optionsBuilder.createInitializationOptions();
|
||||
PeerConnectionFactory.initialize(opt);
|
||||
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
|
||||
|
||||
// Using software encoder and decoder
|
||||
final VideoEncoderFactory encoderFactory;
|
||||
final VideoDecoderFactory decoderFactory;
|
||||
encoderFactory = new SoftwareVideoEncoderFactory();
|
||||
|
||||
@ -673,10 +673,16 @@ public class CustomWebSocket extends AsyncTask<SessionActivity, Void, Void> impl
|
||||
protected Void doInBackground(SessionActivity... sessionActivities) {
|
||||
try {
|
||||
WebSocketFactory factory = new WebSocketFactory();
|
||||
|
||||
//Returns a SSLContext object that implements the specified secure socket protocol
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null, trustManagers, new java.security.SecureRandom());
|
||||
factory.setSSLContext(sslContext);
|
||||
|
||||
// Set the flag which indicates whether the hostname in the server's certificate should be verified or not.
|
||||
factory.setVerifyHostname(false);
|
||||
|
||||
// Connecting the websocket to OpenVidu URL
|
||||
websocket = factory.createSocket(getWebSocketAddress());
|
||||
websocket.addListener(this);
|
||||
websocket.connect();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user