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
f63843d3
Commit
f63843d3
authored
Apr 18, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat : 接入主动加入房间逻辑
parent
f6f5fdb9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
581 additions
and
54 deletions
+581
-54
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-0
MDTMainActivity.java
app/src/main/java/com/ydl/component/rtc/MDTMainActivity.java
+23
-17
TUICallingEntranceActivity.java
app/src/main/java/com/ydl/component/rtc/TUICallingEntranceActivity.java
+25
-18
VideoCallingEnterActivity.java
app/src/main/java/com/ydl/component/rtc/VideoCallingEnterActivity.java
+85
-0
common_edit_bg.xml
app/src/main/res/drawable/common_edit_bg.xml
+16
-0
videocall_activit_enter.xml
app/src/main/res/layout/videocall_activit_enter.xml
+95
-0
config.gradle
config.gradle
+2
-2
AndroidManifest.xml
ydl-tuicalling/src/main/AndroidManifest.xml
+3
-0
TUICalling.java
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/TUICalling.java
+4
-0
TUICallingImpl.java
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/TUICallingImpl.java
+4
-0
TRTCCalling.java
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/model/TRTCCalling.java
+7
-7
BaseCallActivity.java
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/ui/base/BaseCallActivity.java
+1
-9
Constant.java
ydl-tuicalling/src/main/java/com/tencent/liteav/videocall/Constant.java
+25
-0
TRTCBaseActivity.java
ydl-tuicalling/src/main/java/com/tencent/liteav/videocall/TRTCBaseActivity.java
+68
-0
VideoCallingActivity.java
ydl-tuicalling/src/main/java/com/tencent/liteav/videocall/VideoCallingActivity.java
+0
-0
common_ic_back.png
ydl-tuicalling/src/main/res/drawable-xxhdpi/common_ic_back.png
+0
-0
common_button_bg.xml
ydl-tuicalling/src/main/res/drawable/common_button_bg.xml
+11
-0
videocall_activity_calling.xml
ydl-tuicalling/src/main/res/layout/videocall_activity_calling.xml
+208
-0
strings.xml
ydl-tuicalling/src/main/res/values-zh/strings.xml
+1
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
f63843d3
...
...
@@ -112,6 +112,8 @@
android:name=
".rtc.TUICallingEntranceActivity"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.AppCompat.NoActionBar"
/>
<activity
android:name=
".rtc.VideoCallingEnterActivity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/ydl/component/rtc/MDTMainActivity.java
View file @
f63843d3
...
...
@@ -46,10 +46,10 @@ import java.util.List;
public
class
MDTMainActivity
extends
AppCompatActivity
{
private
static
final
String
TAG
=
"MainActivity"
;
private
Context
mContext
;
private
List
<
TRTCItemEntity
>
mTRTCItemEntityList
;
private
Context
mContext
;
private
List
<
TRTCItemEntity
>
mTRTCItemEntityList
;
private
TRTCRecyclerViewAdapter
mTRTCRecyclerViewAdapter
;
private
RecyclerView
mRvList
;
private
RecyclerView
mRvList
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -123,11 +123,17 @@ public class MDTMainActivity extends AppCompatActivity {
new
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
int
position
)
{
TRTCItemEntity
entity
=
mTRTCItemEntityList
.
get
(
position
);
Intent
intent
=
new
Intent
(
mContext
,
entity
.
mTargetClass
);
intent
.
putExtra
(
"TITLE"
,
entity
.
mTitle
);
intent
.
putExtra
(
"TYPE"
,
entity
.
mType
);
startActivity
(
intent
);
if
(
position
==
2
)
{
Intent
intent
=
new
Intent
(
MDTMainActivity
.
this
,
VideoCallingEnterActivity
.
class
);
startActivity
(
intent
);
}
else
{
TRTCItemEntity
entity
=
mTRTCItemEntityList
.
get
(
position
);
Intent
intent
=
new
Intent
(
mContext
,
entity
.
mTargetClass
);
intent
.
putExtra
(
"TITLE"
,
entity
.
mTitle
);
intent
.
putExtra
(
"TYPE"
,
entity
.
mType
);
startActivity
(
intent
);
}
}
});
mRvList
.
setLayoutManager
(
new
GridLayoutManager
(
mContext
,
1
));
...
...
@@ -169,9 +175,9 @@ public class MDTMainActivity extends AppCompatActivity {
public
class
TRTCItemEntity
{
public
String
mTitle
;
public
String
mContent
;
public
int
mIconId
;
public
Class
mTargetClass
;
public
int
mType
;
public
int
mIconId
;
public
Class
mTargetClass
;
public
int
mType
;
public
TRTCItemEntity
(
String
title
,
String
content
,
int
iconId
,
int
type
,
Class
targetClass
)
{
mTitle
=
title
;
...
...
@@ -230,9 +236,9 @@ public class MDTMainActivity extends AppCompatActivity {
public
class
TRTCRecyclerViewAdapter
extends
RecyclerView
.
Adapter
<
TRTCRecyclerViewAdapter
.
ViewHolder
>
{
private
Context
mContext
;
private
Context
mContext
;
private
List
<
TRTCItemEntity
>
mItemEntities
;
private
OnItemClickListener
onItemClickListener
;
private
OnItemClickListener
onItemClickListener
;
public
TRTCRecyclerViewAdapter
(
Context
context
,
List
<
TRTCItemEntity
>
list
,
OnItemClickListener
onItemClickListener
)
{
...
...
@@ -242,11 +248,11 @@ public class MDTMainActivity extends AppCompatActivity {
}
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
private
ImageView
mItemImg
;
private
TextView
mTitleTv
;
private
TextView
mDescription
;
private
ImageView
mItemImg
;
private
TextView
mTitleTv
;
private
TextView
mDescription
;
private
ConstraintLayout
mClItem
;
private
View
mBottomLine
;
private
View
mBottomLine
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
...
...
app/src/main/java/com/ydl/component/rtc/TUICallingEntranceActivity.java
View file @
f63843d3
...
...
@@ -48,33 +48,33 @@ import java.util.List;
public
class
TUICallingEntranceActivity
extends
Activity
{
private
Toolbar
mToolbar
;
//导航栏,主要负责监听导航栏返回按钮
private
TextView
mTvTitle
;
//导航栏标题
private
EditText
mEtSearchUser
;
//输入手机号码的编辑文本框
private
ImageView
mIvClearSearch
;
//清除搜索框文本按钮
private
TextView
mTvSearch
;
//开始搜索用户的按钮
private
TextView
mTextUserId
;
//自己的手机号
private
LinearLayout
mLlContract
;
//用来展示对方信息的layout
private
Toolbar
mToolbar
;
//导航栏,主要负责监听导航栏返回按钮
private
TextView
mTvTitle
;
//导航栏标题
private
EditText
mEtSearchUser
;
//输入手机号码的编辑文本框
private
ImageView
mIvClearSearch
;
//清除搜索框文本按钮
private
TextView
mTvSearch
;
//开始搜索用户的按钮
private
TextView
mTextUserId
;
//自己的手机号
private
LinearLayout
mLlContract
;
//用来展示对方信息的layout
private
RoundCornerImageView
mIvAvatar
;
//用来展示对方头像
private
TextView
mTvUserName
;
//用来展示对方昵称
private
Button
mBtnStartCall
;
//开始呼叫按钮
private
ConstraintLayout
mClTips
;
//显示搜索提示信息
private
ImageButton
mBtnLink
;
//跳转官网链接
private
ListView
mListMembers
;
//已添加成员(多人通话)
private
TextView
mTvUserName
;
//用来展示对方昵称
private
Button
mBtnStartCall
;
//开始呼叫按钮
private
ConstraintLayout
mClTips
;
//显示搜索提示信息
private
ImageButton
mBtnLink
;
//跳转官网链接
private
ListView
mListMembers
;
//已添加成员(多人通话)
private
UserModel
mSelfModel
;
//表示当前用户的 UserModel
private
UserModel
mSearchModel
;
//表示当前搜索的 UserModel
private
int
mType
;
//表示当前是 videocall/audiocall
private
int
mType
;
//表示当前是 videocall/audiocall
public
static
final
int
TYPE_UNKNOWN
=
0
;
public
static
final
int
TYPE_AUDIO_CALL
=
1
;
public
static
final
int
TYPE_VIDEO_CALL
=
2
;
public
static
final
int
TYPE_UNKNOWN
=
0
;
public
static
final
int
TYPE_AUDIO_CALL
=
1
;
public
static
final
int
TYPE_VIDEO_CALL
=
2
;
public
static
final
int
TYPE_MULTI_AUDIO_CALL
=
3
;
public
static
final
int
TYPE_MULTI_VIDEO_CALL
=
4
;
private
static
final
int
MULTI_CALL_MAX_NUM
=
8
;
//C2C多人通话最大人数是9(需包含自己)
private
static
final
int
MULTI_CALL_MAX_NUM
=
8
;
//C2C多人通话最大人数是9(需包含自己)
private
static
final
int
ERROR_CODE_USER_NOT_EXIST
=
206
;
private
static
final
int
PERMISSION_RESULT_CODE
=
1100
;
private
static
final
int
PERMISSION_RESULT_CODE
=
1100
;
private
final
List
<
UserModel
>
mUserModelList
=
new
ArrayList
<>();
...
...
@@ -92,6 +92,7 @@ public class TUICallingEntranceActivity extends Activity {
}
TUICalling
.
Type
callType
=
(
mType
==
TYPE_VIDEO_CALL
||
mType
==
TYPE_MULTI_VIDEO_CALL
)
?
TUICalling
.
Type
.
VIDEO
:
TUICalling
.
Type
.
AUDIO
;
TUICallingImpl
.
sharedInstance
(
this
).
call
(
userIDs
,
callType
);
}
...
...
@@ -158,6 +159,12 @@ public class TUICallingEntranceActivity extends Activity {
@Override
public
void
onClick
(
View
v
)
{
startCallSomeone
();
// TRTCCalling.sharedInstance(TUICallingEntranceActivity.this).setmCurSponsorForMe("1");
// TRTCCalling.sharedInstance(TUICallingEntranceActivity.this).enterTRTCRoom(75, TRTCCalling.TYPE_VIDEO_CALL);
// TRTCCalling.sharedInstance(TUICallingEntranceActivity.this).reject();
// String[] userIDs = new String[]{"130954238"};
// TUICallingImpl.sharedInstance(TUICallingEntranceActivity.this)
// .internalCall(userIDs, "1", "74");
}
});
}
...
...
app/src/main/java/com/ydl/component/rtc/VideoCallingEnterActivity.java
0 → 100644
View file @
f63843d3
package
com
.
ydl
.
component
.
rtc
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.inputmethod.InputMethodManager
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.tencent.liteav.videocall.Constant
;
import
com.tencent.liteav.videocall.VideoCallingActivity
;
import
com.ydl.component.R
;
/**
* TRTC视频通话的入口页面(可以设置房间id和用户id)
*
* - 可跳转TRTC视频通话页面{@link VideoCallingActivity}
*/
/**
* Video Call Entrance View (set room ID and user ID)
*
* - Direct to the video call view: {@link VideoCallingActivity}
*/
public
class
VideoCallingEnterActivity
extends
AppCompatActivity
{
private
EditText
mEditInputUserId
;
private
EditText
mEditInputRoomId
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
videocall_activit_enter
);
mEditInputUserId
=
findViewById
(
R
.
id
.
et_input_username
);
mEditInputRoomId
=
findViewById
(
R
.
id
.
et_input_room_id
);
findViewById
(
R
.
id
.
btn_enter_room
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
startEnterRoom
();
}
});
findViewById
(
R
.
id
.
rl_entrance_main
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
hideInput
();
}
});
findViewById
(
R
.
id
.
iv_back
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
finish
();
}
});
mEditInputRoomId
.
setText
(
"1256732"
);
String
time
=
String
.
valueOf
(
System
.
currentTimeMillis
());
String
userId
=
time
.
substring
(
time
.
length
()
-
8
);
mEditInputUserId
.
setText
(
userId
);
}
private
void
startEnterRoom
()
{
if
(
TextUtils
.
isEmpty
(
mEditInputUserId
.
getText
().
toString
().
trim
())
||
TextUtils
.
isEmpty
(
mEditInputRoomId
.
getText
().
toString
().
trim
()))
{
Toast
.
makeText
(
VideoCallingEnterActivity
.
this
,
"房间号和用户名不能为空"
,
Toast
.
LENGTH_LONG
).
show
();
return
;
}
Intent
intent
=
new
Intent
(
VideoCallingEnterActivity
.
this
,
VideoCallingActivity
.
class
);
intent
.
putExtra
(
Constant
.
ROOM_ID
,
mEditInputRoomId
.
getText
().
toString
().
trim
());
intent
.
putExtra
(
Constant
.
USER_ID
,
mEditInputUserId
.
getText
().
toString
().
trim
());
startActivity
(
intent
);
}
protected
void
hideInput
()
{
InputMethodManager
imm
=
(
InputMethodManager
)
getSystemService
(
INPUT_METHOD_SERVICE
);
View
v
=
getWindow
().
peekDecorView
();
if
(
null
!=
v
)
{
imm
.
hideSoftInputFromWindow
(
v
.
getWindowToken
(),
0
);
}
}
}
app/src/main/res/drawable/common_edit_bg.xml
0 → 100644
View file @
f63843d3
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#EFEFEF"
/>
<corners
android:bottomLeftRadius=
"2dip"
android:bottomRightRadius=
"2dip"
android:topLeftRadius=
"2dip"
android:topRightRadius=
"2dip"
/>
<stroke
android:width=
"5px"
android:color=
"@color/white"
/>
</shape>
app/src/main/res/layout/videocall_activit_enter.xml
0 → 100644
View file @
f63843d3
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/rl_entrance_main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#1B1B1B"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/iv_back"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"15dp"
android:background=
"@drawable/common_ic_back"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_marginTop=
"15dp"
android:gravity=
"center_horizontal"
android:text=
"TRTC 视频通话示例"
android:textColor=
"@android:color/white"
android:textSize=
"20sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_room_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginLeft=
"60dp"
android:layout_marginTop=
"100dp"
android:layout_marginRight=
"60dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"请输入房间号(必填项)"
android:textColor=
"@android:color/white"
/>
<EditText
android:id=
"@+id/et_input_room_id"
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:layout_marginTop=
"5dp"
android:background=
"@drawable/common_edit_bg"
android:inputType=
"number"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/ll_room_info"
android:layout_centerHorizontal=
"true"
android:layout_marginLeft=
"60dp"
android:layout_marginTop=
"30dp"
android:layout_marginRight=
"60dp"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"请输入用户名(必填项)"
android:textColor=
"@android:color/white"
/>
<EditText
android:id=
"@+id/et_input_username"
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:layout_marginTop=
"5dp"
android:background=
"@drawable/common_edit_bg"
/>
</LinearLayout>
<Button
android:id=
"@+id/btn_enter_room"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_margin=
"60dp"
android:background=
"@drawable/common_button_bg"
android:text=
"进入房间"
android:textColor=
"@android:color/white"
/>
</RelativeLayout>
\ No newline at end of file
config.gradle
View file @
f63843d3
...
...
@@ -34,7 +34,7 @@ ext {
//mdt 组件
"ydl-tuicore"
:
"0.0.1"
,
"ydl-tuicalling"
:
"0.0.
4
"
,
"ydl-tuicalling"
:
"0.0.
6
"
,
//第一步
"ydl-platform"
:
"0.0.40.79"
,
...
...
@@ -118,7 +118,7 @@ ext {
//-------------- 功能组件 --------------
//mdt组件
"ydl-tuicore"
:
"0.0.1"
,
"ydl-tuicalling"
:
"0.0.
4
"
,
"ydl-tuicalling"
:
"0.0.
6
"
,
//第一步
"ydl-platform"
:
"0.0.40.79"
,
...
...
ydl-tuicalling/src/main/AndroidManifest.xml
View file @
f63843d3
...
...
@@ -31,6 +31,8 @@
android:enabled=
"true"
android:exported=
"false"
/>
<activity
android:name=
"com.tencent.liteav.videocall.VideoCallingActivity"
/>
</application>
</manifest>
\ No newline at end of file
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/TUICalling.java
View file @
f63843d3
...
...
@@ -48,6 +48,10 @@ public interface TUICalling {
void
call
(
String
[]
userIDs
,
Type
type
);
/**
* 拨打群组电话
* */
void
internalCall
(
final
String
[]
userIDs
,
final
String
sponsorID
,
final
String
groupID
);
/**
* 设置监听器
*
* @param listener 监听器
...
...
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/TUICallingImpl.java
View file @
f63843d3
...
...
@@ -112,6 +112,10 @@ public final class TUICallingImpl implements TUICalling, TRTCCallingDelegate {
public
void
internalCall
(
final
String
[]
userIDs
,
String
groupID
,
final
Type
type
,
final
Role
role
)
{
internalCall
(
userIDs
,
""
,
groupID
,
!
TextUtils
.
isEmpty
(
groupID
),
type
,
role
);
}
@Override
public
void
internalCall
(
final
String
[]
userIDs
,
final
String
sponsorID
,
final
String
groupID
)
{
internalCall
(
userIDs
,
sponsorID
,
groupID
,
true
,
Type
.
VIDEO
,
Role
.
CALLED
);
}
void
internalCall
(
final
String
[]
userIDs
,
final
String
sponsorID
,
final
String
groupID
,
final
boolean
isFromGroup
,
final
Type
type
,
final
Role
role
)
{
//当前悬浮窗显示,说明在通话流程中,不能再发起通话
...
...
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/model/TRTCCalling.java
View file @
f63843d3
...
...
@@ -1171,7 +1171,7 @@ public class TRTCCalling {
mCurCallType
=
type
;
mIsBeingCalled
=
false
;
TRTCLogger
.
d
(
TAG
,
"First calling, generate room id "
+
mCurRoomID
);
enterTRTCRoom
();
enterTRTCRoom
(
mCurRoomID
,
mCurCallType
);
startCall
();
startDialingMusic
();
}
...
...
@@ -1255,15 +1255,15 @@ public class TRTCCalling {
public
void
accept
()
{
mIsProcessedBySelf
=
true
;
enterTRTCRoom
();
enterTRTCRoom
(
mCurRoomID
,
mCurCallType
);
stopRing
();
}
/**
* trtc 进房
*/
p
rivate
void
enterTRTCRoom
(
)
{
if
(
mCurC
allType
==
TYPE_VIDEO_CALL
)
{
p
ublic
void
enterTRTCRoom
(
int
roomId
,
int
callType
)
{
if
(
c
allType
==
TYPE_VIDEO_CALL
)
{
// 开启基础美颜
TXBeautyManager
txBeautyManager
=
mTRTCCloud
.
getBeautyManager
();
// 自然美颜
...
...
@@ -1278,9 +1278,9 @@ public class TRTCCalling {
encParam
.
enableAdjustRes
=
true
;
mTRTCCloud
.
setVideoEncoderParam
(
encParam
);
}
TRTCLogger
.
i
(
TAG
,
"enterTRTCRoom: "
+
TUILogin
.
getUserId
()
+
" room:"
+
mCurRoomID
);
TRTCLogger
.
i
(
TAG
,
"enterTRTCRoom: "
+
TUILogin
.
getUserId
()
+
" room:"
+
roomId
);
TRTCCloudDef
.
TRTCParams
trtcParams
=
new
TRTCCloudDef
.
TRTCParams
(
TUILogin
.
getSdkAppId
(),
TUILogin
.
getUserId
(),
TUILogin
.
getUserSig
(),
mCurRoomID
,
""
,
""
);
TUILogin
.
getUserSig
(),
roomId
,
""
,
""
);
trtcParams
.
role
=
TRTCCloudDef
.
TRTCRoleAnchor
;
mTRTCCloud
.
enableAudioVolumeEvaluation
(
300
);
mTRTCCloud
.
setAudioRoute
(
TRTCCloudDef
.
TRTC_AUDIO_ROUTE_SPEAKER
);
...
...
@@ -1290,7 +1290,7 @@ public class TRTCCalling {
// 输出版本日志
printVersionLog
();
mTRTCCloud
.
setListener
(
mTRTCCloudListener
);
mTRTCCloud
.
enterRoom
(
trtcParams
,
mCurC
allType
==
TYPE_VIDEO_CALL
mTRTCCloud
.
enterRoom
(
trtcParams
,
c
allType
==
TYPE_VIDEO_CALL
?
TRTCCloudDef
.
TRTC_APP_SCENE_VIDEOCALL
:
TRTCCloudDef
.
TRTC_APP_SCENE_AUDIOCALL
);
}
...
...
ydl-tuicalling/src/main/java/com/tencent/liteav/trtccalling/ui/base/BaseCallActivity.java
View file @
f63843d3
...
...
@@ -82,15 +82,7 @@ public class BaseCallActivity extends Activity {
imageBack
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(!
PermissionUtil
.
hasPermission
(
getApplicationContext
()))
{
ToastUtils
.
showLong
(
getString
(
R
.
string
.
trtccalling_float_permission
));
return
;
}
//注意:需给Activity添加该action,找不到会报错
Intent
intent
=
new
Intent
(
"com.tencent.trtc.tuicalling"
);
startActivity
(
intent
);
startFloatService
();
BaseCallActivity
.
this
.
finish
();
}
});
}
...
...
ydl-tuicalling/src/main/java/com/tencent/liteav/videocall/Constant.java
0 → 100644
View file @
f63843d3
package
com
.
tencent
.
liteav
.
videocall
;
public
class
Constant
{
public
static
final
String
ROOM_ID
=
"room_id"
;
public
static
final
String
USER_ID
=
"user_id"
;
public
static
final
String
ROLE_TYPE
=
"role_type"
;
public
static
final
String
CUSTOM_VIDEO
=
"custom_video"
;
// 美颜风格.三种美颜风格:0 :光滑 1:自然 2:朦胧
public
static
final
int
BEAUTY_STYLE_SMOOTH
=
0
;
public
static
final
int
BEAUTY_STYLE_NATURE
=
1
;
public
static
final
int
VIDEO_FPS
=
15
;
// RTC 通话场景:640*360,15fps,550kbps
public
static
final
int
RTC_VIDEO_BITRATE
=
550
;
// 直播场景:连麦小主播:270*480, 15pfs, 400kbps
public
static
final
int
LIVE_270_480_VIDEO_BITRATE
=
400
;
public
static
final
int
LIVE_360_640_VIDEO_BITRATE
=
800
;
// 直播场景:大主播:默认 540*960, 15fps,1200kbps
public
static
final
int
LIVE_540_960_VIDEO_BITRATE
=
900
;
public
static
final
int
LIVE_720_1280_VIDEO_BITRATE
=
1500
;
}
ydl-tuicalling/src/main/java/com/tencent/liteav/videocall/TRTCBaseActivity.java
0 → 100644
View file @
f63843d3
package
com
.
tencent
.
liteav
.
videocall
;
import
android.Manifest
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.app.ActivityCompat
;
import
java.util.ArrayList
;
import
java.util.List
;
public
abstract
class
TRTCBaseActivity
extends
AppCompatActivity
{
protected
static
final
int
REQ_PERMISSION_CODE
=
0x1000
;
protected
int
mGrantedCount
=
0
;
protected
abstract
void
onPermissionGranted
();
protected
boolean
checkPermission
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
List
<
String
>
permissions
=
new
ArrayList
<>();
if
(
PackageManager
.
PERMISSION_GRANTED
!=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
))
{
permissions
.
add
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
}
if
(
PackageManager
.
PERMISSION_GRANTED
!=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
CAMERA
))
{
permissions
.
add
(
Manifest
.
permission
.
CAMERA
);
}
if
(
PackageManager
.
PERMISSION_GRANTED
!=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
RECORD_AUDIO
))
{
permissions
.
add
(
Manifest
.
permission
.
RECORD_AUDIO
);
}
if
(
PackageManager
.
PERMISSION_GRANTED
!=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
))
{
permissions
.
add
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
);
}
if
(
permissions
.
size
()
!=
0
)
{
ActivityCompat
.
requestPermissions
(
TRTCBaseActivity
.
this
,
permissions
.
toArray
(
new
String
[
0
]),
REQ_PERMISSION_CODE
);
return
false
;
}
}
return
true
;
}
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
[]
permissions
,
int
[]
grantResults
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
switch
(
requestCode
)
{
case
REQ_PERMISSION_CODE:
for
(
int
ret
:
grantResults
)
{
if
(
PackageManager
.
PERMISSION_GRANTED
==
ret
)
{
mGrantedCount
++;
}
}
if
(
mGrantedCount
==
permissions
.
length
)
{
onPermissionGranted
();
}
else
{
Toast
.
makeText
(
this
,
"用户没有允许需要的权限,加入通话失败"
,
Toast
.
LENGTH_SHORT
).
show
();
}
mGrantedCount
=
0
;
break
;
default
:
break
;
}
}
}
ydl-tuicalling/src/main/java/com/tencent/liteav/videocall/VideoCallingActivity.java
0 → 100644
View file @
f63843d3
This diff is collapsed.
Click to expand it.
ydl-tuicalling/src/main/res/drawable-xxhdpi/common_ic_back.png
0 → 100644
View file @
f63843d3
1.44 KB
ydl-tuicalling/src/main/res/drawable/common_button_bg.xml
0 → 100644
View file @
f63843d3
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#34c759"
/>
<corners
android:bottomLeftRadius=
"5dip"
android:bottomRightRadius=
"5dip"
android:topLeftRadius=
"5dip"
android:topRightRadius=
"5dip"
/>
</shape>
ydl-tuicalling/src/main/res/layout/videocall_activity_calling.xml
0 → 100644
View file @
f63843d3
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#1B1B1B"
>
<LinearLayout
android:id=
"@+id/ll_bar"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:id=
"@+id/iv_back"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginTop=
"15dp"
android:background=
"@drawable/common_ic_back"
/>
<TextView
android:id=
"@+id/tv_room_number"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_marginTop=
"15dp"
android:gravity=
"center_horizontal"
android:text=
"1111"
android:textColor=
"@android:color/white"
android:textSize=
"20sp"
/>
</LinearLayout>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/trtc_view_1"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@id/txcvv_main"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/trtc_view_2"
app:layout_constraintTop_toBottomOf=
"@id/ll_bar"
app:layout_constraintVertical_weight=
"1"
/>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/trtc_view_2"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_below=
"@id/trtc_view_1"
android:layout_alignParentRight=
"true"
app:layout_constraintBottom_toBottomOf=
"@id/trtc_view_1"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintLeft_toRightOf=
"@id/trtc_view_1"
app:layout_constraintRight_toLeftOf=
"@id/trtc_view_4"
app:layout_constraintTop_toBottomOf=
"@id/ll_bar"
app:layout_constraintVertical_weight=
"1"
/>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/txcvv_main"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@id/trtc_view_5"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@id/trtc_view_3"
app:layout_constraintTop_toBottomOf=
"@id/trtc_view_1"
app:layout_constraintVertical_weight=
"1"
/>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/trtc_view_3"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_below=
"@id/trtc_view_2"
android:layout_alignParentRight=
"true"
app:layout_constraintBottom_toBottomOf=
"@id/txcvv_main"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintLeft_toRightOf=
"@id/txcvv_main"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/txcvv_main"
app:layout_constraintVertical_weight=
"1"
/>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/trtc_view_4"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_alignTop=
"@+id/trtc_view_3"
android:layout_alignParentLeft=
"true"
android:layout_marginLeft=
"15dp"
app:layout_constraintBottom_toBottomOf=
"@id/trtc_view_1"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintLeft_toRightOf=
"@id/trtc_view_2"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/trtc_view_1"
app:layout_constraintVertical_weight=
"1"
/>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/trtc_view_5"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_alignTop=
"@+id/trtc_view_2"
app:layout_constraintBottom_toTopOf=
"@id/ll_bottom"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"@id/txcvv_main"
app:layout_constraintTop_toBottomOf=
"@id/txcvv_main"
app:layout_constraintVertical_weight=
"1"
/>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id=
"@+id/trtc_view_6"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
app:layout_constraintBottom_toBottomOf=
"@id/trtc_view_5"
app:layout_constraintTop_toTopOf=
"@id/trtc_view_5"
app:layout_constraintLeft_toRightOf=
"@id/trtc_view_5"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintHorizontal_weight=
"1"
app:layout_constraintVertical_weight=
"1"
/>
<LinearLayout
android:id=
"@+id/ll_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_marginLeft=
"20dp"
android:layout_marginRight=
"20dp"
android:layout_marginBottom=
"10dp"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"视频选项"
android:textColor=
"#ff0000"
android:textSize=
"16sp"
/>
<LinearLayout
android:id=
"@+id/ll_controller"
android:layout_width=
"300dp"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:visibility=
"visible"
>
<Button
android:id=
"@+id/btn_switch_camera"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
android:background=
"@drawable/common_button_bg"
android:padding=
"5dp"
android:text=
"使用后置摄像头"
android:textColor=
"@android:color/white"
/>
<Button
android:id=
"@+id/btn_mute_video"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginLeft=
"10dp"
android:background=
"@drawable/common_button_bg"
android:padding=
"5dp"
android:text=
"关闭摄像头"
android:textColor=
"@android:color/white"
/>
</LinearLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"音频选项"
android:textColor=
"#ff0000"
android:textSize=
"16sp"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
android:visibility=
"visible"
>
<Button
android:id=
"@+id/btn_mute_audio"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
android:background=
"@drawable/common_button_bg"
android:padding=
"5dp"
android:text=
"关闭麦克风"
android:textColor=
"@android:color/white"
/>
<Button
android:id=
"@+id/btn_audio_route"
android:layout_width=
"wrap_content"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
android:layout_marginLeft=
"10dp"
android:background=
"@drawable/common_button_bg"
android:padding=
"5dp"
android:text=
"使用听筒"
android:textColor=
"@android:color/white"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
ydl-tuicalling/src/main/res/values-zh/strings.xml
View file @
f63843d3
...
...
@@ -2,7 +2,7 @@
<string
name=
"trtccalling_inviting_tag"
>
他们也在
</string>
<string
name=
"trtccalling_call_time_default"
>
00:01
</string>
<string
name=
"trtccalling_contact_default_name"
>
测试123
</string>
<string
name=
"trtccalling_invite_video_call"
>
邀请您
进行视频通话…
</string>
<string
name=
"trtccalling_invite_video_call"
>
邀请您
视频通话
</string>
<string
name=
"trtccalling_start_call"
>
呼叫
</string>
<string
name=
"trtccalling_search"
>
搜索
</string>
<string
name=
"trtccalling_toast_search_fail"
>
搜索失败:%1$s
</string>
...
...
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