Skip to content

Commit

Permalink
Android 升级8.8
Browse files Browse the repository at this point in the history
  • Loading branch information
masonqiao committed Jun 21, 2021
1 parent dc5deeb commit ecfeeb8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
14 changes: 14 additions & 0 deletions Android/TRTC-API-Example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
* TRTC 自定义相机采集&渲染的示例
*
* 本文件展示了如何使用TRTC SDK 实现相机的自定义采集&渲染功能,主要流程如下:
* - 调用{@link CustomCameraCapture#startInternal(CustomCameraCapture.VideoFrameReadListener)},启动Camera采集,并传入一个VideoFrameReadListener;
* - 将VideoFrameReadListener返回的视频帧通过TRTC的自定义视频采集接口{@link TRTCCloud#sendCustomVideoData(TRTCCloudDef.TRTCVideoFrame)}发送给TRTC SDK;
* - 通过{@link TRTCCloud#setLocalVideoRenderListener(int, int, TRTCCloudListener.TRTCVideoRenderListener)}获取处理后的本地视频帧并渲染到屏幕上;
* - 如果有远端主播,可以通过{@link TRTCCloud#setRemoteVideoRenderListener(String, int, int, TRTCCloudListener.TRTCVideoRenderListener)} 获取远端主播的视频帧并渲染到屏幕上;
* - 调用{@link com.tencent.trtc.customcamera.helper.CustomCameraCapture#startInternal(com.tencent.trtc.customcamera.helper.CustomCameraCapture.VideoFrameReadListener)},启动Camera采集,并传入一个VideoFrameReadListener;
* - {@link com.tencent.trtc.customcamera.helper.CustomCameraCapture.VideoFrameReadListener}返回的视频帧通过TRTC的自定义视频采集接口 {@link com.tencent.trtc.TRTCCloud#sendCustomVideoData(int, com.tencent.trtc.TRTCCloudDef.TRTCVideoFrame)}; 发送给TRTC SDK;
* - 通过{@link com.tencent.trtc.TRTCCloud#setLocalVideoRenderListener(int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)}获取处理后的本地视频帧并渲染到屏幕上;
* - 如果有远端主播,可以通过{@link com.tencent.trtc.TRTCCloud#setRemoteVideoRenderListener(String, int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)} 获取远端主播的视频帧并渲染到屏幕上;
*
* - 更多细节,详见API说明文档{https://liteav.sdk.qcloud.com/doc/api/zh-cn/group__TRTCCloud__android.html}
*/
Expand All @@ -46,10 +46,10 @@
* Custom Video Capturing & Rendering
*
* This document shows how to enable custom video capturing and rendering in the TRTC SDK.
* - Call {@link CustomCameraCapture#startInternal(CustomCameraCapture.VideoFrameReadListener)} to start video capturing by the camera, with `VideoFrameReadListener` passed in.
* - Call the custom video capturing API {@link TRTCCloud#sendCustomVideoData(TRTCCloudDef.TRTCVideoFrame)} to send the video frames returned by `VideoFrameReadListener` to the SDK.
* - Get the processed local video data using {@link TRTCCloud#setLocalVideoRenderListener(int, int, TRTCCloudListener.TRTCVideoRenderListener)} and render it to the screen.
* - If there is a remote anchor, call {@link TRTCCloud#setRemoteVideoRenderListener(String, int, int, TRTCCloudListener.TRTCVideoRenderListener)} to get the anchor’s video frames and render them to the screen.
* - Call {@link com.tencent.trtc.customcamera.helper.CustomCameraCapture#startInternal(com.tencent.trtc.customcamera.helper.CustomCameraCapture.VideoFrameReadListener)} to start video capturing by the camera, with `VideoFrameReadListener` passed in.
* - Call the custom video capturing API {@link com.tencent.trtc.TRTCCloud#sendCustomVideoData(int, com.tencent.trtc.TRTCCloudDef.TRTCVideoFrame)}; to send the video frames returned by `{@link com.tencent.trtc.customcamera.helper.CustomCameraCapture.VideoFrameReadListener}` to the SDK.
* - Get the processed local video data using {@link com.tencent.trtc.TRTCCloud#setLocalVideoRenderListener(int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)} and render it to the screen.
* - If there is a remote anchor, call {@link com.tencent.trtc.TRTCCloud#setRemoteVideoRenderListener(String, int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)} to get the anchor’s video frames and render them to the screen.
*
* - For more information, please see the API document {https://liteav.sdk.qcloud.com/doc/api/zh-cn/group__TRTCCloud__android.html}.
*/
Expand Down Expand Up @@ -86,7 +86,7 @@ public void onFrameAvailable(EGLContext eglContext, int textureId, int width, in
videoFrame.pixelFormat = TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D;
videoFrame.bufferType = TRTCCloudDef.TRTC_VIDEO_BUFFER_TYPE_TEXTURE;

mTRTCCloud.sendCustomVideoData(videoFrame);
mTRTCCloud.sendCustomVideoData(TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG ,videoFrame);
}
};

Expand Down Expand Up @@ -144,7 +144,7 @@ private void enterRoom(String roomId, String userId) {
mTRTCParams.role = TRTCCloudDef.TRTCRoleAnchor;
mTRTCCloud.enterRoom(mTRTCParams, TRTCCloudDef.TRTC_APP_SCENE_LIVE);

mTRTCCloud.enableCustomVideoCapture(true);
mTRTCCloud.enableCustomVideoCapture(TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG,true);

mCustomCameraCapture.startInternal(mVideoFrameReadListener);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
*
* 本文件展示了如何使用TRTC SDK实现视频文件直播分享功能,主要流程如下:
* - 读取视频文件、对视频文件进行解封装 --> 解码;
* - 将解码后的音视频帧通过TRTC的自定义采集接口{@link TRTCCloud#sendCustomAudioData(TRTCCloudDef.TRTCAudioFrame)} 和{@link TRTCCloud#sendCustomVideoData(TRTCCloudDef.TRTCVideoFrame)}发送给TRTC SDK;
* - 通过{@link TRTCCloud#setLocalVideoRenderListener(int, int, TRTCCloudListener.TRTCVideoRenderListener)}获取处理后的本地视频帧并渲染到屏幕上;
* - 通过{@link TRTCCloud#setAudioFrameListener(TRTCCloudListener.TRTCAudioFrameListener)} )}获取处理后的音频帧并进行播放;
* - 如果有远端主播,可以通过{@link TRTCCloud#setRemoteVideoRenderListener(String, int, int, TRTCCloudListener.TRTCVideoRenderListener)} 获取远端主播的视频帧并渲染到屏幕上,远端主播的音频会在上一步自动混音后播放;
* - 将解码后的音视频帧通过TRTC的自定义采集接口{@link com.tencent.trtc.TRTCCloud#sendCustomAudioData(com.tencent.trtc.TRTCCloudDef.TRTCAudioFrame)} 和{@link com.tencent.trtc.TRTCCloud#sendCustomVideoData(int, com.tencent.trtc.TRTCCloudDef.TRTCVideoFrame)}发送给TRTC SDK;
* - 通过{@link com.tencent.trtc.TRTCCloud#setLocalVideoRenderListener(int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)}获取处理后的本地视频帧并渲染到屏幕上;
* - 通过{@link com.tencent.trtc.TRTCCloud#setAudioFrameListener(com.tencent.trtc.TRTCCloudListener.TRTCAudioFrameListener)} )}获取处理后的音频帧并进行播放;
* - 如果有远端主播,可以通过{@link com.tencent.trtc.TRTCCloud#setRemoteVideoRenderListener(String, int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)} 获取远端主播的视频帧并渲染到屏幕上,远端主播的音频会在上一步自动混音后播放;
*
* - 更多细节,详见API说明文档{https://liteav.sdk.qcloud.com/doc/api/zh-cn/group__TRTCCloud__android.html}
*/
Expand All @@ -53,10 +53,10 @@
*
* This document shows how to share a video file during live streaming. The steps are detailed below:
* - Read and de-encapsulate the video file --> decode
* - Call the SDK’s custom audio and video capturing APIs {@link TRTCCloud#sendCustomAudioData(TRTCCloudDef.TRTCAudioFrame)} and {@link TRTCCloud#sendCustomVideoData(TRTCCloudDef.TRTCVideoFrame)} to send the decoded audio and video frames to the SDK.
* - Call {@link TRTCCloud#setLocalVideoRenderListener(int, int, TRTCCloudListener.TRTCVideoRenderListener)} to get the processed local video frames and render them to the screen.
* - Call {@link TRTCCloud#setAudioFrameListener(TRTCCloudListener.TRTCAudioFrameListener)} )} to get and play the processed audio frames.
* - If there is a remote anchor, call {@link TRTCCloud#setRemoteVideoRenderListener(String, int, int, TRTCCloudListener.TRTCVideoRenderListener)} to get the anchor’s video frames and render them to the screen. The audio of the anchor is automatically mixed and played in the previous step.
* - Call the SDK’s custom audio and video capturing APIs {@link com.tencent.trtc.TRTCCloud#sendCustomAudioData(com.tencent.trtc.TRTCCloudDef.TRTCAudioFrame)} and {@link com.tencent.trtc.TRTCCloud#sendCustomVideoData(int, com.tencent.trtc.TRTCCloudDef.TRTCVideoFrame)} to send the decoded audio and video frames to the SDK.
* - Call {@link com.tencent.trtc.TRTCCloud#setLocalVideoRenderListener(int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)} to get the processed local video frames and render them to the screen.
* - Call {@link com.tencent.trtc.TRTCCloud#setAudioFrameListener(com.tencent.trtc.TRTCCloudListener.TRTCAudioFrameListener)} )} to get and play the processed audio frames.
* - If there is a remote anchor, call {@link com.tencent.trtc.TRTCCloud#setRemoteVideoRenderListener(String, int, int, com.tencent.trtc.TRTCCloudListener.TRTCVideoRenderListener)} to get the anchor’s video frames and render them to the screen. The audio of the anchor is automatically mixed and played in the previous step.
*
* - For more information, please see the API document {https://liteav.sdk.qcloud.com/doc/api/zh-cn/group__TRTCCloud__android.html}.
*/
Expand Down Expand Up @@ -111,7 +111,7 @@ public void onFrameAvailable(EGLContext eglContext, int textureId, int width, in
videoFrame.pixelFormat = TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D;
videoFrame.bufferType = TRTCCloudDef.TRTC_VIDEO_BUFFER_TYPE_TEXTURE;

mTRTCCloud.sendCustomVideoData(videoFrame);
mTRTCCloud.sendCustomVideoData(TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG, videoFrame);
}
};

Expand Down Expand Up @@ -171,7 +171,7 @@ private void enterRoom(String roomId, String userId) {
mTRTCParams.role = TRTCCloudDef.TRTCRoleAnchor;
mTRTCCloud.enterRoom(mTRTCParams, TRTCCloudDef.TRTC_APP_SCENE_LIVE);

mTRTCCloud.enableCustomVideoCapture(true);
mTRTCCloud.enableCustomVideoCapture(TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG, true);
mTRTCCloud.enableCustomAudioCapture(true);
mMediaFileSyncReader.start(mAudioFrameReadListener, mVideoFrameReadListener);

Expand Down

0 comments on commit ecfeeb8

Please sign in to comment.