修复直播间画面变形问题
This commit is contained in:
parent
112bec58df
commit
494aa6b52d
@ -7,6 +7,7 @@ import android.os.Handler;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlayer;
|
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;
|
||||||
@ -27,7 +28,7 @@ public class LiveExoPlayerManager {
|
|||||||
private int status = MODEL_PLAY1;
|
private int status = MODEL_PLAY1;
|
||||||
private Player.Listener listener;
|
private Player.Listener listener;
|
||||||
private boolean isSwitchUrl = false;//是否为主动切换播放器
|
private boolean isSwitchUrl = false;//是否为主动切换播放器
|
||||||
private String TAG = "播放";
|
private String TAG = "播放器";
|
||||||
private int playBufferIndex = 0;//卡顿计数器
|
private int playBufferIndex = 0;//卡顿计数器
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
|
|
||||||
@ -35,6 +36,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(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());
|
handler = new Handler(Looper.getMainLooper());
|
||||||
setListener();
|
setListener();
|
||||||
setAnalyticsListener();
|
setAnalyticsListener();
|
||||||
@ -132,6 +135,7 @@ public class LiveExoPlayerManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||||
Player.Listener.super.onVideoSizeChanged(videoSize);
|
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||||
|
Log.i(TAG, "onVideoSizeChanged: width = " + videoSize.width + " height = " + videoSize.height);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onVideoSizeChanged(videoSize);
|
listener.onVideoSizeChanged(videoSize);
|
||||||
}
|
}
|
||||||
@ -202,6 +206,7 @@ public class LiveExoPlayerManager {
|
|||||||
* @param url 地址
|
* @param url 地址
|
||||||
*/
|
*/
|
||||||
public void startUrl(String url) {
|
public void startUrl(String url) {
|
||||||
|
Log.i(TAG, "startUrl: "+url);
|
||||||
isSwitchUrl = true;
|
isSwitchUrl = true;
|
||||||
playBufferIndex = 0;
|
playBufferIndex = 0;
|
||||||
//getNowPlayer().setVideoSurfaceView(mainView);
|
//getNowPlayer().setVideoSurfaceView(mainView);
|
||||||
|
@ -357,7 +357,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
landscape = data.getLiveInfo().getLandscape();
|
landscape = data.getLiveInfo().getLandscape();
|
||||||
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
|
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
|
||||||
mLivePlayViewHolder.setLiveEnterRoomNewModel(data);
|
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);
|
liveHandler.postDelayed(() -> mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard()), 700);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user