修复直播间观众端视频变形问题

This commit is contained in:
zlzw 2023-01-05 14:13:56 +08:00
parent 289c93d824
commit 16d02c6936

View File

@ -1,5 +1,7 @@
package com.yunbao.live.utils; package com.yunbao.live.utils;
import static com.google.android.exoplayer2.C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -10,8 +12,6 @@ import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.analytics.PlaybackStats;
import com.google.android.exoplayer2.analytics.PlaybackStatsListener;
import com.google.android.exoplayer2.video.VideoSize; import com.google.android.exoplayer2.video.VideoSize;
/** /**
@ -35,6 +35,8 @@ public class LiveExoPlayerManager {
this.mContext = mContext; this.mContext = mContext;
player1 = new ExoPlayer.Builder(mContext).build(); player1 = new ExoPlayer.Builder(mContext).build();
player2 = new ExoPlayer.Builder(mContext).build(); player2 = new ExoPlayer.Builder(mContext).build();
player1.setVideoScalingMode(VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
player2.setVideoScalingMode(VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
handler = new Handler(Looper.getMainLooper()); handler = new Handler(Looper.getMainLooper());
setListener(); setListener();
setAnalyticsListener(); setAnalyticsListener();