From e181fbf0d222952dd288030d136ceb9fc979b2da Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 31 Aug 2022 09:19:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=20=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E6=BB=91=E5=8A=A8=E5=AF=BC=E8=87=B4=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/live/activity/LiveAudienceActivity.java | 2 +- .../java/com/yunbao/live/views/PortraitLiveManager.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 9d4fd43ee..21090fdc9 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -257,7 +257,7 @@ public class LiveAudienceActivity extends LiveActivity { } } - + //获取直播间状态 private Runnable liveRunnable = new Runnable() { @Override public void run() { diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 0e067161e..9ea9e868c 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -83,7 +83,6 @@ import org.greenrobot.eventbus.EventBus; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.Executors; import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; @@ -166,6 +165,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private int liveBg = -1; private LiveImDeletUtil liveImDeletUtil; private List greetings = new ArrayList<>(); + private Handler liveHandler = new Handler(); public PortraitLiveManager(Activity context, Intent intent) { @@ -275,8 +275,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onRemove() { - endPlay(); - Executors.newCachedThreadPool().execute(() -> end()); + //子线程执行退出操作 + liveHandler.post(() -> exitLiveRoom()); + + if (mLiveAudienceViewHolder != null) { mLiveAudienceViewHolder.removeFromParent(); mLiveAudienceViewHolder.countDownTimerTrickery = null;