调整进直播间loading界面与播放器绑定,播放器准备完成后再隐藏。
优化播放器加载速度1
This commit is contained in:
parent
9fcc04cef2
commit
27bd65d3da
@ -106,7 +106,7 @@ public class LiveExoPlayerManager {
|
|||||||
Log.i(TAG, "onPlaybackStateChanged 1: " + playbackState);
|
Log.i(TAG, "onPlaybackStateChanged 1: " + playbackState);
|
||||||
if (playbackState == Player.STATE_READY) {
|
if (playbackState == Player.STATE_READY) {
|
||||||
player2.stop();
|
player2.stop();
|
||||||
player2.setVideoSurface(null);
|
player2.clearVideoSurface();
|
||||||
player1.play();
|
player1.play();
|
||||||
Log.i(TAG, "切换播放器1");
|
Log.i(TAG, "切换播放器1");
|
||||||
handler.removeCallbacks(buffRunnable);
|
handler.removeCallbacks(buffRunnable);
|
||||||
@ -159,7 +159,7 @@ public class LiveExoPlayerManager {
|
|||||||
Log.i(TAG, "onPlaybackStateChanged 2: " + playbackState);
|
Log.i(TAG, "onPlaybackStateChanged 2: " + playbackState);
|
||||||
if (playbackState == Player.STATE_READY) {
|
if (playbackState == Player.STATE_READY) {
|
||||||
player1.stop();
|
player1.stop();
|
||||||
player1.setVideoSurface(null);
|
player1.clearVideoSurface();
|
||||||
player2.play();
|
player2.play();
|
||||||
Log.i(TAG, "切换播放器2 " + player2.isPlaying());
|
Log.i(TAG, "切换播放器2 " + player2.isPlaying());
|
||||||
handler.removeCallbacks(buffRunnable);
|
handler.removeCallbacks(buffRunnable);
|
||||||
|
@ -1031,6 +1031,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoadViewListener(LoadingListener listener) {
|
||||||
|
super.setLoadViewListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
private void showLoadingDialog() {
|
private void showLoadingDialog() {
|
||||||
if (PLAY_MODEL == PLAY_MODEL_480) return;
|
if (PLAY_MODEL == PLAY_MODEL_480) return;
|
||||||
|
|
||||||
@ -1081,6 +1086,9 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
if (playbackState == Player.STATE_BUFFERING) {
|
if (playbackState == Player.STATE_BUFFERING) {
|
||||||
//showLoadingDialog();
|
//showLoadingDialog();
|
||||||
OkDownload.getInstance().pauseAll();
|
OkDownload.getInstance().pauseAll();
|
||||||
|
Log.i(TAG, "onPlaybackStateChanged: 缓存中");
|
||||||
|
}else{
|
||||||
|
Log.i(TAG, "onPlaybackStateChanged: 播放中");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1089,7 +1097,11 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
|||||||
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
hideCover();
|
hideCover();
|
||||||
|
Log.i(TAG, "onIsPlayingChanged: 开始播放");
|
||||||
OkDownload.getInstance().startAll();
|
OkDownload.getInstance().startAll();
|
||||||
|
if (loadingListener != null) {
|
||||||
|
loadingListener.onPlayer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
|
|||||||
public static final String[] videoFps = new String[]{"_24", "_30"};
|
public static final String[] videoFps = new String[]{"_24", "_30"};
|
||||||
OnMicCallback onMicCallback;//连麦回调
|
OnMicCallback onMicCallback;//连麦回调
|
||||||
public EnterRoomNewModel roomModel;
|
public EnterRoomNewModel roomModel;
|
||||||
|
LoadingListener loadingListener;
|
||||||
|
|
||||||
public LiveRoomPlayViewHolder(Context context, ViewGroup parentView) {
|
public LiveRoomPlayViewHolder(Context context, ViewGroup parentView) {
|
||||||
super(context, parentView);
|
super(context, parentView);
|
||||||
@ -62,7 +63,8 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
|
|||||||
this.mLiveBean = data;
|
this.mLiveBean = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewUP(int i){}
|
public void setViewUP(int i) {
|
||||||
|
}
|
||||||
|
|
||||||
public OnMicCallback getOnMicCallback() {
|
public OnMicCallback getOnMicCallback() {
|
||||||
return onMicCallback;
|
return onMicCallback;
|
||||||
@ -76,9 +78,17 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
|
|||||||
this.roomModel = data;
|
this.roomModel = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLoadViewListener(LoadingListener listener) {
|
||||||
|
this.loadingListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface OnMicCallback {
|
public interface OnMicCallback {
|
||||||
void onMikUpdate();
|
void onMikUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface LoadingListener {
|
||||||
|
void onPlayer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
|
||||||
mLivePlayViewHolder.addToParent();
|
mLivePlayViewHolder.addToParent();
|
||||||
mLivePlayViewHolder.subscribeActivityLifeCycle();
|
mLivePlayViewHolder.subscribeActivityLifeCycle();
|
||||||
|
mLivePlayViewHolder.setLoadViewListener(new LiveRoomPlayViewHolder.LoadingListener() {
|
||||||
|
@Override
|
||||||
|
public void onPlayer() {
|
||||||
|
loading.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
||||||
mLiveAudienceViewHolder.addToParent();
|
mLiveAudienceViewHolder.addToParent();
|
||||||
mLiveRoomViewHolder.addToParent();
|
mLiveRoomViewHolder.addToParent();
|
||||||
@ -358,7 +364,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);
|
||||||
|
|
||||||
@ -580,7 +586,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
liveHandler.postDelayed(() -> loading.setVisibility(View.GONE), 700);
|
//liveHandler.postDelayed(() -> loading.setVisibility(View.GONE), 700);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user