@Override public void onPause() { Log.d(TAG, "onPause()"); // If camera state is CameraState.ENABLED_FROM_USER or CameraState.NONE // than we turn off cam if (cameraState != CameraState.DISABLED_FROM_USER) { toggleCamera(false); } super.onPause(); }
@Override public void onResume() { Log.d(TAG, "onResume()"); super.onResume(); // If user changed camera state few times and last state was CameraState.ENABLED_FROM_USER // than we turn on cam, else we nothing change if (cameraState != CameraState.DISABLED_FROM_USER && qbConferenceType == QBRTCTypes.QBConferenceType.QB_CONFERENCE_TYPE_VIDEO) { toggleCamera(true); } }
@Override public void actionButtonsEnabled(boolean enability) { super.actionButtonsEnabled(enability); cameraToggle.setEnabled(enability); switchCameraToggle.setEnabled(enability); imgMyCameraOff.setEnabled(enability); // inactivate toggle buttons cameraToggle.setActivated(enability); switchCameraToggle.setActivated(enability); imgMyCameraOff.setActivated(enability); }
@Override public void onClick(View v) { super.onClick(v); if (v.getId() == R.id.switchCameraToggle) { if (SessionManager.getCurrentSession() != null) { SessionManager.getCurrentSession() .switchCapturePosition( new Runnable() { @Override public void run() {} }); } } else if (v.getId() == R.id.switchCameraToggle) { if (SessionManager.getCurrentSession() != null) { if (cameraState != CameraState.DISABLED_FROM_USER) { toggleCamera(false); cameraState = CameraState.DISABLED_FROM_USER; } else { toggleCamera(true); cameraState = CameraState.ENABLED_FROM_USER; } } } // switch (v.getId()) { // case R.id.switchCameraToggle: // if (SessionManager.getCurrentSession() != null) { // SessionManager.getCurrentSession().switchCapturePosition(new Runnable() { // @Override // public void run() { // } // }); // } // break; // case R.id.cameraToggle: // if (SessionManager.getCurrentSession() != null) { // if (cameraState != CameraState.DISABLED_FROM_USER) { // toggleCamera(false); // cameraState = CameraState.DISABLED_FROM_USER; // } else { // toggleCamera(true); // cameraState = CameraState.ENABLED_FROM_USER; // } // } // break; // default: // break; // } }
@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); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); QBRTCClient.getInstance().addVideoTrackCallbacksListener(this); }
@Override public void onDestroy() { super.onDestroy(); QBRTCClient.getInstance().removeVideoTrackCallbacksListener(this); }