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

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

@ -24,7 +24,9 @@ import com.yunbao.common.views.RecommendViewHolder;
import com.yunbao.common.views.RigtsInterestsViewHolder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 新侧边栏适配器
@ -108,9 +110,13 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
recommendViewHolder.setListener(new RecommendViewHolder.RecommendViewListener() {
@Override
public void changeOneBatch() {
Map<String, Object> map = new HashMap<>();
map.put("num", "9");
map.put("live_recommend", "sidebar");
map.put("refresh", "1");
//推荐位
MainNetManager.get((Activity) 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) {

View File

@ -168,6 +168,11 @@ public interface PDLiveApi {
@Query("num") String num
);
@GET("/api/public/?service=Home.anchorRecommend")
Observable<ResponseModel<AnchorRecommendModel>> anchorRecommend(
@QueryMap Map<String, Object> map
);
/**
* 直播间上下滚动列表
*

View File

@ -14,7 +14,9 @@ import com.yunbao.common.http.ResponseData;
import com.yunbao.common.http.ResponseModel;
import com.yunbao.common.http.base.HttpCallback;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
@ -115,6 +117,22 @@ public class MainNetManager {
}).isDisposed();
}
public void anchorRecommend(Map<String, Object> map, HttpCallback<AnchorRecommendModel> httpCallback) {
API.get().pdLiveApi(mContext).anchorRecommend(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(anchorRecommendModelResponseModel -> {
if (httpCallback != null) {
AnchorRecommendModel model = anchorRecommendModelResponseModel.getData().getInfo();
httpCallback.onSuccess(model);
}
}, throwable -> {
if (httpCallback != null) {
httpCallback.onError(throwable.getMessage());
}
}).isDisposed();
}
/**
* 猜你喜欢
*
@ -122,7 +140,11 @@ public class MainNetManager {
* @return
*/
public void anchorRecommendType(String num, HttpCallback<AnchorRecommendModel> httpCallback) {
API.get().pdLiveApi(mContext).anchorRecommend(num, "1")
Map<String, Object> map = new HashMap<>();
map.put("num", num);
map.put("live_recommend", "slide");
map.put("type", "1");
API.get().pdLiveApi(mContext).anchorRecommend(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(anchorRecommendModelResponseModel -> {
@ -266,6 +288,7 @@ public class MainNetManager {
}
}).isDisposed();
}
/**
* 获取直播间上下滑动红包集合
*/

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;

View File

@ -135,6 +135,7 @@ import java.io.File;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@ -588,8 +589,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
*/
private synchronized void initAnchorRecommendBanner() {
if (!isfloatBannernet) return;
Map<String, Object> map = new HashMap<>();
map.put("num", "10");
map.put("live_recommend", "quick_look");
MainNetManager.get(mContext)
.anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@SuppressLint("SetTextI18n")
@Override
public void onSuccess(AnchorRecommendModel data) {

View File

@ -23,6 +23,7 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -65,9 +66,11 @@ public class SearchRecommendFragment extends BaseFragment {
searchRecommendModels.add(model.setHistoryRecordMap(historyRecordMap));
}
adapter.addData(searchRecommendModels);
Map<String, Object> map = new HashMap<>();
map.put("num", "10");
map.put("live_recommend", "search");
MainNetManager.get(getActivity())
.anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
if (getActivity().isFinishing()) return;

View File

@ -17,14 +17,16 @@ import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordsTypeUtil;
import com.yunbao.common.views.weight.OnRecyclerViewScrollListener;
import com.yunbao.main.R;
import com.yunbao.main.adapter.SearchRecommendBodyAdapter;
import com.yunbao.main.adapter.SearchResultsItemAdapter;
import com.yunbao.common.utils.WordsTypeUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 展示結果的分類頁面
@ -76,7 +78,7 @@ public class SearchResultsItemFragment extends BaseFragment {
searchList.addOnScrollListener(new OnRecyclerViewScrollListener() {
@Override
public void onBottom() {
if (type>1){
if (type > 1) {
page = page + 1;
setSearchKey(searchKey, type);
}
@ -93,8 +95,12 @@ public class SearchResultsItemFragment extends BaseFragment {
changeBatch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Map<String, Object> map = new HashMap<>();
map.put("num", "10");
map.put("live_recommend", "search");
map.put("refresh", "1");
MainNetManager.get(getActivity())
.anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
adapter.showData(data.getList());
@ -107,8 +113,11 @@ public class SearchResultsItemFragment extends BaseFragment {
});
}
});
Map<String, Object> map = new HashMap<>();
map.put("num", "10");
map.put("live_recommend", "search");
MainNetManager.get(getActivity())
.anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
adapter.showData(data.getList());
@ -117,7 +126,7 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override
public void onError(String error) {
ToastUtil.show( R.string.net_error);
ToastUtil.show(R.string.net_error);
}
});
}
@ -142,22 +151,24 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<List<SearchModel>>>() {
@Override
public void onSuccess(List<List<SearchModel>> data) {
if (getActivity()==null||getActivity().isFinishing()) return;
if (getActivity() == null || getActivity().isFinishing())
return;
if (data.get(0).size() == 0 && data.get(1).size() == 0) {
emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE);
} else {
itemAdapter.showData(data, type, searchKey);
searchList.setVisibility(View.VISIBLE);
}
if (data.get(0).size() == 0 && data.get(1).size() == 0) {
emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE);
} else {
itemAdapter.showData(data, type, searchKey);
searchList.setVisibility(View.VISIBLE);
}
}
@Override
public void onError(String error) {
if (getActivity()==null||getActivity().isFinishing()) return;
if (getActivity() == null || getActivity().isFinishing())
return;
emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE);
}
@ -169,7 +180,8 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<SearchModel>>() {
@Override
public void onSuccess(List<SearchModel> data) {
if (getActivity()==null||getActivity().isFinishing()) return;
if (getActivity() == null || getActivity().isFinishing())
return;
List<List<SearchModel>> listList = new ArrayList<>();
listList.add(data);
if (page > 1) {
@ -191,7 +203,8 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override
public void onError(String error) {
if (getActivity()==null||getActivity().isFinishing()) return;
if (getActivity() == null || getActivity().isFinishing())
return;
emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE);
}

View File

@ -21,6 +21,7 @@ import com.yunbao.main.R;
import com.yunbao.main.adapter.SearchRecommendBodyAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -43,8 +44,12 @@ public class SearchRecommendBodyViewHolder extends RecyclerView.ViewHolder {
@Override
public void onClick(View v) {
// Bus.get().post(new SearchRecommendEvent());
Map<String, Object> map = new HashMap<>();
map.put("num", "10");
map.put("live_recommend", "search");
map.put("refresh", "1");
MainNetManager.get((Activity) itemView.getContext())
.anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
.anchorRecommend(map, new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
showData(data.getList());