コード例 #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();
    }
  }
コード例 #2
0
 public void addConversationFragmentStartCall(
     List<QBUser> opponents,
     QBRTCTypes.QBConferenceType qbConferenceType,
     Map<String, String> userInfo) {
   QBRTCSession newSessionWithOpponents =
       rtcClient.createNewSessionWithOpponents(getOpponentsIds(opponents), qbConferenceType);
   SettingsUtil.setSettingsStrategy(opponents, getDefaultSharedPrefs(), this);
   Log.d("Crash", "addConversationFragmentStartCall. Set session " + newSessionWithOpponents);
   initCurrentSession(newSessionWithOpponents);
   ConversationFragment fragment =
       ConversationFragment.newInstance(
           opponents,
           opponents.get(0).getFullName(),
           qbConferenceType,
           userInfo,
           StartConversetionReason.OUTCOME_CALL_MADE,
           getCurrentSession().getSessionID());
   FragmentExecuotr.addFragment(
       getFragmentManager(), R.id.fragment_container, fragment, CONVERSATION_CALL_FRAGMENT);
   audioManager.init();
   ringtonePlayer.play(true);
 }
コード例 #3
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   QBRTCClient.getInstance().addVideoTrackCallbacksListener(this);
 }
コード例 #4
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   QBRTCClient.getInstance().removeVideoTrackCallbacksListener(this);
 }
コード例 #5
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);
              }
            });
  }