@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mLocalLayout = (PercentFrameLayout) findViewById(R.id.local_view_layout); mRemoteLayout = (PercentFrameLayout) findViewById(R.id.remote_video_layout); mLocalRender = (MySurfaceViewRenderer) findViewById(R.id.local_video_view); mLocalRender.setType(MySurfaceViewRenderer.TYPE_LOCAL); mRemoteRender = (MySurfaceViewRenderer) findViewById(R.id.remote_video_view); mRemoteRender.setType(MySurfaceViewRenderer.TYPE_REMOTE); EglBase eglBase = EglBase.create(); mRemoteRender.init(eglBase.getEglBaseContext(), null); mLocalRender.init(eglBase.getEglBaseContext(), null); mLocalRender.setZOrderMediaOverlay(true); WebRtcAudioTrack.setAudioTrackModuleFactory(null); Intent intent = getIntent(); if (intent != null) { long prevTimeStamp = ((WebRTCApplication) getApplication()).getCallTimeStamp(); long callTimeStamp = intent.getLongExtra(EXTRA_CALL_TIMESTAMP, 0); if (prevTimeStamp == callTimeStamp) { createWebRTCErrorDialog(); return; } ((WebRTCApplication) getApplication()).setCallTimeStamp(callTimeStamp); PeerConfig config = intent.getParcelableExtra(EXTRA_CONFIG); String videoUri = intent.getStringExtra(EXTRA_VIDEO_URI); String audioUri = intent.getStringExtra(EXTRA_AUDIO_URI); String addressId = intent.getStringExtra(EXTRA_ADDRESS_ID); boolean offer = intent.getBooleanExtra(EXTRA_OFFER, false); String audioSampleRate = intent.getStringExtra(EXTRA_AUDIOSAMPLERATE); int audioSampleRateValue; if (audioSampleRate == null) { audioSampleRateValue = WebRTCVideoChatProfile.PARAM_RATE_48000; } else { audioSampleRateValue = Integer.valueOf(audioSampleRate); } String audioBitDepth = intent.getStringExtra(EXTRA_AUDIOBITDEPTH); String audioChannel = intent.getStringExtra(EXTRA_AUDIOCHANNEL); WebRTCController.Builder builder = new WebRTCController.Builder(); builder.setApplication((WebRTCApplication) getApplication()); builder.setWebRTCEventListener(mListener); builder.setContext(this); builder.setEglBase(eglBase); builder.setConfig(config); builder.setRemoteRender(mRemoteRender); builder.setLocalRender(mLocalRender); builder.setVideoUri(videoUri); builder.setAudioUri(audioUri); builder.setAddressId(addressId); builder.setOffer(offer); builder.setAudioSampleRate(audioSampleRateValue); builder.setAudioBitDepth(audioBitDepth); builder.setAudioChannel(audioChannel); builder.setLandscape(isLandscape()); mWebRTCController = builder.create(); updateVideoView(videoUri); } else { openWebRTCErrorDialog(); } }