修复:直播准备页面切换摄像头可能失效问题
修复:直播准备页面美颜-美肤可能无效问题
This commit is contained in:
parent
1eee54fef1
commit
8eae2c29ae
@ -19,6 +19,7 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@ -57,6 +58,7 @@ import com.yunbao.common.utils.LogUtil;
|
|||||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.faceunity.FaceManager;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.bean.LiveGuardInfo;
|
import com.yunbao.live.bean.LiveGuardInfo;
|
||||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||||
@ -121,7 +123,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
|
|
||||||
private ViewGroup mRoot;
|
private ViewGroup mRoot;
|
||||||
private ViewGroup mContainerWrap;
|
private ViewGroup mContainerWrap;
|
||||||
public static LivePushRyViewHolder mLivePushViewHolder;
|
public LivePushRyViewHolder mLivePushViewHolder;
|
||||||
public LiveNewReadyRyViewHolder mLiveReadyViewHolder;
|
public LiveNewReadyRyViewHolder mLiveReadyViewHolder;
|
||||||
public static LiveRyAnchorViewHolder mLiveAnchorViewHolder;
|
public static LiveRyAnchorViewHolder mLiveAnchorViewHolder;
|
||||||
private LiveMusicViewHolder mLiveMusicViewHolder;
|
private LiveMusicViewHolder mLiveMusicViewHolder;
|
||||||
@ -139,6 +141,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
public static boolean PKing = false;
|
public static boolean PKing = false;
|
||||||
public static int pk_nub;
|
public static int pk_nub;
|
||||||
public static int backIndex = 0;//0=未判断,1=已判断
|
public static int backIndex = 0;//0=未判断,1=已判断
|
||||||
|
private FaceManager manager;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -151,6 +154,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
super.main();
|
super.main();
|
||||||
Bus.getOn(this);
|
Bus.getOn(this);
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
initFaceManager();
|
||||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||||
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
||||||
L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云"));
|
L.e(TAG, "直播sdk----->" + (mLiveSDK == Constants.LIVE_SDK_KSY ? "金山云" : "腾讯云"));
|
||||||
@ -177,8 +181,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
mContainer = (ViewGroup) findViewById(R.id.container);
|
mContainer = (ViewGroup) findViewById(R.id.container);
|
||||||
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
|
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, mContainer);
|
||||||
|
|
||||||
|
|
||||||
//添加开播前设置控件
|
//添加开播前设置控件
|
||||||
mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK);
|
mLiveReadyViewHolder = new LiveNewReadyRyViewHolder(mContext, mContainer, mLiveSDK);
|
||||||
|
mLiveReadyViewHolder.setManager(manager);
|
||||||
mLiveReadyViewHolder.addToParent();
|
mLiveReadyViewHolder.addToParent();
|
||||||
mLiveReadyViewHolder.subscribeActivityLifeCycle();
|
mLiveReadyViewHolder.subscribeActivityLifeCycle();
|
||||||
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
|
mLiveLinkMicPresenter = new LiveLinkMicPresenter(mContext, mLivePushViewHolder, true, mLiveSDK, mContainer);
|
||||||
@ -208,6 +214,12 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initFaceManager() {
|
||||||
|
manager = new FaceManager();
|
||||||
|
manager.initFURender(mContext);
|
||||||
|
manager.drawRongFrame(mContext);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isStartPreview() {
|
public boolean isStartPreview() {
|
||||||
return mStartPreview;
|
return mStartPreview;
|
||||||
}
|
}
|
||||||
@ -584,6 +596,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
mLiveReadyViewHolder = null;
|
mLiveReadyViewHolder = null;
|
||||||
if (mLiveRoomViewHolder == null) {
|
if (mLiveRoomViewHolder == null) {
|
||||||
mLiveRoomViewHolder = new LiveRoomViewHolder(true, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager());
|
mLiveRoomViewHolder = new LiveRoomViewHolder(true, 2, mContext, mContainer, (GifImageView) findViewById(R.id.gift_gif), (SVGAImageView) findViewById(R.id.gift_svga), mContainerWrap, getWindowManager());
|
||||||
|
mLiveRoomViewHolder.setManager(manager);
|
||||||
mLiveRoomViewHolder.addToParent();
|
mLiveRoomViewHolder.addToParent();
|
||||||
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
mLiveRoomViewHolder.subscribeActivityLifeCycle();
|
||||||
mLiveRoomViewHolder.setLiveInfo(mLiveUid, mStream, obj.getIntValue("userlist_time") * 1000);
|
mLiveRoomViewHolder.setLiveInfo(mLiveUid, mStream, obj.getIntValue("userlist_time") * 1000);
|
||||||
@ -609,6 +622,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
}
|
}
|
||||||
mLiveBottomViewHolder = mLiveAnchorViewHolder;
|
mLiveBottomViewHolder = mLiveAnchorViewHolder;
|
||||||
mSocketRyClient = new SocketRyClient(mLiveUid, this);
|
mSocketRyClient = new SocketRyClient(mLiveUid, this);
|
||||||
|
mSocketRyClient.setLivePushRyViewHolder(mLivePushViewHolder);
|
||||||
CommonAppContext.Ingroup = 1;
|
CommonAppContext.Ingroup = 1;
|
||||||
|
|
||||||
if (mLiveLinkMicPresenter != null) {
|
if (mLiveLinkMicPresenter != null) {
|
||||||
@ -837,9 +851,21 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
}
|
}
|
||||||
super.release();
|
super.release();
|
||||||
}
|
}
|
||||||
|
private boolean isKeyBack=false;
|
||||||
|
@Override
|
||||||
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
|
if(keyCode==KeyEvent.KEYCODE_BACK){
|
||||||
|
isKeyBack=true;
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
return super.onKeyUp(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
if (manager != null) {
|
||||||
|
manager.release();
|
||||||
|
}
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.ANCHOR_CHECK_LIVE);
|
LiveHttpUtil.cancel(LiveHttpConsts.ANCHOR_CHECK_LIVE);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
if (mLivePushViewHolder != null) {
|
if (mLivePushViewHolder != null) {
|
||||||
@ -865,7 +891,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
|||||||
mLiveRoomViewHolder.anchorPause();
|
mLiveRoomViewHolder.anchorPause();
|
||||||
}
|
}
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
if(isKeyBack) {
|
||||||
sendSystemMessage(WordUtil.getString(R.string.live_anchor_leave));
|
sendSystemMessage(WordUtil.getString(R.string.live_anchor_leave));
|
||||||
|
}
|
||||||
mPaused = true;
|
mPaused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,20 +43,11 @@ public class LiveFunctionAdapter extends RecyclerView.Adapter<LiveFunctionAdapte
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (LiveRyAnchorActivity.mLivePushViewHolder != null) {
|
|
||||||
//LiveRyAnchorActivity.leave
|
|
||||||
if (leave == 0) {
|
if (leave == 0) {
|
||||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk));
|
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk));
|
||||||
} else {
|
} else {
|
||||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave_p, R.string.live_zslk1));
|
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave_p, R.string.live_zslk1));
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
if(leave == 0) {
|
|
||||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk));
|
|
||||||
}else{
|
|
||||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave_p, R.string.live_zslk1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_WISHLIST, R.mipmap.icon_xinyuandan, R.string.live_wishlist));
|
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_WISHLIST, R.mipmap.icon_xinyuandan, R.string.live_wishlist));
|
||||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZG, R.mipmap.icon_zhenggu, R.string.live_zg));
|
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZG, R.mipmap.icon_zhenggu, R.string.live_zg));
|
||||||
|
@ -90,6 +90,12 @@ public class SocketRyClient {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLivePushRyViewHolder(LivePushRyViewHolder livePushRyViewHolder) {
|
||||||
|
if (mSocketHandler != null) {
|
||||||
|
mSocketHandler.setLivePushRyViewHolder(livePushRyViewHolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void disConnect() {
|
public void disConnect() {
|
||||||
// V2TIMManager.getInstance().
|
// V2TIMManager.getInstance().
|
||||||
mLiveUid = null;
|
mLiveUid = null;
|
||||||
@ -100,6 +106,7 @@ public class SocketRyClient {
|
|||||||
public static class SocketHandler extends Handler {
|
public static class SocketHandler extends Handler {
|
||||||
|
|
||||||
private static SocketMessageListener mListener;
|
private static SocketMessageListener mListener;
|
||||||
|
private LivePushRyViewHolder livePushRyViewHolder;
|
||||||
private static String mLiveUid;
|
private static String mLiveUid;
|
||||||
|
|
||||||
public SocketHandler(SocketMessageListener listener) {
|
public SocketHandler(SocketMessageListener listener) {
|
||||||
@ -108,7 +115,10 @@ public class SocketRyClient {
|
|||||||
|
|
||||||
public void setLiveUid(String liveUid) {
|
public void setLiveUid(String liveUid) {
|
||||||
mLiveUid = liveUid;
|
mLiveUid = liveUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLivePushRyViewHolder(LivePushRyViewHolder livePushRyViewHolder) {
|
||||||
|
this.livePushRyViewHolder = livePushRyViewHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -246,7 +256,7 @@ public class SocketRyClient {
|
|||||||
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
|
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
|
||||||
}
|
}
|
||||||
LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time"));
|
LiveRoomViewHolder.UpPkBar(map.getJSONArray("userlist"), mLiveUid, map.getIntValue("drpk_time"));
|
||||||
if (LiveRyAnchorActivity.mLivePushViewHolder == null) {
|
if (livePushRyViewHolder == null) {
|
||||||
LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
|
LiveAudienceActivity.getmLivePlayViewHolder().setPkview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
findViewById(R.id.btn_start_live).setOnClickListener(this);
|
findViewById(R.id.btn_start_live).setOnClickListener(this);
|
||||||
findViewById(R.id.btn_wishlist).setOnClickListener(this);
|
findViewById(R.id.btn_wishlist).setOnClickListener(this);
|
||||||
findViewById(R.id.btn_horizontally).setOnClickListener(this);
|
findViewById(R.id.btn_horizontally).setOnClickListener(this);
|
||||||
manager = new FaceManager();
|
if (manager != null) {
|
||||||
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
|
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
|
||||||
final Handler handler = new Handler(Looper.getMainLooper());
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
@ -179,11 +179,13 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//新美颜
|
//新美颜
|
||||||
manager.initFURender(mContext);
|
|
||||||
manager.drawRongFrame(mContext);
|
|
||||||
setFaceUnity(true);
|
setFaceUnity(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManager(FaceManager manager) {
|
||||||
|
this.manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -524,8 +526,5 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
LiveHttpUtil.cancel(LiveHttpConsts.CREATE_ROOM);
|
LiveHttpUtil.cancel(LiveHttpConsts.CREATE_ROOM);
|
||||||
if(manager!=null) {
|
|
||||||
manager.release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2857,20 +2857,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
mChatRecyclerView.setLayoutParams(params1);
|
mChatRecyclerView.setLayoutParams(params1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setManager(FaceManager manager) {
|
||||||
|
this.manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动美颜SDK
|
* 启动美颜SDK
|
||||||
*/
|
*/
|
||||||
public void startFace() {
|
public void startFace() {
|
||||||
manager = new FaceManager();
|
|
||||||
manager.setFaceStatusChanged(new FaceManager.FaceStatusChanged() {
|
|
||||||
@Override
|
|
||||||
public void onFaceChanged(int num) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
manager.initFURender(mContext);
|
|
||||||
manager.drawRongFrame(mContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 切换美颜UI
|
* 切换美颜UI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user