|
@@ -13,29 +13,22 @@ import android.view.SurfaceView;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.ImageButton;
|
|
|
-import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
-import com.juphoon.cloud.JCCall;
|
|
|
-import com.juphoon.cloud.JCCallItem;
|
|
|
-import com.juphoon.cloud.JCMediaDevice;
|
|
|
-import com.juphoon.cloud.JCMediaDeviceVideoCanvas;
|
|
|
import com.sikey.skvideo.R;
|
|
|
import com.sikey.skvideo.manager.AgoraManager;
|
|
|
import com.sikey.skvideo.manager.DataManager;
|
|
|
import com.sikey.skvideo.manager.DatabaseUtils;
|
|
|
import com.sikey.skvideo.manager.JuphoonManager;
|
|
|
import com.sikey.skvideo.manager.MediaPlayerUtils;
|
|
|
-import com.sikey.skvideo.manager.VideoManager;
|
|
|
import com.sikey.skvideo.model.ContactBean;
|
|
|
import com.sikey.skvideo.observer.Listener;
|
|
|
-import com.sikey.skvideo.utils.Constant;
|
|
|
+import com.sikey.skvideo.utils.SKConstant;
|
|
|
import com.sikey.skvideo.utils.Macros;
|
|
|
import com.sikey.skvideo.utils.ToolsUtils;
|
|
|
|
|
|
-import java.util.List;
|
|
|
import java.util.Timer;
|
|
|
import java.util.TimerTask;
|
|
|
|
|
@@ -68,8 +61,8 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
private int mHideCountMax = 5;
|
|
|
private int mHideCount = mHideCountMax;
|
|
|
|
|
|
- private int mVideoType = Constant.VIDEO_TYPE_AGORA; //juphoon, agora
|
|
|
- private int mCallType = Constant.VIDEO_CALL_OUT; //1:呼出 2:呼入
|
|
|
+ private int mVideoType = SKConstant.VIDEO_TYPE_AGORA; //juphoon, agora
|
|
|
+ private int mCallType = SKConstant.VIDEO_CALL_OUT; //1:呼出 2:呼入
|
|
|
private String mCallId = "";
|
|
|
private String mCallToken = "";
|
|
|
private String mCallChannelName = "";
|
|
@@ -96,21 +89,21 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
|
|
|
private boolean initData() {
|
|
|
if (Macros.DEBUG_AGORA) {
|
|
|
- mVideoType = Constant.VIDEO_TYPE_AGORA;
|
|
|
- mCallType = Constant.VIDEO_CALL_IN;
|
|
|
+ mVideoType = SKConstant.VIDEO_TYPE_AGORA;
|
|
|
+ mCallType = SKConstant.VIDEO_CALL_IN;
|
|
|
mCallId = "3523b1d1-8543-43d9-92c9-df663a3f147d";
|
|
|
mCallChannelName = "9ec704da-57c1-4193-9ec5-033a0932d8e5_TK_MyBgEgREgT_1745542422632";
|
|
|
mCallToken = "007eJxSYJC63d2/5OmXCRzm15IcMt509Ux7nq58LOJn5x3VjUdCF25WYLA0SjYxNrVIskyztDAxtEyzTDQ0SDE2MU01tUw0N08zFLvLlaFgysAQ9lCGmZGBkYGFgZEBxGcCk8xgkgVMOjBYpiabG5ikJOqamicb6poYWhrrWqYmm+oaGBsnGlgaG6VYpJrGh3jH+1Y6pbumB7mmh8QbmpuYmpoYmRgZmRkbMTIYAAIAAP//xB8wVA==";
|
|
|
} else {
|
|
|
- mVideoType = getIntent().getIntExtra(Constant.INTENT_VIDEO_TYPE, Constant.VIDEO_TYPE_AGORA);
|
|
|
- mCallType = getIntent().getIntExtra(Constant.INTENT_CALL_TYPE, Constant.VIDEO_CALL_OUT);
|
|
|
- mCallId = getIntent().getStringExtra(Constant.INTENT_CALL_ID);
|
|
|
- mCallToken = getIntent().getStringExtra(Constant.INTENT_CALL_TOKEN);
|
|
|
- mCallChannelName = getIntent().getStringExtra(Constant.INTENT_CALL_CHANNEL);
|
|
|
+ mVideoType = getIntent().getIntExtra(SKConstant.INTENT_VIDEO_TYPE, SKConstant.VIDEO_TYPE_AGORA);
|
|
|
+ mCallType = getIntent().getIntExtra(SKConstant.INTENT_CALL_TYPE, SKConstant.VIDEO_CALL_OUT);
|
|
|
+ mCallId = getIntent().getStringExtra(SKConstant.INTENT_CALL_ID);
|
|
|
+ mCallToken = getIntent().getStringExtra(SKConstant.INTENT_CALL_TOKEN);
|
|
|
+ mCallChannelName = getIntent().getStringExtra(SKConstant.INTENT_CALL_CHANNEL);
|
|
|
}
|
|
|
Log.d(TAG, "initData: VideoType:" + mVideoType + " CallType:" + mCallType + " CallId:" + mCallId + " CallToken:" + mCallToken);
|
|
|
boolean isIdOK = mCallId != null && mCallId.length() > 0;
|
|
|
- boolean isTokenOK = mVideoType != Constant.VIDEO_TYPE_AGORA || (mCallToken != null && mCallToken.length() > 0);
|
|
|
+ boolean isTokenOK = mVideoType != SKConstant.VIDEO_TYPE_AGORA || (mCallToken != null && mCallToken.length() > 0);
|
|
|
return isIdOK && isTokenOK;
|
|
|
}
|
|
|
|
|
@@ -208,14 +201,14 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
Log.d(TAG, "refreshInfo: ");
|
|
|
//ToolsUtils.setImageView(mIconView, mContactBean.profilePath, 0, R.drawable.default_avatar);
|
|
|
mNameText.setText(mContactBean.name);
|
|
|
- mHintText.setText(mCallType == Constant.VIDEO_CALL_OUT ? R.string.calling : R.string.invite);
|
|
|
+ mHintText.setText(mCallType == SKConstant.VIDEO_CALL_OUT ? R.string.calling : R.string.invite);
|
|
|
refreshView(mCallType);
|
|
|
}
|
|
|
|
|
|
private void initVideoManager() {
|
|
|
Log.d(TAG, "initVideoManager: ");
|
|
|
String userId = DataManager.getWatchTicket(this);
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mJuphoonManager.init(this, userId);
|
|
|
} else {
|
|
|
mAgoraManager.init(this, userId);
|
|
@@ -226,7 +219,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
public void onInitOK() {
|
|
|
Log.d(TAG, "onInitOK: ");
|
|
|
runOnUiThread(()-> {
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_AGORA) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_AGORA) {
|
|
|
mAgoraManager.initLocalCanvas(this, mVideoLayout, mVideoLayoutView);
|
|
|
mAgoraManager.initRemoteCanvas(this, mVideoLayout, mVideoLayoutRemoteView, 0);
|
|
|
}
|
|
@@ -237,15 +230,15 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
public void onLoginOK() {
|
|
|
Log.d(TAG, "onLoginOK: ");
|
|
|
runOnUiThread(()->{
|
|
|
- if (mCallType == Constant.VIDEO_CALL_OUT) {
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mCallType == SKConstant.VIDEO_CALL_OUT) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mJuphoonManager.call(mCallId);
|
|
|
} else {
|
|
|
onPendingBegin();
|
|
|
mAgoraManager.joinChannel(mCallToken, mCallChannelName);
|
|
|
}
|
|
|
} else {
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_AGORA) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_AGORA) {
|
|
|
onPendingBegin();
|
|
|
}
|
|
|
}
|
|
@@ -255,7 +248,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
private void videoAnswer() {
|
|
|
Log.d(TAG, "videoAnswer: ");
|
|
|
runOnUiThread(()->{
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mJuphoonManager.answer();
|
|
|
} else {
|
|
|
mAgoraManager.joinChannel(mCallToken, mCallChannelName);
|
|
@@ -274,7 +267,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
@Override
|
|
|
public void onPendingBegin() {
|
|
|
runOnUiThread(()->{
|
|
|
- if (mCallType == Constant.VIDEO_CALL_OUT) {
|
|
|
+ if (mCallType == SKConstant.VIDEO_CALL_OUT) {
|
|
|
refreshView(1);
|
|
|
} else {
|
|
|
refreshView( 2);
|
|
@@ -292,7 +285,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
public void onPendingLocalCanvas(SurfaceView view) {
|
|
|
Log.d(TAG, "onPendingLocalCanvas: ");
|
|
|
runOnUiThread(()->{
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mVideoLayout.addView(view, 0);
|
|
|
}
|
|
|
});
|
|
@@ -310,7 +303,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
public void onTalking(SurfaceView view, int uid) {
|
|
|
Log.d(TAG, "onTalking: ");
|
|
|
runOnUiThread(()->{
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mVideoLayout.addView(view, 0);
|
|
|
}
|
|
|
refreshView(10);
|
|
@@ -406,7 +399,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
|
|
|
private void onTimeoutTimerCallback() {
|
|
|
showToast(getString(R.string.timeout));
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mJuphoonManager.hangup();
|
|
|
} else {
|
|
|
mAgoraManager.hangup();
|
|
@@ -439,7 +432,7 @@ public class MainActivity extends BaseActionActivity implements Listener.VideoLi
|
|
|
}
|
|
|
|
|
|
private void videoEndStep1() {
|
|
|
- if (mVideoType == Constant.VIDEO_TYPE_JUPHOON) {
|
|
|
+ if (mVideoType == SKConstant.VIDEO_TYPE_JUPHOON) {
|
|
|
mJuphoonManager.clear();
|
|
|
mJuphoonManager = null;
|
|
|
} else {
|