新增主播关播时,用户端调用离开房间
This commit is contained in:
parent
7ca8694aed
commit
d1edf6bdd8
@ -47,6 +47,10 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import io.rong.imlib.IRongCoreCallback;
|
||||||
|
import io.rong.imlib.IRongCoreEnum;
|
||||||
|
import io.rong.imlib.chatroom.base.RongChatRoomClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2018/10/9.
|
* Created by cxf on 2018/10/9.
|
||||||
*/
|
*/
|
||||||
@ -66,10 +70,13 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
|
|||||||
private RecyclerView likeList;
|
private RecyclerView likeList;
|
||||||
private SearchRecommendBodyAdapter adapter;
|
private SearchRecommendBodyAdapter adapter;
|
||||||
private IMLoginModel model = null;
|
private IMLoginModel model = null;
|
||||||
|
private String live_id;
|
||||||
|
private String leaveStream, leaveGroupId;
|
||||||
|
|
||||||
public LiveEndViewHolder(Context context, ViewGroup parentView, String uid) {
|
public LiveEndViewHolder(Context context, ViewGroup parentView, String uid) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
model = IMLoginManager.get(mContext).getUserInfo();
|
model = IMLoginManager.get(mContext).getUserInfo();
|
||||||
|
this.live_id = uid;
|
||||||
if (TextUtils.equals(model.getId() + "", uid)) {
|
if (TextUtils.equals(model.getId() + "", uid)) {
|
||||||
type = LiveOfType.ANCHOR;
|
type = LiveOfType.ANCHOR;
|
||||||
} else {
|
} else {
|
||||||
@ -77,6 +84,14 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLeaveStream(String leaveStream) {
|
||||||
|
this.leaveStream = leaveStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeaveGroupId(String leaveGroupId) {
|
||||||
|
this.leaveGroupId = leaveGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.view_live_end;
|
return R.layout.view_live_end;
|
||||||
@ -91,6 +106,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
|
|||||||
if (type == LiveOfType.USER) {
|
if (type == LiveOfType.USER) {
|
||||||
initViewOfUser();
|
initViewOfUser();
|
||||||
initDataOfUser();
|
initDataOfUser();
|
||||||
|
endLive();
|
||||||
anchorLiveEnd.setVisibility(View.GONE);
|
anchorLiveEnd.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
userLiveEnd.setVisibility(View.GONE);
|
userLiveEnd.setVisibility(View.GONE);
|
||||||
@ -99,6 +115,58 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void endLive() {
|
||||||
|
|
||||||
|
|
||||||
|
RongChatRoomClient.getInstance().quitChatRoom("g" + live_id, new IRongCoreCallback.OperationCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
try {
|
||||||
|
Log.i("tx", "退出成功" + live_id);
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.leaveRoomNew(leaveStream, leaveGroupId, new com.yunbao.common.http.base.HttpCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
leaveStream = "";
|
||||||
|
leaveGroupId = "";
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
Log.i("tx", "退出成功" + live_id);
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.leaveRoomNew(leaveStream, leaveGroupId, new com.yunbao.common.http.base.HttpCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
leaveStream = "";
|
||||||
|
leaveGroupId = "";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载用户猜你喜欢数据
|
* 加载用户猜你喜欢数据
|
||||||
*/
|
*/
|
||||||
|
@ -1271,11 +1271,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
||||||
if (playbackState == Player.STATE_BUFFERING) {
|
if (playbackState == Player.STATE_BUFFERING) {
|
||||||
//showLoadingDialog();
|
//showLoadingDialog();
|
||||||
//mLoading.setVisibility(View.VISIBLE);
|
mLoading.setVisibility(View.VISIBLE);
|
||||||
OkDownload.getInstance().pauseAll();
|
OkDownload.getInstance().pauseAll();
|
||||||
Log.i(TAG, "onPlaybackStateChanged: 缓存中");
|
Log.i(TAG, "onPlaybackStateChanged: 缓存中");
|
||||||
} else {
|
} else {
|
||||||
//mLoading.setVisibility(View.INVISIBLE);
|
mLoading.setVisibility(View.INVISIBLE);
|
||||||
Log.i(TAG, "onPlaybackStateChanged: 播放中");
|
Log.i(TAG, "onPlaybackStateChanged: 播放中");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1285,6 +1285,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
if (mLiveEndViewHolder == null) {
|
if (mLiveEndViewHolder == null) {
|
||||||
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mSecondPage, mLiveBean.getUid());
|
mLiveEndViewHolder = new LiveEndViewHolder(mContext, mSecondPage, mLiveBean.getUid());
|
||||||
|
mLiveEndViewHolder.setLeaveGroupId(leaveGroupId);
|
||||||
|
mLiveEndViewHolder.setLeaveStream(leaveStream);
|
||||||
mLiveEndViewHolder.subscribeActivityLifeCycle();
|
mLiveEndViewHolder.subscribeActivityLifeCycle();
|
||||||
mLiveEndViewHolder.addToParent();
|
mLiveEndViewHolder.addToParent();
|
||||||
Bus.get().post(new LiveGiftDialogEvent());
|
Bus.get().post(new LiveGiftDialogEvent());
|
||||||
|
Loading…
Reference in New Issue
Block a user