修复滑动直播间到同一个主播时,会黑屏的问题

This commit is contained in:
zlzw 2023-01-14 13:19:23 +08:00
parent 16592aaecb
commit 1bbab7ac9e
2 changed files with 8 additions and 2 deletions

View File

@ -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) {

View File

@ -302,6 +302,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
}
if (mPlayer.isPlaying()) {
mPlayer.stop();
mPlayer.clearUrl();
}
mPlayer.startUrl(url);
purl = url;