调整视频播放器3
This commit is contained in:
@@ -5,6 +5,8 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.DefaultLoadControl;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
@@ -15,8 +17,6 @@ import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
import com.google.android.exoplayer2.ui.StyledPlayerView;
|
||||
import com.google.android.exoplayer2.video.VideoSize;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* 直播间播放器管理器
|
||||
* 通过预加载子播放器来实现无缝切换分辨率功能
|
||||
@@ -65,7 +65,7 @@ public class LiveExoPlayerManager {
|
||||
}
|
||||
|
||||
public void setViewResizeMode(boolean isPhone) {
|
||||
Log.i(TAG, "setViewResizeMode: "+isPhone);
|
||||
Log.i(TAG, "setViewResizeMode: " + isPhone);
|
||||
mainView.setResizeMode(isPhone ? AspectRatioFrameLayout.RESIZE_MODE_ZOOM : AspectRatioFrameLayout.RESIZE_MODE_FIT);
|
||||
mainView.requestLayout();
|
||||
}
|
||||
@@ -262,6 +262,7 @@ public class LiveExoPlayerManager {
|
||||
playBufferIndex = 0;
|
||||
isSwitchUrl = true;
|
||||
log_buffer_time = System.currentTimeMillis();
|
||||
mainView.setKeepContentOnPlayerReset(true);
|
||||
getNextPlayer().setMediaItem(createMediaItem(url));
|
||||
getNextPlayer().prepare();
|
||||
}
|
||||
@@ -305,6 +306,10 @@ public class LiveExoPlayerManager {
|
||||
getNowPlayer().play();
|
||||
}
|
||||
|
||||
public void clearFrame() {
|
||||
//mainView.setKeepContentOnPlayerReset(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放播放器
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user