From 1bbab7ac9e960537e7a4c35849115076267bfb5f Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 14 Jan 2023 13:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BB=91=E5=8A=A8=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E5=88=B0=E5=90=8C=E4=B8=80=E4=B8=AA=E4=B8=BB?= =?UTF-8?q?=E6=92=AD=E6=97=B6=EF=BC=8C=E4=BC=9A=E9=BB=91=E5=B1=8F=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/live/utils/LiveExoPlayerManager.java | 9 +++++++-- .../java/com/yunbao/live/views/LivePlayRyViewHolder.java | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java index 8abbd82ab..d074070ee 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java @@ -40,9 +40,9 @@ public class LiveExoPlayerManager { public LiveExoPlayerManager(Context mContext) { DefaultLoadControl control = new DefaultLoadControl.Builder() .setPrioritizeTimeOverSizeThresholds(false) - .setBackBuffer(120_000, true) + .setBackBuffer(10_000, true) .setBufferDurationsMs(500, - 60_000, + 5_000, 150, 200) .build(); @@ -328,6 +328,7 @@ public class LiveExoPlayerManager { */ public void stop() { getNowPlayer().stop(); + clearUrl(); } /** @@ -355,9 +356,13 @@ public class LiveExoPlayerManager { * 释放播放器 */ public void release() { + Log.i(TAG, "release: 释放播放器"); player1.release(); player2.release(); } + public void clearUrl(){ + url=""; + } public String getUrl() { if (url == null) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index eb5c6102c..271bdc723 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -302,6 +302,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { } if (mPlayer.isPlaying()) { mPlayer.stop(); + mPlayer.clearUrl(); } mPlayer.startUrl(url); purl = url;