Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,26 +419,26 @@ public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
public void onRemoteVideoStateChanged(int uid, int state, int reason, int elapsed) {
super.onRemoteVideoStateChanged(uid, state, reason, elapsed);
Log.i(TAG, "onRemoteVideoStateChanged:uid->" + uid + ", state->" + state);
if (state == REMOTE_VIDEO_STATE_STARTING) {
/**Check if the context is correct*/
Context context = getContext();
if (context == null) {
return;
}
handler.post(() ->
{
/**Display remote video stream*/
SurfaceView surfaceView = RtcEngine.CreateRendererView(context);
surfaceView.setZOrderMediaOverlay(true);
if (fl_remote.getChildCount() > 0) {
fl_remote.removeAllViews();
}
fl_remote.addView(surfaceView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
/**Setup remote video to render*/
ENGINE.setupRemoteVideo(new VideoCanvas(surfaceView, RENDER_MODE_HIDDEN, uid));
});
}
// if (state == REMOTE_VIDEO_STATE_STARTING) {
// /**Check if the context is correct*/
// Context context = getContext();
// if (context == null) {
// return;
// }
// handler.post(() ->
// {
// /**Display remote video stream*/
// SurfaceView surfaceView = RtcEngine.CreateRendererView(context);
// surfaceView.setZOrderMediaOverlay(true);
// if (fl_remote.getChildCount() > 0) {
// fl_remote.removeAllViews();
// }
// fl_remote.addView(surfaceView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.MATCH_PARENT));
// /**Setup remote video to render*/
// ENGINE.setupRemoteVideo(new VideoCanvas(surfaceView, RENDER_MODE_HIDDEN, uid));
// });
// }
}

/**Occurs when a remote user (Communication)/host (Live Broadcast) joins the channel.
Expand All @@ -465,17 +465,17 @@ public void onUserJoined(int uid, int elapsed) {
@Override
public void onUserOffline(int uid, int reason) {
Log.i(TAG, String.format("user %d offline! reason:%d", uid, reason));
showLongToast(String.format("user %d offline! reason:%d", uid, reason));
handler.post(new Runnable() {
@Override
public void run() {
/**Clear render view
Note: The video will stay at its last frame, to completely remove it you will need to
remove the SurfaceView from its parent*/
ENGINE.setupRemoteVideo(new VideoCanvas(null, RENDER_MODE_HIDDEN, uid));
fl_remote.removeAllViews();
}
});
// showLongToast(String.format("user %d offline! reason:%d", uid, reason));
// handler.post(new Runnable() {
// @Override
// public void run() {
// /**Clear render view
// Note: The video will stay at its last frame, to completely remove it you will need to
// remove the SurfaceView from its parent*/
// ENGINE.setupRemoteVideo(new VideoCanvas(null, RENDER_MODE_HIDDEN, uid));
// fl_remote.removeAllViews();
// }
// });
}
};

Expand Down