Skip to content

Commit 713c7e0

Browse files
committed
拆分初始化和进房为两个接口。
Change-Id: I9801c9a7113e00aed9ced3714bda70055ff4cc49
1 parent 4139d78 commit 713c7e0

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

explorer/device-android-demo/src/main/java/com/tencent/iot/explorer/device/video/call/RecordVideoActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,9 @@ private void initData() {
274274
mCallType = intent.getIntExtra(PARAM_TYPE, TYPE_BEING_CALLED);
275275

276276
// 初始化成员变量
277-
VideoNativeInteface.getInstance().initWithDevice(this, roomKey);
277+
VideoNativeInteface.getInstance().initWithDevice(this);
278278
VideoNativeInteface.getInstance().setCallback(mXP2PCallback);
279+
VideoNativeInteface.getInstance().enterRoom(roomKey);
279280
mTimeHandlerThread = new HandlerThread("tencent-time-count-thread");
280281
mTimeHandlerThread.start();
281282
mTimeHandler = new Handler(mTimeHandlerThread.getLooper());

video/video-advanced-device-android/README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,31 @@ TXVideoTemplateClient初始化中TXVideoCallBack 回调callback主要接口说
8989
9090
#### com.tencent.iot.device.video.advanced.recorder.rtc.VideoNativeInteface
9191
92-
1、初始化开始链接 VideoNativeInteface#initWithDevice(Context context, RoomKey roomKey)
92+
1、初始化 VideoNativeInteface#initWithDevice(Context context)
9393
9494
| 参数 | 类型 | 描述 |
9595
|:-|:-|:-|
9696
| context | Context | 上下文 |
97-
| roomKey | RoomKey | 链接房间参数 |
9897
9998
| 返回值 | 描述 |
10099
|:-|:-|
101100
| VideoNativeInteface | VideoNativeInteface实例 |
102101
103-
2、设置回调 VideoNativeInteface#setCallback(XP2PCallback callback)
102+
2、开始进房 VideoNativeInteface#enterRoom(RoomKey roomKey)
103+
104+
| 参数 | 类型 | 描述 |
105+
|:-|:-|:-|
106+
| roomKey | RoomKey | 链接房间参数 |
107+
108+
3、设置回调 VideoNativeInteface#setCallback(XP2PCallback callback)
104109
105110
| 参数 | 类型 | 描述 |
106111
|:-|:-|:-|
107112
| callback | XP2PCallback | 回调 |
108113
109-
3、释放链接 VideoNativeInteface#release()
114+
4、释放链接 VideoNativeInteface#release()
110115
111-
4、发送信令 VideoNativeInteface#sendMsgToPeer(String msg)
116+
5、发送信令 VideoNativeInteface#sendMsgToPeer(String msg)
112117
113118
| 参数 | 类型 | 描述 |
114119
|:-|:-|:-|
@@ -118,41 +123,41 @@ TXVideoTemplateClient初始化中TXVideoCallBack 回调callback主要接口说
118123
|:-|:-|
119124
| boolean | 发送是否成功 |
120125
121-
5、打开摄像头预览 VideoNativeInteface#openCamera(boolean isFrontCamera, TXCloudVideoView txCloudVideoView)
126+
6、打开摄像头预览 VideoNativeInteface#openCamera(boolean isFrontCamera, TXCloudVideoView txCloudVideoView)
122127
123128
| 参数 | 类型 | 描述 |
124129
|:-|:-|:-|
125130
| isFrontCamera | boolean | 是否是前置摄像头 |
126131
| txCloudVideoView | TXCloudVideoView | 承载视频画面的控件 |
127132
128-
6、开始推流 VideoNativeInteface#sendStreamToServer()
133+
7、开始推流 VideoNativeInteface#sendStreamToServer()
129134
130-
7、绑定远端视频渲染控件 VideoNativeInteface#startRemoteView(String userId, TXCloudVideoView txCloudVideoView)
135+
8、绑定远端视频渲染控件 VideoNativeInteface#startRemoteView(String userId, TXCloudVideoView txCloudVideoView)
131136
132137
| 参数 | 类型 | 描述 |
133138
|:-|:-|:-|
134139
| userId | String | 远端用户id |
135140
| txCloudVideoView | TXCloudVideoView | 承载视频画面的控件 |
136141
137-
8、切换摄像头 VideoNativeInteface#switchCamera(boolean isFrontCamera)
142+
9、切换摄像头 VideoNativeInteface#switchCamera(boolean isFrontCamera)
138143
139144
| 参数 | 类型 | 描述 |
140145
|:-|:-|:-|
141146
| isFrontCamera | boolean | 是否是前置摄像头 |
142147
143-
9、设置麦克风是否静音 VideoNativeInteface#setMicMute(boolean isMute)
148+
10、设置麦克风是否静音 VideoNativeInteface#setMicMute(boolean isMute)
144149
145150
| 参数 | 类型 | 描述 |
146151
|:-|:-|:-|
147152
| isMute | boolean | 是否静音 |
148153
149-
10、设置是否免提 VideoNativeInteface#setHandsFree(boolean isHandsFree)
154+
11、设置是否免提 VideoNativeInteface#setHandsFree(boolean isHandsFree)
150155
151156
| 参数 | 类型 | 描述 |
152157
|:-|:-|:-|
153158
| isHandsFree | boolean | 是否免提 |
154159
155-
11、关闭摄像头预览 VideoNativeInteface#closeCamera()
160+
12、关闭摄像头预览 VideoNativeInteface#closeCamera()
156161
157162
158163
### iot-device-video-advanced SDK 回调callback 设计说明

video/video-advanced-device-android/src/main/java/com/tencent/iot/device/video/advanced/recorder/rtc/VideoNativeInteface.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,20 @@ public static synchronized VideoNativeInteface getInstance() {
3939
return instance;
4040
}
4141

42-
public void initWithDevice(Context context, RoomKey roomKey) {
42+
public void initWithDevice(Context context) {
4343
this.mContext = context;
4444
mRTCCloud = TRTCCloud.sharedInstance(mContext);
4545
mRTCCloud.setListener(mRTCCloudListener);
4646
enableAGC(false);
4747
enableAEC(true);
4848
enableANS(true);
49-
enterRTCRoom(roomKey);
5049
}
5150

5251
public void setCallback(XP2PCallback mXP2PCallback) {
5352
this.mXP2PCallback = mXP2PCallback;
5453
}
5554

56-
public TRTCCloudListener getmRTCCloudListener() {
55+
public TRTCCloudListener getRTCCloudListener() {
5756
return mRTCCloudListener;
5857
}
5958

@@ -141,7 +140,7 @@ public void onFirstVideoFrame(String userId, int streamType, int width, int heig
141140
/**
142141
* rtc 进房
143142
*/
144-
private void enterRTCRoom(RoomKey roomKey) {
143+
public void enterRoom(RoomKey roomKey) {
145144
if (roomKey == null) return;
146145

147146
// 进房前需要设置一下关键参数

0 commit comments

Comments
 (0)