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);