From 494aa6b52d3ed253e6797a60ae23ebb1992f290c Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Sat, 7 Jan 2023 15:35:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E5=8F=98=E5=BD=A2=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 | 7 ++++++- .../java/com/yunbao/live/views/PortraitLiveManager.java | 2 +- 2 files changed, 7 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 ae4887ba7..d1536b002 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveExoPlayerManager.java @@ -7,6 +7,7 @@ import android.os.Handler; import android.os.Looper; import android.util.Log; +import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.Player; @@ -27,7 +28,7 @@ public class LiveExoPlayerManager { private int status = MODEL_PLAY1; private Player.Listener listener; private boolean isSwitchUrl = false;//是否为主动切换播放器 - private String TAG = "播放"; + private String TAG = "播放器"; private int playBufferIndex = 0;//卡顿计数器 private Handler handler; @@ -35,6 +36,8 @@ public class LiveExoPlayerManager { this.mContext = mContext; player1 = new ExoPlayer.Builder(mContext).build(); player2 = new ExoPlayer.Builder(mContext).build(); + player1.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING); + player2.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING); handler = new Handler(Looper.getMainLooper()); setListener(); setAnalyticsListener(); @@ -132,6 +135,7 @@ public class LiveExoPlayerManager { @Override public void onVideoSizeChanged(VideoSize videoSize) { Player.Listener.super.onVideoSizeChanged(videoSize); + Log.i(TAG, "onVideoSizeChanged: width = " + videoSize.width + " height = " + videoSize.height); if (listener != null) { listener.onVideoSizeChanged(videoSize); } @@ -202,6 +206,7 @@ public class LiveExoPlayerManager { * @param url 地址 */ public void startUrl(String url) { + Log.i(TAG, "startUrl: "+url); isSwitchUrl = true; playBufferIndex = 0; //getNowPlayer().setVideoSurfaceView(mainView); 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 086d842a8..1fee9e961 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -357,7 +357,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe landscape = data.getLiveInfo().getLandscape(); mLivePlayViewHolder.setLiveBeanLandscape(landscape); mLivePlayViewHolder.setLiveEnterRoomNewModel(data); - mLivePlayViewHolder.switchStream(mLiveBean.getPull(), (data.getClarityType() - 1) == 2 ? 1 : (data.getClarityType() - 1)); + //mLivePlayViewHolder.switchStream(mLiveBean.getPull(), (data.getClarityType() - 1) == 2 ? 1 : (data.getClarityType() - 1)); //是否热度卡加成 liveHandler.postDelayed(() -> mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard()), 700);