示例#1
0
  private void initViews() {
    final HospitalappApplication app = (HospitalappApplication) getApplication();
    videoChatConfig = getIntent().getParcelableExtra(VideoChatConfig.class.getCanonicalName());
    SoundPoolMusic.startMusic(getApplicationContext());
    show_audio_main_btn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO 自动生成的方法存根
            SoundPoolMusic.stopMusic();
            try {

              QBVideoChatController.getInstance().finishVideoChat(videoChatConfig);
              Intent intent = new Intent(AudioChatActivity.this, ConversationActivity.class);
              startActivity(intent);
              finish();
            } catch (Exception e) {
              // TODO: handle exception
              finish();
            }
          }
        });
    try {
      QBVideoChatController.getInstance()
          .setQBVideoChatListener(app.getCurrentUser(), qbVideoChatListener);
    } catch (XMPPException e) {
      // TODO 自动生成的 catch 块
      e.printStackTrace();
    }
  }
示例#2
0
        @Override
        public void onVideoChatStateChange(
            CallState callState, VideoChatConfig receivedVideoChatConfig) {
          videoChatConfig = receivedVideoChatConfig;

          switch (callState) {
            case ON_CALL_START:
              // Toast.makeText(getBaseContext(), "ON_CALL_START",
              // Toast.LENGTH_SHORT).show();
              break;
            case ON_CANCELED_CALL:
              // Toast.makeText(getBaseContext(), "ON_CANCELED_CALL",
              // Toast.LENGTH_SHORT).show();
              videoChatConfig = null;
              if (alertDialog != null && alertDialog.isShowing()) {
                alertDialog.dismiss();
              }
              SoundPoolMusic.stopMusic();
              autoCancelHandler.removeCallbacks(autoCancelTask);

              break;
            case ON_CALL_END:
              Toast.makeText(getBaseContext(), "通话结束", Toast.LENGTH_SHORT).show();
              SoundPoolMusic.stopMusic();
              Intent intent = new Intent(AudioChatActivity.this, ConversationActivity.class);
              startActivity(intent);
              finish();
              // clear opponent view
              break;
            case ACCEPT:
              // Toast.makeText(getBaseContext(), "ACCEPT",
              // Toast.LENGTH_SHORT)
              // .show();
              // showIncomingCallDialog();
              break;
            case ON_ACCEPT_BY_USER:
              Toast.makeText(getBaseContext(), "对方已接受,载入中...", Toast.LENGTH_SHORT).show();
              SoundPoolMusic.stopMusic();
              QBVideoChatController.getInstance().onAcceptFriendCall(videoChatConfig, null);
              break;
            case ON_REJECTED_BY_USER:
              Toast.makeText(getBaseContext(), "对方拒接", Toast.LENGTH_SHORT).show();
              SoundPoolMusic.stopMusic();
              Intent intent2 = new Intent(AudioChatActivity.this, ConversationActivity.class);
              startActivity(intent2);
              finish();

              break;
            case ON_CONNECTED:
              // Toast.makeText(getBaseContext(), "ON_CONNECTED",
              // Toast.LENGTH_SHORT).show();
              break;
            case ON_START_CONNECTING:
              // Toast.makeText(getBaseContext(), "ON_START_CONNECTING",
              // Toast.LENGTH_SHORT).show();
              break;
          }
        }
示例#3
0
  @Override
  protected void onStop() {
    // TODO 自动生成的方法存根
    try {

      QBVideoChatController.getInstance().finishVideoChat(videoChatConfig);
      SoundPoolMusic.stopMusic();
    } catch (Exception e) {
      // TODO: handle exception
    }
    super.onStop();
  }
示例#4
0
 @Override
 public void onOpponentAudioDataReceive(byte[] audioData) {
   QBVideoChatController.getInstance().playAudio(audioData);
 }
示例#5
0
 @Override
 public void onMicrophoneDataReceive(byte[] audioData) {
   QBVideoChatController.getInstance().sendAudio(audioData);
 }