主播端不关闭连麦直接下播导致的问题。修复,用户端因为主播下播没关连麦导致的连麦状态不对的修复

This commit is contained in:
18401019693
2023-11-01 18:09:55 +08:00
parent 21473b1d69
commit d7bc2615d6
12 changed files with 126 additions and 40 deletions

View File

@@ -131,7 +131,9 @@ import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by cxf on 2018/10/10.
@@ -1629,10 +1631,12 @@ public class LiveAudienceActivity extends LiveActivity {
private List<AnchorRecommendItemModel> list = new ArrayList<>();
private void getDrawer() {
Map<String, Object> map = new HashMap<>();
map.put("num", "9");
map.put("live_recommend", "sidebar");
//推荐位
MainNetManager.get(mContext)
.anchorRecommend("9", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
list.clear();

View File

@@ -433,8 +433,11 @@ public class LiveExoPlayerManager {
isSwitchUrl = true;
log_buffer_time = System.currentTimeMillis();
mainView.setKeepContentOnPlayerReset(true);
getNextPlayer().setMediaItem(createMediaItem(url));
getNextPlayer().prepare();
if (getNextPlayer() != null) {
getNextPlayer().setMediaItem(createMediaItem(url));
getNextPlayer().prepare();
}
}
private MediaItem createMediaItem(String url) {
@@ -445,7 +448,12 @@ public class LiveExoPlayerManager {
* 获取当前播放器
*/
public ExoPlayer getNowPlayer() {
return status == MODEL_PLAY1 ? player1 : player2;
if (player1 == null && player2 == null) {
return null;
} else {
return status == MODEL_PLAY1 ? player1 : player2;
}
}
/**
@@ -486,7 +494,10 @@ public class LiveExoPlayerManager {
* 开始播放
*/
public void play() {
getNowPlayer().play();
if (getNowPlayer() != null) {
getNowPlayer().play();
}
}
public void replay() {

View File

@@ -48,6 +48,9 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.HashMap;
import java.util.Map;
import io.rong.imlib.IRongCoreCallback;
import io.rong.imlib.IRongCoreEnum;
import io.rong.imlib.chatroom.base.RongChatRoomClient;
@@ -172,8 +175,11 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
* 加载用户猜你喜欢数据
*/
private void initDataOfUser() {
Map<String, Object> map = new HashMap<>();
map.put("num", "3");
map.put("live_recommend", "sidebar");
MainNetManager.get((Activity) mContext)
.anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
if (((Activity) mContext).isFinishing()) return;

View File

@@ -773,22 +773,26 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
Log.e("ry", "退出多人房间成功");
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
mPlayer.play();
Log.e("ry", mPlayer.isPlaying() + "purl" + purl);
if (!mPlayer.isPlaying()) {
mPlayer.switchUrl(purl);
}
ry_view.removeAllViews();
ry_view.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
onPrepared();
rcrtcRoom = null;
MicStatusManager.getInstance().clear();
if (WordUtil.isNewZh()) {
ToastUtil.show("已成功退出語音連麥");
} else {
ToastUtil.show("You have successfully exited the voice connection");
}
resumePlay();
if (mPlayer.getNowPlayer() != null) {
mPlayer.play();
Log.e("ry", mPlayer.isPlaying() + "purl" + purl);
if (!mPlayer.isPlaying()) {
mPlayer.switchUrl(purl);
}
ry_view.removeAllViews();
ry_view.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
onPrepared();
rcrtcRoom = null;
MicStatusManager.getInstance().clear();
resumePlay();
}
if (onMicCallback != null) {
onMicCallback.onMikUpdate();
}

View File

@@ -1303,6 +1303,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override
public void onLiveEnd() {
MicStatusManager.getInstance().clear();
endPlay();
if (!CommonAppConfig.LIVE_ROOM_SCROLL) {
if (mViewPager != null) {
@@ -1758,6 +1759,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
* 结束观看
*/
public void endPlay() {
CommonAppContext.Ingroup = 0;
if (mEnd) {
return;