|
@@ -70,6 +70,7 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ Log.d(TAG, "onCreate: ");
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_main);
|
|
|
requestPermission();
|
|
@@ -79,6 +80,7 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
+ Log.d(TAG, "initView: ");
|
|
|
mVideoLayout = findViewById(R.id.layout_video);
|
|
|
mInfoLayout = findViewById(R.id.layout_info);
|
|
|
mIconView = findViewById(R.id.iconIv);
|
|
@@ -101,6 +103,7 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
+ Log.d(TAG, "initData: ");
|
|
|
if (Macros.DEBUG) {
|
|
|
mVideoType = 1;
|
|
|
mVideoId = "3523b1d1-8543-43d9-92c9-df663a3f147d";
|
|
@@ -125,7 +128,6 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
|
|
|
@Override
|
|
|
public void onLoginCallback(boolean isOK) {
|
|
|
- Log.d(TAG, "onLoginCallback: " + isOK);
|
|
|
if (isOK) {
|
|
|
if (mVideoType == 1) { //呼出
|
|
|
mVideoManager.call(mVideoId);
|
|
@@ -135,18 +137,15 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
|
|
|
@Override
|
|
|
public void onCallItemAdd(JCCallItem item) {
|
|
|
- Log.d(TAG, "onCallItemAdd: ");
|
|
|
if (item.getDirection() == JCCall.DIRECTION_OUT && item.getVideo()) {
|
|
|
mAnswerBtn.setVisibility(View.GONE);
|
|
|
}
|
|
|
-
|
|
|
// 2. 做出相应的处理,如在界面上显示“振铃中”
|
|
|
mMediaPlayerUtils.playSound(this, R.raw.video_call, true);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onCallItemUpdate() {
|
|
|
- Log.d(TAG, "onCallItemUpdate: ");
|
|
|
List<JCCallItem> callItems = mVideoManager.mCall.getCallItems();
|
|
|
if (callItems.size() <= 0)
|
|
|
return;
|
|
@@ -166,10 +165,14 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
}
|
|
|
|
|
|
private void updateLayout_pending(JCCallItem item) {
|
|
|
+ boolean isL = mLocalCanvas == null;
|
|
|
+ boolean isU = item.getUploadVideoStreamSelf();
|
|
|
+ Log.d(TAG, "updateLayout_pending: " + " isL:" + isL + " isU:" + isU);
|
|
|
if (mLocalCanvas == null && item.getUploadVideoStreamSelf()) {
|
|
|
mLocalCanvas = mVideoManager.mMediaDevice.startCameraVideo(JCMediaDevice.RENDER_FULL_SCREEN);
|
|
|
startTimeoutTimer();
|
|
|
if (mLocalCanvas != null) {
|
|
|
+ Log.d(TAG, "updateLayout_pending: not null");
|
|
|
mLocalCanvas.getVideoView().setZOrderMediaOverlay(true);
|
|
|
mLocalCanvas.getVideoView().setId(View.generateViewId());
|
|
|
mVideoLayout.addView(mLocalCanvas.getVideoView(), 0);
|
|
@@ -214,9 +217,11 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
stopTimeoutTimer();
|
|
|
stopTalkingTimer();
|
|
|
mMediaPlayerUtils.playSound(this, R.raw.video_cancel, false);
|
|
|
+ Log.d(TAG, "onCallItemRemove: 1");
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
+ Log.d(TAG, "onCallItemRemove: finish");
|
|
|
finish();
|
|
|
}
|
|
|
}, 2000);
|
|
@@ -317,7 +322,10 @@ public class MainActivity extends Activity implements Listener.VideoListener {
|
|
|
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
+ Log.d(TAG, "onDestroy: ");
|
|
|
super.onDestroy();
|
|
|
removeCanvas();
|
|
|
+ mVideoManager = null;
|
|
|
+ mMediaPlayerUtils = null;
|
|
|
}
|
|
|
}
|