直播间闪烁问题

This commit is contained in:
18401019693 2022-11-30 17:37:20 +08:00
parent 9a1cefdb70
commit 70b05b85d7
21 changed files with 84 additions and 20 deletions

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/loading_00000"
android:duration="100" />
<item
android:drawable="@drawable/loading_00001"
android:duration="100" />
<item
android:drawable="@drawable/loading_00002"
android:duration="100" />
<item
android:drawable="@drawable/loading_00003"
android:duration="100" />
<item
android:drawable="@drawable/loading_00004"
android:duration="100" />
<item
android:drawable="@drawable/loading_00005"
android:duration="100" />
<item
android:drawable="@drawable/loading_00006"
android:duration="100" />
<item
android:drawable="@drawable/loading_00007"
android:duration="100" />
<item
android:drawable="@drawable/loading_00008"
android:duration="100" />
<item
android:drawable="@drawable/loading_00009"
android:duration="100" />
<item
android:drawable="@drawable/loading_00010"
android:duration="100" />
<item
android:drawable="@drawable/loading_00011"
android:duration="100" />
<item
android:drawable="@drawable/loading_00012"
android:duration="100" />
<item
android:drawable="@drawable/loading_00013"
android:duration="100" />
<item
android:drawable="@drawable/loading_00014"
android:duration="100" />
<item
android:drawable="@drawable/loading_00015"
android:duration="100" />
</animation-list>

View File

@ -55,7 +55,6 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter
ImageView ivLoading = view.findViewById(R.id.iv_loading); ImageView ivLoading = view.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start(); frameAnimation.start();
// ImgLoader.displayGif(mContext, R.drawable.live_loading, ivLoading);
view.setId(position); view.setId(position);
container.addView(view); container.addView(view);
return view; return view;
@ -63,6 +62,7 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter
@Override @Override
public void destroyItem(ViewGroup container, int position, Object object) { public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(container.findViewById(position));
// container.removeView(container.findViewById(position));
} }
} }

View File

@ -32,6 +32,7 @@ import com.tencent.live2.V2TXLivePlayer;
import com.tencent.live2.V2TXLivePlayerObserver; import com.tencent.live2.V2TXLivePlayerObserver;
import com.tencent.live2.impl.V2TXLivePlayerImpl; import com.tencent.live2.impl.V2TXLivePlayerImpl;
import com.tencent.rtmp.ui.TXCloudVideoView; import com.tencent.rtmp.ui.TXCloudVideoView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
@ -164,13 +165,14 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
public void hideCover() { public void hideCover() {
// if (mCover != null) { // if (mCover != null) {
// if (mCover.getVisibility()==View.VISIBLE){ // if (mCover.getVisibility()==View.VISIBLE){
// new Handler().postDelayed(new Runnable() { //// new Handler().postDelayed(new Runnable() {
// @Override //// @Override
// public void run() { //// public void run() {
// mCover.setVisibility(View.GONE); ////
// mLoading2.setVisibility(View.GONE); //// }
// } //// },200);
// },200); // mCover.setVisibility(View.GONE);
// mLoading2.setVisibility(View.GONE);
// } // }
// //
// //

View File

@ -6,6 +6,7 @@ import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.drawable.AnimationDrawable;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
@ -59,7 +60,6 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum; import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.weight.LiveFloatView; import com.yunbao.common.views.weight.LiveFloatView;
import com.yunbao.common.views.weight.LiveLoadingViewHolder;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
@ -125,7 +125,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private ImageView btnSmallScreen; private ImageView btnSmallScreen;
private Intent mIntent; private Intent mIntent;
//直播间背景 //直播间背景
private ImageView liveBack; private ImageView liveBack, ivBg, ivLoading;
private View mask; private View mask;
//侧滑布局 //侧滑布局
@ -183,6 +183,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
private boolean isEnterRoom = false; private boolean isEnterRoom = false;
private boolean kick = false; private boolean kick = false;
private View loading;
public PortraitLiveManager setQuitF(boolean quitF) { public PortraitLiveManager setQuitF(boolean quitF) {
isQuitF = quitF; isQuitF = quitF;
return this; return this;
@ -204,6 +206,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
playContainer = mRootContainer.findViewById(R.id.play_container); playContainer = mRootContainer.findViewById(R.id.play_container);
mViewPager = mRootContainer.findViewById(R.id.viewPager); mViewPager = mRootContainer.findViewById(R.id.viewPager);
btnSmallScreen = mRootContainer.findViewById(R.id.btn_small_screen); btnSmallScreen = mRootContainer.findViewById(R.id.btn_small_screen);
loading = mRootContainer.findViewById(R.id.loading);
ivBg = mRootContainer.findViewById(R.id.iv_bg);
ivLoading = mRootContainer.findViewById(R.id.iv_loading);
mSecondPage = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.view_audience_page, mViewPager, false); mSecondPage = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.view_audience_page, mViewPager, false);
mContainerWrap = mSecondPage.findViewById(R.id.container_wrap); mContainerWrap = mSecondPage.findViewById(R.id.container_wrap);
mContainer = mSecondPage.findViewById(R.id.container); mContainer = mSecondPage.findViewById(R.id.container);
@ -253,6 +258,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
.setParametersModel(openParametersModel .setParametersModel(openParametersModel
.setmLiveType(mLiveType) .setmLiveType(mLiveType)
.setmLiveTypeVal(mLiveTypeVal))); .setmLiveTypeVal(mLiveTypeVal)));
loading.setVisibility(View.VISIBLE);
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), ivBg);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start();
if (mLivePlayViewHolder == null) { if (mLivePlayViewHolder == null) {
mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1); mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, 1);
mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager()); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager());
@ -279,8 +288,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
LivePlayRyViewHolder.leave.setVisibility(View.GONE); LivePlayRyViewHolder.leave.setVisibility(View.GONE);
} }
//直播间背景 //直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600); ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
mask.setVisibility(View.VISIBLE); mask.setVisibility(View.VISIBLE);
mLivePlayViewHolder.setLiveBean(mLiveBean); mLivePlayViewHolder.setLiveBean(mLiveBean);
mLivePlayViewHolder.setCover(mLiveBean.getAvatar()); mLivePlayViewHolder.setCover(mLiveBean.getAvatar());
@ -333,12 +343,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
public void onSuccess(EnterRoomNewModel data) { public void onSuccess(EnterRoomNewModel data) {
mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape()); mLivePlayViewHolder.setLiveBeanLandscape(data.getLiveInfo().getLandscape());
//是否热度卡加成 //是否热度卡加成
liveHandler.postDelayed(new Runnable() { liveHandler.postDelayed(() -> mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard()), 700);
@Override
public void run() {
mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard());
}
}, 700);
isEnterRoom = true; isEnterRoom = true;
//延时1秒发送 //延时1秒发送
@ -547,6 +552,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel)); mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
} }
} }
liveHandler.postDelayed(() -> loading.setVisibility(View.GONE),700);
} }
@ -874,7 +880,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
@Override @Override
public void onCancel() { public void onCancel() {
// ((LiveAudienceActivity) mContext).setEnableScroll(true); // ((LiveAudienceActivity) mContext).setEnableScroll(true);
} }
}); });

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.yunbao.common.views.weight.MyDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.yunbao.common.views.weight.MyDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -53,6 +52,9 @@
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout> </FrameLayout>
<include
android:id="@+id/loading"
layout="@layout/layout_portrait_live_item" />
</com.yunbao.common.views.weight.MyDrawerLayout> </com.yunbao.common.views.weight.MyDrawerLayout>