Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
0e366aa8
Commit
0e366aa8
authored
Apr 18, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat : 收到邀请跳转接听界面,未加入中转界面
parent
f63843d3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
48 deletions
+89
-48
AndroidManifest.xml
ydl-tuicalling/src/main/AndroidManifest.xml
+5
-1
TUICallingImpl.java
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/TUICallingImpl.java
+30
-13
TRTCCalling.java
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/model/TRTCCalling.java
+54
-34
No files found.
ydl-tuicalling/src/main/AndroidManifest.xml
View file @
0e366aa8
...
...
@@ -31,7 +31,11 @@
android:enabled=
"true"
android:exported=
"false"
/>
<activity
android:name=
"com.tencent.liteav.videocall.VideoCallingActivity"
/>
<activity
android:name=
"com.tencent.liteav.videocall.VideoCallingActivity"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.AppCompat.NoActionBar"
/>
</application>
...
...
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/TUICallingImpl.java
View file @
0e366aa8
...
...
@@ -9,6 +9,8 @@ import android.text.TextUtils;
import
android.util.Log
;
import
com.blankj.utilcode.util.ToastUtils
;
import
com.tencent.liteav.basic.UserModel
;
import
com.tencent.liteav.basic.UserModelManager
;
import
com.tencent.liteav.trtccalling.model.TRTCCalling
;
import
com.tencent.liteav.trtccalling.model.TRTCCallingDelegate
;
import
com.tencent.liteav.trtccalling.model.impl.TRTCCallingCallback
;
...
...
@@ -22,6 +24,8 @@ import com.tencent.liteav.trtccalling.ui.base.Status;
import
com.tencent.liteav.trtccalling.ui.service.TUICallService
;
import
com.tencent.liteav.trtccalling.ui.videocall.TUICallVideoView
;
import
com.tencent.liteav.trtccalling.ui.videocall.TUIGroupCallVideoView
;
import
com.tencent.liteav.videocall.Constant
;
import
com.tencent.liteav.videocall.VideoCallingActivity
;
import
com.tencent.trtc.TRTCCloudDef
;
import
java.util.ArrayList
;
...
...
@@ -114,7 +118,13 @@ public final class TUICallingImpl implements TUICalling, TRTCCallingDelegate {
}
@Override
public
void
internalCall
(
final
String
[]
userIDs
,
final
String
sponsorID
,
final
String
groupID
)
{
internalCall
(
userIDs
,
sponsorID
,
groupID
,
true
,
Type
.
VIDEO
,
Role
.
CALLED
);
// internalCall(userIDs,sponsorID,groupID,true,Type.VIDEO,Role.CALLED);
final
UserModel
userModel
=
UserModelManager
.
getInstance
().
getUserModel
();
// Intent intent = new Intent(mContext, VideoCallingActivity.class);
// intent.putExtra(Constant.ROOM_ID, groupID);
// intent.putExtra(Constant.USER_ID, userModel.userId);
// mContext.startActivity(intent);
}
void
internalCall
(
final
String
[]
userIDs
,
final
String
sponsorID
,
final
String
groupID
,
final
boolean
isFromGroup
,
final
Type
type
,
final
Role
role
)
{
...
...
@@ -164,18 +174,25 @@ public final class TUICallingImpl implements TUICalling, TRTCCallingDelegate {
Runnable
task
=
new
Runnable
()
{
@Override
public
void
run
()
{
Intent
intent
=
new
Intent
(
mContext
,
BaseCallActivity
.
class
);
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_TYPE
,
type
);
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_ROLE
,
role
);
if
(
Role
.
CALLED
==
role
)
{
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_SPONSORID
,
sponsorID
);
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_ISFROMGROUP
,
isFromGroup
);
}
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_USERIDS
,
userIDs
);
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_GROUPID
,
groupID
);
intent
.
putExtra
(
TUICallingConstants
.
PARAM_NAME_FLOATWINDOW
,
mEnableFloatWindow
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
mContext
.
startActivity
(
intent
);
final
UserModel
userModel
=
UserModelManager
.
getInstance
().
getUserModel
();
// Intent intent = new Intent(mContext, VideoCallingActivity.class);
// intent.putExtra(Constant.ROOM_ID, groupID);
// intent.putExtra(Constant.USER_ID, userModel.userId);
// mContext.startActivity(intent);
// Intent intent = new Intent(mContext, BaseCallActivity.class);
// intent.putExtra(TUICallingConstants.PARAM_NAME_TYPE, type);
// intent.putExtra(TUICallingConstants.PARAM_NAME_ROLE, role);
// if (Role.CALLED == role) {
// intent.putExtra(TUICallingConstants.PARAM_NAME_SPONSORID, sponsorID);
// intent.putExtra(TUICallingConstants.PARAM_NAME_ISFROMGROUP, isFromGroup);
// }
// intent.putExtra(TUICallingConstants.PARAM_NAME_USERIDS, userIDs);
// intent.putExtra(TUICallingConstants.PARAM_NAME_GROUPID, groupID);
// intent.putExtra(TUICallingConstants.PARAM_NAME_FLOATWINDOW, mEnableFloatWindow);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// mContext.startActivity(intent);
}
};
mMainHandler
.
post
(
task
);
...
...
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/model/TRTCCalling.java
View file @
0e366aa8
...
...
@@ -2,6 +2,7 @@ package com.tencent.liteav.trtccalling.model;
import
android.app.ActivityManager
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.hardware.Sensor
;
import
android.hardware.SensorEvent
;
import
android.hardware.SensorEventListener
;
...
...
@@ -30,6 +31,8 @@ import com.tencent.imsdk.v2.V2TIMSimpleMsgListener;
import
com.tencent.imsdk.v2.V2TIMUserFullInfo
;
import
com.tencent.imsdk.v2.V2TIMUserInfo
;
import
com.tencent.imsdk.v2.V2TIMValueCallback
;
import
com.tencent.liteav.basic.UserModel
;
import
com.tencent.liteav.basic.UserModelManager
;
import
com.tencent.liteav.beauty.TXBeautyManager
;
import
com.tencent.liteav.trtccalling.R
;
import
com.tencent.liteav.trtccalling.model.impl.TRTCCallingCallback
;
...
...
@@ -43,6 +46,8 @@ import com.tencent.liteav.trtccalling.model.impl.base.TRTCLogger;
import
com.tencent.liteav.trtccalling.model.util.MediaPlayHelper
;
import
com.tencent.liteav.trtccalling.model.util.PermissionUtil
;
import
com.tencent.liteav.trtccalling.model.util.TUICallingConstants
;
import
com.tencent.liteav.videocall.Constant
;
import
com.tencent.liteav.videocall.VideoCallingActivity
;
import
com.tencent.qcloud.tuicore.TUILogin
;
import
com.tencent.rtmp.TXLiveBase
;
import
com.tencent.rtmp.ui.TXCloudVideoView
;
...
...
@@ -68,18 +73,18 @@ import java.util.Set;
* 本功能使用腾讯云实时音视频 / 腾讯云即时通信IM 组合实现
*/
public
class
TRTCCalling
{
private
static
final
String
TAG
=
"TRTCCalling"
;
private
static
final
String
TAG
=
"TRTCCalling"
;
/**
* 超时时间,单位秒
*/
public
static
final
int
TIME_OUT_COUNT
=
30
;
public
static
final
int
TIME_OUT_COUNT
=
30
;
/**
* room id 的取值范围
*/
private
static
final
int
ROOM_ID_MIN
=
1
;
private
static
final
int
ROOM_ID_MAX
=
Integer
.
MAX_VALUE
;
private
final
Context
mContext
;
private
static
final
int
ROOM_ID_MIN
=
1
;
private
static
final
int
ROOM_ID_MAX
=
Integer
.
MAX_VALUE
;
private
final
Context
mContext
;
/**
* 底层SDK调用实例
...
...
@@ -89,36 +94,36 @@ public class TRTCCalling {
/**
* 是否首次邀请
*/
private
boolean
isOnCalling
=
false
;
private
String
mCurCallID
=
""
;
private
String
mSwitchToAudioCallID
=
""
;
private
int
mCurRoomID
=
0
;
private
boolean
isOnCalling
=
false
;
private
String
mCurCallID
=
""
;
private
String
mSwitchToAudioCallID
=
""
;
private
int
mCurRoomID
=
0
;
/**
* C2C多人通话添加: 记录每个userId对应的CallId
*/
private
Map
<
String
,
String
>
mUserCallIDMap
=
new
HashMap
<>();
private
Map
<
String
,
String
>
mUserCallIDMap
=
new
HashMap
<>();
/**
* C2C多人通话添加: 记录已经接通在TRTC房间内的远端用户
*/
private
List
<
String
>
mRemoteUserInTRTCRoom
=
new
ArrayList
<>();
private
List
<
String
>
mRemoteUserInTRTCRoom
=
new
ArrayList
<>();
/**
* 当前是否在TRTC房间中
*/
private
boolean
mIsInRoom
=
false
;
private
long
mEnterRoomTime
=
0
;
private
boolean
mIsInRoom
=
false
;
private
long
mEnterRoomTime
=
0
;
/**
* 当前邀请列表
* C2C通话时会记录自己邀请的用户
* IM群组通话时会同步群组内邀请的用户
* 当用户接听、拒绝、忙线、超时会从列表中移除该用户
*/
private
List
<
String
>
mCurInvitedList
=
new
ArrayList
<>();
private
List
<
String
>
mCurInvitedList
=
new
ArrayList
<>();
/**
* 当前语音通话中的远端用户
*/
private
Set
<
String
>
mCurRoomRemoteUserSet
=
new
HashSet
<>();
private
Set
<
String
>
mCurRoomRemoteUserSet
=
new
HashSet
<>();
/**
* C2C通话的邀请人
...
...
@@ -129,45 +134,45 @@ public class TRTCCalling {
/**
* 当前通话的类型
*/
private
int
mCurCallType
=
TYPE_UNKNOWN
;
private
int
mCurCallType
=
TYPE_UNKNOWN
;
/**
* 当前群组通话的群组ID
*/
private
String
mCurGroupId
=
""
;
private
String
mCurGroupId
=
""
;
/**
* 最近使用的通话信令,用于快速处理
*/
private
CallModel
mLastCallModel
=
new
CallModel
();
private
CallModel
mLastCallModel
=
new
CallModel
();
/**
* 上层传入回调
*/
private
TRTCInternalListenerManager
mTRTCInternalListenerManager
;
private
String
mNickName
;
private
String
mFaceUrl
;
private
String
mNickName
;
private
String
mFaceUrl
;
private
boolean
mIsUseFrontCamera
;
private
MediaPlayHelper
mMediaPlayHelper
;
// 音效
private
SensorManager
mSensorManager
;
private
SensorManager
mSensorManager
;
private
SensorEventListener
mSensorEventListener
;
private
boolean
mIsBeingCalled
=
true
;
// 默认是被叫
private
boolean
mEnableMuteMode
=
false
;
// 是否开启静音模式
private
String
mCallingBellPath
=
""
;
// 被叫铃音路径
private
boolean
mIsBeingCalled
=
true
;
// 默认是被叫
private
boolean
mEnableMuteMode
=
false
;
// 是否开启静音模式
private
String
mCallingBellPath
=
""
;
// 被叫铃音路径
private
static
final
String
PROFILE_TUICALLING
=
"per_profile_tuicalling"
;
private
static
final
String
PROFILE_CALL_BELL
=
"per_call_bell"
;
private
static
final
String
PROFILE_CALL_BELL
=
"per_call_bell"
;
public
static
final
int
TYPE_UNKNOWN
=
0
;
public
static
final
int
TYPE_UNKNOWN
=
0
;
public
static
final
int
TYPE_AUDIO_CALL
=
1
;
public
static
final
int
TYPE_VIDEO_CALL
=
2
;
//通话邀请缓存,便于查询通话是否有效
private
final
Map
<
String
,
CallModel
>
mInviteMap
=
new
HashMap
<>();
private
final
Handler
mMainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
private
final
Map
<
String
,
CallModel
>
mInviteMap
=
new
HashMap
<>();
private
final
Handler
mMainHandler
=
new
Handler
(
Looper
.
getMainLooper
());
private
static
final
int
CHECK_INVITE_PERIOD
=
10
;
//邀请信令的检测周期(毫秒)
private
static
final
int
CHECK_INVITE_PERIOD
=
10
;
//邀请信令的检测周期(毫秒)
private
static
final
int
CHECK_INVITE_DURATION
=
100
;
//邀请信令的检测总时长(毫秒)
//多端登录增加字段:用于标记当前是否是自己发给自己的请求(多端触发),以及自己是否处理了该请求.
...
...
@@ -317,7 +322,16 @@ public class TRTCCalling {
List
<
String
>
inviteeList
,
String
data
)
{
TRTCLogger
.
d
(
TAG
,
"onReceiveNewInvitation inviteID:"
+
inviteID
+
", inviter:"
+
inviter
+
", groupID:"
+
groupID
+
", inviteeList:"
+
inviteeList
+
" data:"
+
data
);
handleRecvCallModel
(
inviteID
,
inviter
,
groupID
,
inviteeList
,
data
);
final
UserModel
userModel
=
UserModelManager
.
getInstance
().
getUserModel
();
Intent
intent
=
new
Intent
(
mContext
,
VideoCallingActivity
.
class
);
intent
.
putExtra
(
Constant
.
ROOM_ID
,
groupID
);
intent
.
putExtra
(
Constant
.
USER_ID
,
userModel
.
userId
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
mContext
.
startActivity
(
intent
);
// handleRecvCallModel(inviteID, inviter, groupID, inviteeList, data);
}
@Override
...
...
@@ -1153,7 +1167,13 @@ public class TRTCCalling {
if
(
isCollectionEmpty
(
userIdList
))
{
return
;
}
internalCall
(
userIdList
,
type
,
groupId
);
final
UserModel
userModel
=
UserModelManager
.
getInstance
().
getUserModel
();
Intent
intent
=
new
Intent
(
mContext
,
VideoCallingActivity
.
class
);
intent
.
putExtra
(
Constant
.
ROOM_ID
,
groupId
);
intent
.
putExtra
(
Constant
.
USER_ID
,
userModel
.
userId
);
mContext
.
startActivity
(
intent
);
// internalCall(userIdList, type, groupId);
}
/**
...
...
@@ -1171,7 +1191,7 @@ public class TRTCCalling {
mCurCallType
=
type
;
mIsBeingCalled
=
false
;
TRTCLogger
.
d
(
TAG
,
"First calling, generate room id "
+
mCurRoomID
);
enterTRTCRoom
(
mCurRoomID
,
mCurCallType
);
enterTRTCRoom
(
mCurRoomID
,
mCurCallType
);
startCall
();
startDialingMusic
();
}
...
...
@@ -1255,14 +1275,14 @@ public class TRTCCalling {
public
void
accept
()
{
mIsProcessedBySelf
=
true
;
enterTRTCRoom
(
mCurRoomID
,
mCurCallType
);
enterTRTCRoom
(
mCurRoomID
,
mCurCallType
);
stopRing
();
}
/**
* trtc 进房
*/
public
void
enterTRTCRoom
(
int
roomId
,
int
callType
)
{
public
void
enterTRTCRoom
(
int
roomId
,
int
callType
)
{
if
(
callType
==
TYPE_VIDEO_CALL
)
{
// 开启基础美颜
TXBeautyManager
txBeautyManager
=
mTRTCCloud
.
getBeautyManager
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment