예제 #1
0
  private void logoutSession() {
    try {
      DataHolder.setLoggedUser(null);
      QBRTCClient.getInstance(this).destroy();

      // comment if you haven't started ping alarm
      ChatPingAlarmManager.onDestroy();
      QBChatService.getInstance().logout();
    } catch (SmackException.NotConnectedException e) {
      e.printStackTrace();
    }
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   QBRTCClient.getInstance().addVideoTrackCallbacksListener(this);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   QBRTCClient.getInstance().removeVideoTrackCallbacksListener(this);
 }
예제 #4
0
  private void initQBRTCClient() {
    rtcClient = QBRTCClient.getInstance(this);
    // Add signalling manager
    QBChatService.getInstance()
        .getVideoChatWebRTCSignalingManager()
        .addSignalingManagerListener(
            new QBVideoChatSignalingManagerListener() {
              @Override
              public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
                if (!createdLocally) {
                  rtcClient.addSignaling((QBWebRTCSignaling) qbSignaling);
                }
              }
            });

    rtcClient.setCameraErrorHendler(
        new VideoCapturerAndroid.CameraErrorHandler() {
          @Override
          public void onCameraError(final String s) {
            CallActivity.this.runOnUiThread(
                new Runnable() {
                  @Override
                  public void run() {
                    Toaster.longToast(s);
                  }
                });
          }
        });

    // Configure
    //
    QBRTCConfig.setMaxOpponentsCount(6);
    QBRTCConfig.setDisconnectTime(30);
    QBRTCConfig.setAnswerTimeInterval(30l);
    QBRTCConfig.setStatsReportInterval(60);
    QBRTCConfig.setDebugEnabled(true);

    // Add activity as callback to RTCClient
    rtcClient.addSessionCallbacksListener(this);
    // Start mange QBRTCSessions according to VideoCall parser's callbacks
    rtcClient.prepareToProcessCalls();

    QBChatService.getInstance()
        .addConnectionListener(
            new AbstractConnectionListener() {

              @Override
              public void connectionClosedOnError(Exception e) {
                showNotificationPopUp(R.string.connection_was_lost, true);
              }

              @Override
              public void reconnectionSuccessful() {
                showNotificationPopUp(R.string.connection_was_lost, false);
              }

              @Override
              public void reconnectingIn(int seconds) {
                Log.i(TAG, "reconnectingIn " + seconds);
              }
            });
  }