private void toggleCamera(boolean isNeedEnableCam) { // TODO temporary insertion will be removed when GLVideoView will be fixed DisplayMetrics displaymetrics = new DisplayMetrics(); displaymetrics.setToDefaults(); ViewGroup.LayoutParams layoutParams = imgMyCameraOff.getLayoutParams(); layoutParams.height = localVideoView.getHeight(); layoutParams.width = localVideoView.getWidth(); imgMyCameraOff.setLayoutParams(layoutParams); Log.d( TAG, "Width is: " + imgMyCameraOff.getLayoutParams().width + " height is:" + imgMyCameraOff.getLayoutParams().height); if (SessionManager.getCurrentSession() != null) { SessionManager.getCurrentSession().setVideoEnabled(isNeedEnableCam); cameraToggle.setChecked(isNeedEnableCam); if (isNeedEnableCam) { Log.d(TAG, "Camera is on"); switchCameraToggle.setVisibility(View.VISIBLE); imgMyCameraOff.setVisibility(View.INVISIBLE); } else { Log.d(TAG, "Camera is off"); switchCameraToggle.setVisibility(View.INVISIBLE); imgMyCameraOff.setVisibility(View.VISIBLE); } } }
@Override public void onLocalVideoTrackReceive(QBRTCSession qbrtcSession, QBRTCVideoTrack qbrtcVideoTrack) { Log.d(TAG, "localVideoView is " + localVideoView); if (localVideoView != null) { qbrtcVideoTrack.addRenderer( new VideoRenderer(new VideoCallBacks(localVideoView, QBGLVideoView.Endpoint.LOCAL))); localVideoView.setVideoTrack(qbrtcVideoTrack, QBGLVideoView.Endpoint.LOCAL); Log.d(TAG, "onLocalVideoTrackReceive() is rune"); } }
@Override public void onRemoteVideoTrackReceive( QBRTCSession qbrtcSession, QBRTCVideoTrack qbrtcVideoTrack, Integer integer) { Log.d(TAG, "remoteVideoView is " + remoteVideoView); if (remoteVideoView != null) { VideoRenderer remoteRenderer = new VideoRenderer(new VideoCallBacks(remoteVideoView, QBGLVideoView.Endpoint.REMOTE)); qbrtcVideoTrack.addRenderer(remoteRenderer); remoteVideoView.setVideoTrack(qbrtcVideoTrack, QBGLVideoView.Endpoint.REMOTE); Log.d(TAG, "onRemoteVideoTrackReceive() is rune"); } }
@Override protected void initViews(View view) { super.initViews(view); localVideoView = (QBGLVideoView) view.findViewById(R.id.localVideoVidew); localVideoView.setVisibility(View.VISIBLE); remoteVideoView = (QBGLVideoView) view.findViewById(R.id.remoteVideoView); remoteVideoView.setVisibility(View.VISIBLE); cameraToggle = (ToggleButton) view.findViewById(R.id.cameraToggle); cameraToggle.setVisibility(View.VISIBLE); cameraToggle.setOnClickListener(this); switchCameraToggle = (ToggleButton) view.findViewById(R.id.switchCameraToggle); switchCameraToggle.setVisibility(View.VISIBLE); switchCameraToggle.setOnClickListener(this); imgMyCameraOff = (ImageView) view.findViewById(R.id.imgMyCameraOff); actionButtonsEnabled(false); }