|
@@ -83,6 +83,7 @@ import cn.rongcloud.rtc.api.callback.IRCRTCStatusReportListener;
|
|
|
import cn.rongcloud.rtc.api.report.StatusBean;
|
|
|
import cn.rongcloud.rtc.api.report.StatusReport;
|
|
|
import cn.rongcloud.rtc.api.stream.RCRTCAudioInputStream;
|
|
|
+import cn.rongcloud.rtc.api.stream.RCRTCAudioOutputStream;
|
|
|
import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
|
|
|
import cn.rongcloud.rtc.api.stream.RCRTCVideoOutputStream;
|
|
|
import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
|
|
@@ -684,7 +685,7 @@ public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLive
|
|
|
|
|
|
if (id == R.id.iv_mic) {
|
|
|
//连麦管理
|
|
|
-// showMicManagerDialog();
|
|
|
+ showMicManagerDialog();
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -983,6 +984,9 @@ public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLive
|
|
|
//role转换为观众,主播取消订阅该用户的流
|
|
|
if (presenter != null) {
|
|
|
//取消订阅该成员消息
|
|
|
+ User user = new User();
|
|
|
+ user.setUserId(userId);
|
|
|
+ mRoomMicMemberHelper.delOnMicUser(user);
|
|
|
presenter.unSubscribeStream(userId, null);
|
|
|
}
|
|
|
}
|
|
@@ -1004,16 +1008,28 @@ public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLive
|
|
|
user.setUserId(seatApplyMessage.getAudienceId());
|
|
|
user.setPortrait(seatApplyMessage.getAudienceAvatar());
|
|
|
mRoomMicMemberHelper.addApplyUser(user);
|
|
|
-// updateMicManagerData();
|
|
|
+ updateMicManagerData();
|
|
|
}
|
|
|
if (seatApplyMessage.getType() == LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_USER) {
|
|
|
//观众取消
|
|
|
+ User user = new User();
|
|
|
+ user.setUserName(seatApplyMessage.getAudienceName());
|
|
|
+ user.setUserId(seatApplyMessage.getAudienceId());
|
|
|
+ user.setPortrait(seatApplyMessage.getAudienceAvatar());
|
|
|
+ mRoomMicMemberHelper.delApplyUser(user);
|
|
|
+ updateMicManagerData();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onRemoteUserPublishResource(String remoteUserId) {
|
|
|
+ refreshAudio(null, null);
|
|
|
+ }
|
|
|
+
|
|
|
private void updateMicManagerData() {
|
|
|
if (mLiveMicManagerDialog != null) {
|
|
|
mLiveMicManagerDialog.setApplyListData(mRoomMicMemberHelper.getOnApplyMicUsers());
|
|
|
+ mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers());
|
|
|
}
|
|
|
if (mTvOnMicNumTip != null) {
|
|
|
ArrayList<User> onApplyMicUsers = mRoomMicMemberHelper.getOnApplyMicUsers();
|
|
@@ -1037,11 +1053,47 @@ public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLive
|
|
|
}
|
|
|
|
|
|
private void refresh() {
|
|
|
+ //video流信息
|
|
|
List<RCRTCVideoOutputStream> outputStreams = new ArrayList<>();
|
|
|
- List<RCRTCVideoInputStream> input = new ArrayList<>();
|
|
|
+ List<RCRTCVideoInputStream> videoInputStreams = new ArrayList<>();
|
|
|
+ //音频流信息
|
|
|
List<RCRTCAudioInputStream> audioinputstream = new ArrayList<>();
|
|
|
- presenter.getVideoStream(outputStreams, input, audioinputstream);
|
|
|
- updateVideoView(outputStreams, input, audioinputstream);
|
|
|
+ List<RCRTCAudioOutputStream> audioOutputStreams = new ArrayList<>();
|
|
|
+ presenter.getAllStreams(outputStreams, videoInputStreams, audioinputstream, audioOutputStreams);
|
|
|
+ updateVideoView(outputStreams, videoInputStreams, audioinputstream);
|
|
|
+ refreshAudio(audioinputstream, audioOutputStreams);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void refreshAudio(List<RCRTCAudioInputStream> audioInputStreams, List<RCRTCAudioOutputStream> audioOutputStreams) {
|
|
|
+ if (audioInputStreams == null || audioOutputStreams == null) {
|
|
|
+ //参数为空,先获取房间里的全部音频流信息
|
|
|
+ audioInputStreams = new ArrayList<>();
|
|
|
+ audioOutputStreams = new ArrayList<>();
|
|
|
+ presenter.getAudioStreams(audioInputStreams, audioOutputStreams);
|
|
|
+ }
|
|
|
+ mRoomMicMemberHelper.delAllOnMicUser();
|
|
|
+ //远端用户的音频流信息
|
|
|
+ for (int i = 0; i < audioInputStreams.size(); i++) {
|
|
|
+ RCRTCAudioInputStream rcrtcAudioInputStream = audioInputStreams.get(i);
|
|
|
+ if (rcrtcAudioInputStream.getMediaType() == RCRTCMediaType.AUDIO) {
|
|
|
+ //音频流判断显示上麦用户
|
|
|
+ String userId = rcrtcAudioInputStream.getUserId();
|
|
|
+ if (mRoomInfoBean != null) {
|
|
|
+ if (!TextUtils.equals(mRoomInfoBean.speakerId, userId)) {
|
|
|
+ User user = new User();
|
|
|
+ user.setUserId(userId);
|
|
|
+ mRoomMicMemberHelper.addOnMicUser(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ updateMicManagerData();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public void updateVideoView(List<RCRTCVideoOutputStream> outputStreams, List<RCRTCVideoInputStream> inputStreams, List<RCRTCAudioInputStream> audioInputStreams) {
|
|
@@ -1179,6 +1231,16 @@ public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLive
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void onUnderMic(User user) {
|
|
|
+ //下麦
|
|
|
+ presenter.handleAction(LiveRoomMsgConstants.MIC_ACTION_CANCEL_SEAT_BY_CREATE, user);
|
|
|
+ if (mRoomMicMemberHelper != null) {
|
|
|
+ mRoomMicMemberHelper.delOnMicUser(user);
|
|
|
+ }
|
|
|
+ updateMicManagerData();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void onRefuseAllMicApply() {
|
|
|
if (mRoomMicMemberHelper != null) {
|
|
|
mRoomMicMemberHelper.delAllApplyUser();
|
|
@@ -1196,6 +1258,7 @@ public class TeacherLiveRoomActivity extends BaseMVPActivity<ActivityTeacherLive
|
|
|
mLiveMicManagerDialog.show();
|
|
|
}
|
|
|
mLiveMicManagerDialog.setApplyListData(mRoomMicMemberHelper.getOnApplyMicUsers());
|
|
|
+ mLiveMicManagerDialog.setOnMicListData(mRoomMicMemberHelper.getOnMicUsers()
|
|
|
}
|
|
|
|
|
|
private void showBeautyOptionsDialog() {
|