1、删除腾讯IM、腾讯播放器jar+so文件
2、注释+删除使用了腾讯SDK的地方
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
import static com.yunbao.live.views.LivePushTxViewHolder.mTRTCCloud;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -21,10 +17,6 @@ import com.lzy.okgo.model.Progress;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okgo.request.base.Request;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
@@ -292,7 +284,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
break;
|
||||
case Constants.LIVE_FUNC_MIRROR://鏡像
|
||||
|
||||
TRTCCloudDef.TRTCRenderParams t = new TRTCCloudDef.TRTCRenderParams();
|
||||
/* TRTCCloudDef.TRTCRenderParams t = new TRTCCloudDef.TRTCRenderParams();
|
||||
if (mrr == 0) {
|
||||
mrr = 1;
|
||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
@@ -300,7 +292,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
mrr = 0;
|
||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
}
|
||||
mTRTCCloud.setLocalRenderParams(t);
|
||||
mTRTCCloud.setLocalRenderParams(t);*/
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -569,7 +561,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
mSocketClient.disConnect();
|
||||
}
|
||||
|
||||
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
/* if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.stopLocalPreview();
|
||||
}
|
||||
@@ -579,7 +571,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
LivePushTxViewHolder.mTRTCCloud.stopLocalPreview();
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
if (mLivePushViewHolder != null) {
|
||||
mLivePushViewHolder.release();
|
||||
}
|
||||
@@ -638,9 +630,9 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
mLiveEndViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveEndViewHolder.addToParent();
|
||||
mLiveEndViewHolder.showData(mLiveBean, mStream);
|
||||
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
|
||||
}
|
||||
/* if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
// LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
|
||||
}*/
|
||||
|
||||
if (mLivePushViewHolder != null) {
|
||||
mLivePushViewHolder.release();
|
||||
@@ -863,7 +855,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
.param("pkname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("pkhead", CommonAppConfig.getInstance().getUserBean().getAvatar());
|
||||
msgs.create();
|
||||
V2TIMManager.getInstance().sendC2CTextMessage(msgs.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
/* V2TIMManager.getInstance().sendC2CTextMessage(msgs.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
@@ -880,7 +872,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
ToastUtil.show("发送失败,请重试");
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
} else {
|
||||
ToastUtil.show(getString(R.string.pking_over));
|
||||
}
|
||||
@@ -916,7 +908,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
.param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName())
|
||||
.param("uid", CommonAppConfig.getInstance().getUid());
|
||||
msgs.create();
|
||||
V2TIMManager.getInstance().sendC2CTextMessage(msgs.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
/* V2TIMManager.getInstance().sendC2CTextMessage(msgs.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
@@ -933,7 +925,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
|
||||
ToastUtil.show("发送失败,请重试");
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.pking_over));
|
||||
}
|
||||
|
||||
@@ -1,290 +0,0 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.NewLevelManager;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.dialog.LiveShareDialogFragment;
|
||||
import com.yunbao.live.presenter.UserHomeSharePresenter;
|
||||
import com.yunbao.live.views.LiveRecordPlayViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/29.
|
||||
*/
|
||||
|
||||
public class LiveRecordPlayActivity extends AbsActivity implements
|
||||
LiveRecordPlayViewHolder.ActionListener, View.OnClickListener, LiveShareDialogFragment.ActionListener {
|
||||
|
||||
private LiveRecordPlayViewHolder mLiveRecordPlayViewHolder;
|
||||
private ImageView mAvatar;
|
||||
private ImageView mLevelAnchor;
|
||||
private TextView mName;
|
||||
private TextView mID;
|
||||
private View mBtnFollow;
|
||||
private SeekBar mSeekBar;
|
||||
private long mDuration;
|
||||
private TextView mCurTimeTextView;
|
||||
private TextView mDurationTextView;
|
||||
private ImageView mBtnPlay;
|
||||
private UserBean mUserBean;
|
||||
private UserHomeSharePresenter mUserHomeSharePresenter;
|
||||
private boolean mPausePlay;
|
||||
|
||||
public static void forward(Context context, String url, UserBean userBean) {
|
||||
if (TextUtils.isEmpty(url) || userBean == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, LiveRecordPlayActivity.class);
|
||||
intent.putExtra(Constants.URL, url);
|
||||
intent.putExtra(Constants.USER_BEAN, userBean);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_live_record_play;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStatusBarWhite() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Intent intent = getIntent();
|
||||
mUserBean = intent.getParcelableExtra(Constants.USER_BEAN);
|
||||
if (mUserBean == null) {
|
||||
return;
|
||||
}
|
||||
String url = intent.getStringExtra(Constants.URL);
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return;
|
||||
}
|
||||
mAvatar = (ImageView) findViewById(R.id.avatar);
|
||||
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
|
||||
mName = (TextView) findViewById(R.id.name);
|
||||
mID = (TextView) findViewById(R.id.id_val);
|
||||
mBtnFollow = findViewById(R.id.btn_follow);
|
||||
ImgLoader.displayAvatar(mContext, mUserBean.getAvatar(), mAvatar);
|
||||
List<NewLevelModel> models = new NewLevelManager(mContext).getNewAnchorLevelModels();
|
||||
String imgUrl = "";
|
||||
for (NewLevelModel newLevelModel : models) {
|
||||
if (newLevelModel.getLeveMin() <= mUserBean.getLevelAnchor() && mUserBean.getLevelAnchor() <= newLevelModel.getLeveMax()) {
|
||||
imgUrl = newLevelModel.getIcon();
|
||||
}
|
||||
ImgLoader.display(mContext, imgUrl, mLevelAnchor);
|
||||
}
|
||||
mName.setText(mUserBean.getUserNiceName());
|
||||
mID.setText(mUserBean.getLiangNameTip());
|
||||
if (mUserBean instanceof SearchUserBean) {
|
||||
SearchUserBean searchUserBean = (SearchUserBean) mUserBean;
|
||||
int attention = searchUserBean.getAttention();
|
||||
if (attention == 0) {
|
||||
if (mBtnFollow.getVisibility() != View.VISIBLE) {
|
||||
mBtnFollow.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
mBtnFollow.setOnClickListener(this);
|
||||
}
|
||||
mUserHomeSharePresenter = new UserHomeSharePresenter(mContext);
|
||||
mUserHomeSharePresenter.setToUid(mUserBean.getId())
|
||||
.setToName(mUserBean.getUserNiceName())
|
||||
.setAvatarThumb(mUserBean.getAvatarThumb())
|
||||
.setFansNum(String.valueOf(mUserBean.getFans()));
|
||||
findViewById(R.id.btn_back).setOnClickListener(this);
|
||||
findViewById(R.id.btn_share).setOnClickListener(this);
|
||||
mBtnPlay = findViewById(R.id.btn_play);
|
||||
mBtnPlay.setOnClickListener(this);
|
||||
mSeekBar = (SeekBar) findViewById(R.id.seek_bar);
|
||||
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
mLiveRecordPlayViewHolder.clickResume();
|
||||
int progress = seekBar.getProgress();
|
||||
mLiveRecordPlayViewHolder.seekTo(mDuration * progress / 100000f);
|
||||
}
|
||||
}
|
||||
});
|
||||
mCurTimeTextView = findViewById(R.id.cur_time);
|
||||
mDurationTextView = findViewById(R.id.duration);
|
||||
ViewGroup container = (ViewGroup) findViewById(R.id.container);
|
||||
mLiveRecordPlayViewHolder = new LiveRecordPlayViewHolder(mContext, container);
|
||||
mLiveRecordPlayViewHolder.setActionListener(this);
|
||||
mLiveRecordPlayViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveRecordPlayViewHolder.addToParent();
|
||||
mLiveRecordPlayViewHolder.play(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
mLiveRecordPlayViewHolder.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
mLiveRecordPlayViewHolder.release();
|
||||
}
|
||||
if (mUserHomeSharePresenter != null) {
|
||||
mUserHomeSharePresenter.release();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
if (mSeekBar != null) {
|
||||
mSeekBar.setProgress(progress);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDuration(long duration) {
|
||||
mDuration = duration;
|
||||
if (mDurationTextView != null) {
|
||||
mDurationTextView.setText(StringUtil.getDurationText(duration));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurTime(long curTime) {
|
||||
if (mCurTimeTextView != null) {
|
||||
mCurTimeTextView.setText(StringUtil.getDurationText(curTime));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickPause() {
|
||||
if (mBtnPlay != null) {
|
||||
mBtnPlay.setImageResource(R.mipmap.icon_live_record_play);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResume() {
|
||||
if (mBtnPlay != null) {
|
||||
mBtnPlay.setImageResource(R.mipmap.icon_live_record_pause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_back) {
|
||||
onBackPressed();
|
||||
|
||||
} else if (i == R.id.btn_share) {
|
||||
share();
|
||||
|
||||
} else if (i == R.id.btn_play) {
|
||||
togglePlay();
|
||||
|
||||
} else if (i == R.id.btn_follow) {
|
||||
follow();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换播放暂停
|
||||
*/
|
||||
private void togglePlay() {
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
if (mPausePlay) {
|
||||
mLiveRecordPlayViewHolder.clickResume();
|
||||
} else {
|
||||
mLiveRecordPlayViewHolder.clickPause();
|
||||
}
|
||||
mPausePlay = !mPausePlay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关注主播
|
||||
*/
|
||||
private void follow() {
|
||||
if (mUserBean == null) {
|
||||
return;
|
||||
}
|
||||
CommonHttpUtil.setAttention(mUserBean.getId(), new CommonCallback<Integer>() {
|
||||
@Override
|
||||
public void callback(Integer isAttention) {
|
||||
if (isAttention == 1) {
|
||||
if (mBtnFollow.getVisibility() == View.VISIBLE) {
|
||||
mBtnFollow.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享
|
||||
*/
|
||||
private void share() {
|
||||
LiveShareDialogFragment fragment = new LiveShareDialogFragment();
|
||||
fragment.setActionListener(this);
|
||||
fragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveShareDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(String type) {
|
||||
if (Constants.LINK.equals(type)) {
|
||||
copyLink();
|
||||
} else {
|
||||
shareHomePage(type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制页面链接
|
||||
*/
|
||||
private void copyLink() {
|
||||
if (mUserHomeSharePresenter != null) {
|
||||
mUserHomeSharePresenter.copyLink();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分享页面链接
|
||||
*/
|
||||
private void shareHomePage(String type) {
|
||||
if (mUserHomeSharePresenter != null) {
|
||||
mUserHomeSharePresenter.shareHomePage(type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
||||
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
|
||||
import static com.yunbao.live.views.LiveRyAnchorViewHolder.btn_dr_pk_nub;
|
||||
@@ -40,7 +38,6 @@ import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
@@ -534,13 +531,13 @@ public class LiveSwAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
break;
|
||||
case Constants.LIVE_FUNC_MIRROR://鏡像
|
||||
|
||||
TRTCCloudDef.TRTCRenderParams t = new TRTCCloudDef.TRTCRenderParams();
|
||||
// TRTCCloudDef.TRTCRenderParams t = new TRTCCloudDef.TRTCRenderParams();
|
||||
if (mrr == 0) {
|
||||
mrr = 1;
|
||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
// t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
} else if (mrr == 1) {
|
||||
mrr = 0;
|
||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
// t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
}
|
||||
break;
|
||||
case Constants.LIVE_FUNC_RANDOM_PK:
|
||||
|
||||
@@ -14,12 +14,6 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tencent.liteav.TXLiteAVCode;
|
||||
import com.tencent.liteav.device.TXDeviceManager;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.tencent.trtc.TRTCCloudListener;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
@@ -44,18 +38,16 @@ import org.json.JSONObject;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_APP_SCENE_LIVE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG;
|
||||
|
||||
public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
|
||||
private TXCloudVideoView mTxcvvAnchorPreviewView;
|
||||
// private TXCloudVideoView mTxcvvAnchorPreviewView;
|
||||
private ImageView mButtonSwitchCamera;
|
||||
|
||||
private TRTCCloud mTRTCCloud;
|
||||
private TXDeviceManager mTXDeviceManager;
|
||||
private TRTCCloudDef.TRTCParams mTRTCParams;
|
||||
// private TRTCCloud mTRTCCloud;
|
||||
// private TXDeviceManager mTXDeviceManager;
|
||||
// private TRTCCloudDef.TRTCParams mTRTCParams;
|
||||
private boolean mIsFrontCamera = true;
|
||||
private String mRoomId = "1256732";
|
||||
private String mUserId = "95895736";
|
||||
@@ -80,13 +72,13 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
setContentView(R.layout.activity_live_trtcanchor);
|
||||
|
||||
|
||||
mTRTCCloud = TRTCCloud.sharedInstance(LiveTRTCAnchorActivity.this);
|
||||
// mTRTCCloud = TRTCCloud.sharedInstance(LiveTRTCAnchorActivity.this);
|
||||
mMainHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
mTXDeviceManager = mTRTCCloud.getDeviceManager();
|
||||
mTRTCCloud.setListener(new TRTCCloudImplListener(LiveTRTCAnchorActivity.this));
|
||||
// mTXDeviceManager = mTRTCCloud.getDeviceManager();
|
||||
// mTRTCCloud.setListener(new TRTCCloudImplListener(LiveTRTCAnchorActivity.this));
|
||||
|
||||
mTRTCCloud.setLocalVideoProcessListener(TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D,
|
||||
/*mTRTCCloud.setLocalVideoProcessListener(TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D,
|
||||
TRTCCloudDef.TRTC_VIDEO_BUFFER_TYPE_TEXTURE,
|
||||
new TRTCCloudListener.TRTCVideoFrameListener() {
|
||||
|
||||
@@ -114,7 +106,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
if (checkPermission()) {
|
||||
initView();
|
||||
enterRoom();
|
||||
@@ -131,7 +123,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
protected void initView() {
|
||||
mButtonSwitchCamera = findViewById(R.id.live_btn_switch_camera);
|
||||
mTxcvvAnchorPreviewView = findViewById(R.id.live_cloud_view_main);
|
||||
// mTxcvvAnchorPreviewView = findViewById(R.id.live_cloud_view_main);
|
||||
btn_beauty = findViewById(R.id.btn_beauty);
|
||||
ready_view = (View) findViewById(R.id.ready_view);
|
||||
live_class = (TextView) findViewById(R.id.live_class);
|
||||
@@ -169,7 +161,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
}
|
||||
});
|
||||
mTRTCCloud.setListener(new TRTCCloudImplListener(LiveTRTCAnchorActivity.this));
|
||||
// mTRTCCloud.setListener(new TRTCCloudImplListener(LiveTRTCAnchorActivity.this));
|
||||
mButtonSwitchCamera.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -181,7 +173,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
public void enterRoom() {
|
||||
|
||||
mTRTCParams = new TRTCCloudDef.TRTCParams();
|
||||
/* mTRTCParams = new TRTCCloudDef.TRTCParams();
|
||||
mTRTCParams.sdkAppId = GenerateTestUserSig.SDKAPPID;
|
||||
mTRTCParams.userId = mUserId;
|
||||
mTRTCParams.roomId = Integer.parseInt(mRoomId);
|
||||
@@ -190,7 +182,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
mTRTCCloud.startLocalPreview(mIsFrontCamera, mTxcvvAnchorPreviewView);
|
||||
mTRTCCloud.startLocalAudio(TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT);
|
||||
mTRTCCloud.enterRoom(mTRTCParams, TRTC_APP_SCENE_LIVE);
|
||||
mTRTCCloud.enterRoom(mTRTCParams, TRTC_APP_SCENE_LIVE);*/
|
||||
|
||||
}
|
||||
|
||||
@@ -223,7 +215,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
try {
|
||||
JSONObject data = new JSONObject(info[0]);
|
||||
mTRTCCloud.startPublishing(data.getString("stream"), TRTC_VIDEO_STREAM_TYPE_BIG);
|
||||
// mTRTCCloud.startPublishing(data.getString("stream"), TRTC_VIDEO_STREAM_TYPE_BIG);
|
||||
ready_view.setVisibility(View.VISIBLE);
|
||||
|
||||
} catch (JSONException e) {
|
||||
@@ -244,11 +236,11 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
} else {
|
||||
mIsFrontCamera = true;
|
||||
}
|
||||
mTXDeviceManager.switchCamera(mIsFrontCamera);
|
||||
// mTXDeviceManager.switchCamera(mIsFrontCamera);
|
||||
}
|
||||
|
||||
|
||||
protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
/*protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
|
||||
private WeakReference<LiveTRTCAnchorActivity> mContext;
|
||||
|
||||
@@ -284,18 +276,18 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
protected void exitRoom() {
|
||||
if (mTRTCCloud != null) {
|
||||
/* if (mTRTCCloud != null) {
|
||||
mTRTCCloud.stopLocalAudio();
|
||||
mTRTCCloud.stopLocalPreview();
|
||||
mTRTCCloud.exitRoom();
|
||||
mTRTCCloud.setListener(null);
|
||||
}
|
||||
mTRTCCloud = null;
|
||||
TRTCCloud.destroySharedInstance();
|
||||
TRTCCloud.destroySharedInstance();*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.example.txvidotest
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.Toast
|
||||
import com.cosmos.baseutil.file.FileUtil
|
||||
import com.cosmos.baseutil.thread.ThreadUtils
|
||||
import com.tencent.liteav.basic.util.TXCCommonUtil.getAppContext
|
||||
import com.cosmos.baseutil.toast.Toaster
|
||||
import java.io.File
|
||||
|
||||
object FilterUtils {
|
||||
@@ -44,7 +45,8 @@ object FilterUtils {
|
||||
}
|
||||
|
||||
fun getBeautyDirectory(): File? {
|
||||
return File(getAppContext().filesDir?.absolutePath, "/beauty")
|
||||
Toaster.show("请联系开发者")
|
||||
return null
|
||||
}
|
||||
|
||||
fun getFilterHomeDir(): File {
|
||||
|
||||
@@ -17,12 +17,6 @@ import android.widget.PopupWindow;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.tencent.trtc.TRTCCloudListener;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
@@ -54,10 +48,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_APP_SCENE_LIVE;
|
||||
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
|
||||
import static com.yunbao.live.activity.LiveAnchorActivity.isDRPK;
|
||||
import static com.yunbao.live.views.AbsLivePushViewHolder.mPreView;
|
||||
import static com.yunbao.live.views.LivePushTxViewHolder.dr_pk_view;
|
||||
|
||||
import io.rong.imlib.IRongCallback;
|
||||
@@ -107,13 +99,13 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
private int mPkSendWaitCount;//发送pk请求后的等待时间
|
||||
private String mSelfStream;
|
||||
private int mPkTimeFromServer;
|
||||
public static TRTCCloud mTRTCCloud1;
|
||||
public static TRTCCloudDef.TRTCParams mTRTCParams1;
|
||||
|
||||
public static TRTCCloud mTRTCCloud2;
|
||||
public static TRTCCloud mTRTCCloud3;
|
||||
public static TRTCCloud mTRTCCloud4;
|
||||
public static TRTCCloud mTRTCCloud5;
|
||||
// public static TRTCCloud mTRTCCloud1;
|
||||
// public static TRTCCloudDef.TRTCParams mTRTCParams1;
|
||||
//
|
||||
// public static TRTCCloud mTRTCCloud2;
|
||||
// public static TRTCCloud mTRTCCloud3;
|
||||
// public static TRTCCloud mTRTCCloud4;
|
||||
// public static TRTCCloud mTRTCCloud5;
|
||||
|
||||
public LiveLinkMicPkPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, View root) {
|
||||
mContext = context;
|
||||
@@ -239,13 +231,13 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
s1 = "00:00";
|
||||
i = 0;
|
||||
}
|
||||
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null && LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
/* if (LiveLinkMicPkPresenter.mTRTCCloud1 != null && LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mContext.getResources().getDimensionPixelOffset(R.dimen.live_view));
|
||||
params.weight = 1;
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
LivePushTxViewHolder.mPreView.setLayoutParams(params);
|
||||
LivePushTxViewHolder.mPreView1.setLayoutParams(params);
|
||||
}
|
||||
}*/
|
||||
|
||||
Log.i("tts", s1);
|
||||
mLiveLinkMicPkViewHolder.setTime(s + " " + s1);
|
||||
@@ -370,7 +362,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
|
||||
user.add(u);
|
||||
Log.i("1111", "12222222a" + user.size());
|
||||
mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud();
|
||||
/* mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud();
|
||||
mTRTCParams1 = new TRTCCloudDef.TRTCParams();
|
||||
mTRTCParams1.sdkAppId = GenerateTestUserSig.SDKAPPID;
|
||||
mTRTCParams1.userId = CommonAppConfig.getInstance().getUid() + "pk";
|
||||
@@ -393,7 +385,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
mTRTCCloud1.enterRoom(mTRTCParams1, TRTC_APP_SCENE_LIVE);
|
||||
mTRTCCloud1.startRemoteView(u.getId(), LivePushTxViewHolder.dr4_preview);
|
||||
mTRTCCloud1.setListener(new LiveLinkMicPkPresenter.TRTCCloudImplListener(mContext));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//接受PK回调
|
||||
@@ -459,7 +451,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
*/
|
||||
public void onLinkMicToPk(String u, String pkhead, String pkname) {
|
||||
Log.e("eve", u + "");
|
||||
mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud();
|
||||
/* mTRTCCloud1 = LivePushTxViewHolder.mTRTCCloud.createSubCloud();
|
||||
mTRTCParams1 = new TRTCCloudDef.TRTCParams();
|
||||
mTRTCParams1.sdkAppId = GenerateTestUserSig.SDKAPPID;
|
||||
mTRTCParams1.userId = CommonAppConfig.getInstance().getUid() + "pk";
|
||||
@@ -468,7 +460,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
mTRTCParams1.role = TRTCCloudDef.TRTCRoleAnchor;
|
||||
mTRTCCloud1.enterRoom(mTRTCParams1, TRTC_APP_SCENE_LIVE);
|
||||
mTRTCCloud1.startRemoteView(u, LivePushTxViewHolder.mPreView1);
|
||||
mTRTCCloud1.setListener(new TRTCCloudImplListener(mContext));
|
||||
mTRTCCloud1.setListener(new TRTCCloudImplListener(mContext));*/
|
||||
LivePushTxViewHolder.btn_close.setVisibility(View.VISIBLE);
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mContext.getResources().getDimensionPixelOffset(R.dimen.live_view));
|
||||
@@ -488,7 +480,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
.param("pkname", pkname);
|
||||
|
||||
msg1.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg1.mResult.toString(), "g" + CommonAppConfig.getInstance().getUid(), V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
/* V2TIMManager.getInstance().sendGroupTextMessage(msg1.mResult.toString(), "g" + CommonAppConfig.getInstance().getUid(), V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
@@ -504,13 +496,13 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
|
||||
List<String> muser = new ArrayList<>();
|
||||
|
||||
protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
/*protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
|
||||
private WeakReference<Context> mContext;
|
||||
|
||||
@@ -688,7 +680,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
super.onError(errCode, errMsg, extraInfo);
|
||||
Log.i("errMsg", errCode + "errMsg" + errMsg);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 显示申请PK的弹窗
|
||||
@@ -803,7 +795,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
.param("uid", u.getId())
|
||||
.param("pkuid",CommonAppConfig.getInstance().getUid());
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendC2CTextMessage(msg.mResult.toString(), list.get(i).getId() + "", new V2TIMSendCallback<V2TIMMessage>() {
|
||||
/* V2TIMManager.getInstance().sendC2CTextMessage(msg.mResult.toString(), list.get(i).getId() + "", new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
@@ -819,7 +811,7 @@ public class LiveLinkMicPkPresenter implements View.OnClickListener {
|
||||
ToastUtil.show("发送失败");
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.AnchorInfoEvent;
|
||||
@@ -124,7 +123,6 @@ public class LiveSwLinkMicPkPresenter extends AbsLinkMicPkPresenter implements V
|
||||
private int mPkSendWaitCount;//发送pk请求后的等待时间
|
||||
private String mSelfStream;
|
||||
private int mPkTimeFromServer;
|
||||
public static TRTCCloud mTRTCCloud1;
|
||||
private View detailsView1, detailsView2, detailsView3, detailsView4;
|
||||
private LinearLayout detailsLinearLayout1, detailsLinearLayout2, detailsLinearLayout3, detailsLinearLayout4;
|
||||
private LinearLayout linearGrade1, linearGrade2, linearGrade3, linearGrade4;
|
||||
|
||||
@@ -1,671 +0,0 @@
|
||||
package com.yunbao.live.socket;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/9.
|
||||
* 直播间发言
|
||||
*/
|
||||
|
||||
public class SocketChatUtil {
|
||||
|
||||
//关闭直播
|
||||
public static void closeLive(final String mLiveUid, SocketClient client) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_LIVE_END)
|
||||
.param("action", 18)
|
||||
.param("msgtype", 1)
|
||||
.param("equipment", "app")
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("roomnum", u.getId())
|
||||
.param("ct", "直播关闭");
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
V2TIMManager.getInstance().dismissGroup("g" + mLiveUid, new V2TIMCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i("tx", "解散成功");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "解散失败" + desc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败1" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发言
|
||||
*/
|
||||
public static void sendChatMessage(String mLiveUid, String content, boolean isAnchor, int userType, int guardType) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SocketSendBean msg =
|
||||
new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SEND_MSG)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 2)
|
||||
.param("usertype", userType)
|
||||
.param("isAnchor", isAnchor ? 1 : 0)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("bubble", u.getDress().getBubble())
|
||||
.param("medal_honor", u.getMedal_no_display_src())
|
||||
.param("medal", u.getDress().getMedal())
|
||||
.param("medal_new", u.getDress().getMedal_new())
|
||||
.param("uid", u.getId())
|
||||
.param("liangname", u.getGoodName())
|
||||
.param("vip_type", u.getVip().getType())
|
||||
.param("guard_type", guardType)
|
||||
.param("medal_name", u.getMedalName())
|
||||
.param("medal_level", u.getMedalLevel())
|
||||
.param("good_num", u.getGoodnum())
|
||||
.param("ct", content);
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败2" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 点亮
|
||||
*/
|
||||
public static void sendLightMessage(final String mLiveUid, int heart, int guardType) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SEND_MSG)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 2)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("liangname", u.getGoodName())
|
||||
.param("vip_type", u.getVip().getType())
|
||||
.param("medal_honor", u.getMedal_no_display_src())
|
||||
.param("heart", heart)
|
||||
.param("bubble", u.getDress().getBubble())
|
||||
.param("medal", u.getDress().getMedal())
|
||||
.param("medal_new", u.getDress().getMedal_new())
|
||||
.param("guard_type", guardType)
|
||||
.param("medal_name", u.getMedalName())
|
||||
.param("medal_level", u.getMedalLevel())
|
||||
.param("good_num", u.getGoodnum())
|
||||
.param("ct", CommonAppContext.sInstance.getBaseContext().getString(R.string.live_lighted));
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
LiveHttpUtil.sendZAN(mLiveUid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i("tag", "禮物im");
|
||||
}
|
||||
});
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败3" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送弹幕消息
|
||||
*/
|
||||
public static void sendDanmuMessage(String mLiveUid, String danmuToken) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SEND_BARRAGE)
|
||||
.param("action", 7)
|
||||
.param("msgtype", 1)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("uhead", u.getAvatar())
|
||||
.param("ct", danmuToken);
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败4" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送礼物消息
|
||||
*/
|
||||
public static void sendGiftMessage(int giftType, String giftToken, String liveUid, int guard_type, String by) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SEND_GIFT)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 1)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("uhead", u.getAvatar())
|
||||
.param("evensend", giftType)
|
||||
.param("liangname", u.getGoodName())
|
||||
.param("vip_type", u.getVip().getType())
|
||||
.param("ct", giftToken)
|
||||
.param("bubble", u.getDress().getBubble())
|
||||
.param("medal", u.getDress().getMedal())
|
||||
.param("medal_new", u.getDress().getMedal_new())
|
||||
.param("medal_name", u.getMedalName())
|
||||
.param("medal_level", u.getMedalLevel())
|
||||
.param("guard_type", guard_type + "")
|
||||
.param("medal_honor", u.getMedal_no_display_src())
|
||||
.param("good_num", u.getGoodnum())
|
||||
.param("roomnum", liveUid);
|
||||
|
||||
msg.create();
|
||||
LiveHttpUtil.sendGiftMsg(by, liveUid, msg.mResult.toString(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i("tag", "禮物im");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送礼物消息 增加主播名字
|
||||
*/
|
||||
public static void sendGiftMessage(int giftType, String giftToken,
|
||||
String liveUid, String ancherName, int guard_type, String by) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SEND_GIFT)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 1)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("uhead", u.getAvatar())
|
||||
.param("evensend", giftType)
|
||||
.param("liangname", u.getGoodName())
|
||||
.param("vip_type", u.getVip().getType())
|
||||
.param("bubble", u.getDress().getBubble())
|
||||
.param("medal", u.getDress().getMedal())
|
||||
.param("medal_new", u.getDress().getMedal_new())
|
||||
.param("ct", giftToken)
|
||||
.param("ancherName", ancherName)
|
||||
.param("medal_name", u.getMedalName())
|
||||
.param("medal_level", u.getMedalLevel())
|
||||
.param("guard_type", guard_type + "")
|
||||
.param("medal_honor", u.getMedal_no_display_src())
|
||||
.param("good_num", u.getGoodnum())
|
||||
.param("roomnum", liveUid);
|
||||
|
||||
msg.create();
|
||||
|
||||
LiveHttpUtil.sendGiftMsg(by, liveUid, msg.mResult.toString(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
Log.i("tag", "禮物im");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播或管理员 踢人
|
||||
*/
|
||||
public static void sendKickMessage(String mLiveUid, String toUid, String toName) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_KICK)
|
||||
.param("action", 2)
|
||||
.param("msgtype", 4)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("touid", toUid)
|
||||
.param("toname", toName)
|
||||
.param("ct", toName + CommonAppContext.sInstance.getBaseContext().getString(R.string.live_kicked));
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败5" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主播或管理员 禁言
|
||||
*/
|
||||
public static void sendShutUpMessage(String mLiveUid, String toUid, String toName, int type) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SHUT_UP)
|
||||
.param("action", 1)
|
||||
.param("msgtype", 4)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("touid", toUid)
|
||||
.param("toname", toName)
|
||||
.param("ct", toName + (type == 0 ? "被永久禁言(Forbidden forever)" : "被本場禁言(Forbidden by this scene)"));
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败6" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置或取消管理员消息
|
||||
*/
|
||||
public static void sendSetAdminMessage(String mLiveUid, int action, String toUid, String toName) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
String s = action == 1 ? "被設為管理員(Set as Administrator)": "被取消管理員(Cancelled administrator)";
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SET_ADMIN)
|
||||
.param("action", action)
|
||||
.param("msgtype", 1)
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("touid", toUid)
|
||||
.param("toname", toName)
|
||||
.param("ct", toName + " " + s);
|
||||
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败7" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 超管关闭直播间
|
||||
*/
|
||||
public static void superCloseRoom(String mLiveUid) {
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_STOP_LIVE)
|
||||
.param("action", 19)
|
||||
.param("msgtype", 1)
|
||||
.param("ct", "");
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败7" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 发系统消息
|
||||
*/
|
||||
public static void sendSystemMessage(String mLiveUid, String content) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_SYSTEM)
|
||||
.param("action", 13)
|
||||
.param("msgtype", 4)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("ct", content);
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功" + msg.mResult.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败9" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取僵尸粉
|
||||
*/
|
||||
public static void getFakeFans(String mLiveUid) {
|
||||
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_FAKE_FANS)
|
||||
.param("action", "")
|
||||
.param("msgtype", "");
|
||||
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败10" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新主播映票数
|
||||
*/
|
||||
public static void sendUpdateVotesMessage(String mLiveUid, int votes, int first) {
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_UPDATE_VOTES)
|
||||
.param("action", 1)
|
||||
.param("msgtype", 26)
|
||||
.param("votes", votes)
|
||||
.param("uid", CommonAppConfig.getInstance().getUid())
|
||||
.param("isfirst", first)
|
||||
.param("ct", "");
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主播映票数
|
||||
*/
|
||||
public static void sendUpdateVotesMessage(String mLiveUid, int votes) {
|
||||
sendUpdateVotesMessage(mLiveUid, votes, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送购买守护成功消息
|
||||
*/
|
||||
public static void sendBuyGuardMessage(String mLiveUid, String votes, int guardNum, int guardType) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_BUY_GUARD)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 0)
|
||||
.param("uid", u.getId())
|
||||
.param("bubble", u.getDress().getBubble())
|
||||
.param("medal", u.getDress().getMedal())
|
||||
.param("medal_new", u.getDress().getMedal_new())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uhead", u.getAvatar())
|
||||
.param("votestotal", votes)
|
||||
.param("guard_nums", guardNum)
|
||||
.param("guard_type", guardType);
|
||||
msg.create();
|
||||
|
||||
}
|
||||
|
||||
public static void sendBuyGuardMessage2(String mLiveUid, String votes, int guardNum,
|
||||
int guardType, String ancherName, String liveId) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_BUY_GUARD)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 0)
|
||||
.param("uid", u.getId())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uhead", u.getAvatar())
|
||||
.param("votestotal", votes)
|
||||
.param("guard_nums", guardNum)
|
||||
.param("ancherName", ancherName)
|
||||
.param("liveuid", liveId)
|
||||
.param("bubble", u.getDress().getBubble())
|
||||
.param("medal", u.getDress().getMedal())
|
||||
.param("medal_new", u.getDress().getMedal_new())
|
||||
.param("guard_type", guardType);
|
||||
msg.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送发红包成功消息
|
||||
*/
|
||||
public static void sendRedPackMessage(String mLiveUid) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
final SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_RED_PACK)
|
||||
.param("action", 0)
|
||||
.param("msgtype", 0)
|
||||
.param("uid", u.getId())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("ct", CommonAppContext.sInstance.getBaseContext().getString(R.string.red_pack_22)
|
||||
);
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(), "g" + mLiveUid, V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx", "发送中" + progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx", "发送成功");
|
||||
SocketClient.mSocketHandler.processBroadcast(msg.mResult.toString() + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", code + "发送失败" + desc);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import android.widget.LinearLayout;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.tencent.imsdk.v2.V2TIMCallback;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
@@ -57,7 +55,7 @@ public class SocketClient {
|
||||
public SocketClient(String mLiveUid, SocketMessageListener listener) {
|
||||
mSocketHandler = new SocketHandler(listener);
|
||||
mSocketHandler.setLiveUid(mLiveUid);
|
||||
V2TIMManager.getInstance().joinGroup("g" + mLiveUid, "", new V2TIMCallback() {
|
||||
/*V2TIMManager.getInstance().joinGroup("g" + mLiveUid, "", new V2TIMCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i("tx", "加入成功");
|
||||
@@ -67,7 +65,7 @@ public class SocketClient {
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx", desc + "加入" + "失败" + code);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
public void disConnect() {
|
||||
@@ -785,7 +783,7 @@ public class SocketClient {
|
||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"), map.getString("is_ladders"));
|
||||
break;
|
||||
case 5://PK时候断开连麦的回调
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
/*if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) {
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.stopRemoteView(map.getString("uid"));
|
||||
LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom();
|
||||
@@ -804,7 +802,7 @@ public class SocketClient {
|
||||
}
|
||||
});
|
||||
Log.i("zzzv", "1");
|
||||
}
|
||||
}*/
|
||||
mListener.onLinkMicPkClose(1);
|
||||
break;
|
||||
case 7://对方主播正在忙的回调
|
||||
|
||||
@@ -1,645 +0,0 @@
|
||||
package com.yunbao.live.socket;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/31.
|
||||
*/
|
||||
|
||||
public class SocketGameUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 智勇三张 开启游戏窗口
|
||||
*/
|
||||
public static void zjhShowGameWindow() {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_GAME_ZJH)
|
||||
// .param("action", GameConsts.GAME_ACTION_OPEN_WINDOW)
|
||||
.param("msgtype", 15)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("ct", "");
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(),"g"+u.getId(), V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx","发送中"+progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx","发送成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx",code+"发送失败"+desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 智勇三张 主播创建游戏
|
||||
*/
|
||||
public static void zjhAnchorCreateGame(String gameId) {
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_GAME_ZJH)
|
||||
// .param("action", GameConsts.GAME_ACTION_CREATE)
|
||||
.param("msgtype", 15)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("gameid", gameId)
|
||||
.param("ct", "");
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(),"g"+u.getId(), V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx","发送中"+progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx","发送成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx",code+"发送失败"+desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 智勇三张 主播关闭游戏
|
||||
*/
|
||||
public static void zjhAnchorCloseGame() {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
SocketSendBean msg = new SocketSendBean()
|
||||
.param("_method_", Constants.SOCKET_GAME_ZJH)
|
||||
// .param("action", GameConsts.GAME_ACTION_CLOSE)
|
||||
.param("msgtype", 15)
|
||||
.param("level", u.getLevel())
|
||||
.param("uname", u.getUserNiceName())
|
||||
.param("uid", u.getId())
|
||||
.param("ct", "");
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendGroupTextMessage(msg.mResult.toString(),"g"+u.getId(), V2TIMMessage.V2TIM_PRIORITY_NORMAL, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
Log.i("tx","发送中"+progress);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(V2TIMMessage v2TIMMessage) {
|
||||
Log.i("tx","发送成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
Log.i("tx",code+"发送失败"+desc);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 智勇三张 主播通知所有人下注
|
||||
* 此时服务器收到该socket后,自动计时,30秒后自动发送显示游戏结果的socket
|
||||
*/
|
||||
public static void zjhAnchorNotifyGameBet(SocketClient client, String liveUid, String gameId, String token, int time) {
|
||||
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_ZJH)
|
||||
// .param("action", GameConsts.GAME_ACTION_NOTIFY_BET)
|
||||
// .param("msgtype", 15)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("liveuid", liveUid)
|
||||
// .param("gameid", gameId)
|
||||
// .param("token", token)
|
||||
// .param("time", time)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
// ssss
|
||||
}
|
||||
|
||||
/**
|
||||
* 智勇三张 观众把自己的下注信息广播给所有人
|
||||
*/
|
||||
public static void zjhAudienceBetGame(SocketClient client, int coin, int index) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_ZJH)
|
||||
// .param("action", GameConsts.GAME_ACTION_BROADCAST_BET)
|
||||
// .param("msgtype", 15)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("money", coin)
|
||||
// .param("type", index)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 海盗船长 开启游戏窗口
|
||||
*/
|
||||
public static void hdShowGameWindow(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_HD)
|
||||
// .param("action", 1)
|
||||
// .param("msgtype", 18)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 海盗船长 主播创建游戏
|
||||
*/
|
||||
public static void hdAnchorCreateGame(SocketClient client, String gameId) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_HD)
|
||||
// .param("action", GameConsts.GAME_ACTION_CREATE)
|
||||
// .param("msgtype", 18)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("gameid", gameId)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 海盗船长 主播关闭游戏
|
||||
*/
|
||||
public static void hdAnchorCloseGame(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_HD)
|
||||
// .param("action", GameConsts.GAME_ACTION_CLOSE)
|
||||
// .param("msgtype", 18)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 海盗船长 主播通知所有人下注
|
||||
* 此时服务器收到该socket后,自动计时,30秒后自动发送显示游戏结果的socket
|
||||
*/
|
||||
public static void hdAnchorNotifyGameBet(SocketClient client, String liveUid, String gameId, String token, int time) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_HD)
|
||||
// .param("action", GameConsts.GAME_ACTION_NOTIFY_BET)
|
||||
// .param("msgtype", 18)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("liveuid", liveUid)
|
||||
// .param("gameid", gameId)
|
||||
// .param("token", token)
|
||||
// .param("time", time)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 海盗船长 观众把自己的下注信息广播给所有人
|
||||
*/
|
||||
public static void hdAudienceBetGame(SocketClient client, int coin, int index) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_HD)
|
||||
// .param("action", GameConsts.GAME_ACTION_BROADCAST_BET)
|
||||
// .param("msgtype", 18)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("money", coin)
|
||||
// .param("type", index)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 幸运转盘 开启游戏窗口
|
||||
*/
|
||||
public static void zpShowGameWindow(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_ZP)
|
||||
// .param("action", 1)
|
||||
// .param("msgtype", 16)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 幸运转盘 主播关闭游戏
|
||||
*/
|
||||
public static void zpAnchorCloseGame(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_ZP)
|
||||
// .param("action", GameConsts.GAME_ACTION_CLOSE)
|
||||
// .param("msgtype", 16)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运转盘 主播通知所有人下注
|
||||
* 此时服务器收到该socket后,自动计时,30秒后自动发送显示游戏结果的socket
|
||||
*/
|
||||
public static void zpAnchorNotifyGameBet(SocketClient client, String liveUid, String gameId, String token, int time) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_ZP)
|
||||
// .param("action", GameConsts.GAME_ACTION_NOTIFY_BET)
|
||||
// .param("msgtype", 16)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("liveuid", liveUid)
|
||||
// .param("gameid", gameId)
|
||||
// .param("token", token)
|
||||
// .param("time", time)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运转盘 观众把自己的下注信息广播给所有人
|
||||
*/
|
||||
public static void zpAudienceBetGame(SocketClient client, int coin, int index) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_ZP)
|
||||
// .param("action", GameConsts.GAME_ACTION_BROADCAST_BET)
|
||||
// .param("msgtype", 16)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("money", coin)
|
||||
// .param("type", index)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 开心牛仔 开启游戏窗口
|
||||
*/
|
||||
public static void nzShowGameWindow(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_NZ)
|
||||
// .param("action", 1)
|
||||
// .param("msgtype", 17)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开心牛仔 主播创建游戏
|
||||
* 本局的庄家信息 服务器用"bankerlist" 这个字段表示 ,其实是一个对象,是一个人的信息
|
||||
*/
|
||||
public static void nzAnchorCreateGame(SocketClient client, String gameId, String bankerInfo) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_NZ)
|
||||
// .param("action", GameConsts.GAME_ACTION_CREATE)
|
||||
// .param("msgtype", 17)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("gameid", gameId)
|
||||
// .param("ct", "")
|
||||
// .paramJsonObject("bankerlist", bankerInfo)
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开心牛仔 主播关闭游戏
|
||||
*/
|
||||
public static void nzAnchorCloseGame(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_NZ)
|
||||
// .param("action", GameConsts.GAME_ACTION_CLOSE)
|
||||
// .param("msgtype", 17)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开心牛仔 主播通知所有人下注
|
||||
* 此时服务器收到该socket后,自动计时,30秒后自动发送显示游戏结果的socket
|
||||
*/
|
||||
public static void nzAnchorNotifyGameBet(SocketClient client, String liveUid, String gameId, String token, int time) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_NZ)
|
||||
// .param("action", GameConsts.GAME_ACTION_NOTIFY_BET)
|
||||
// .param("msgtype", 17)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("liveuid", liveUid)
|
||||
// .param("gameid", gameId)
|
||||
// .param("token", token)
|
||||
// .param("time", time)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开心牛仔 观众把自己的下注信息广播给所有人
|
||||
*/
|
||||
public static void nzAudienceBetGame(SocketClient client, int coin, int index) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_NZ)
|
||||
// .param("action", GameConsts.GAME_ACTION_BROADCAST_BET)
|
||||
// .param("msgtype", 17)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("money", coin)
|
||||
// .param("type", index)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 二八贝 开启游戏窗口
|
||||
*/
|
||||
public static void ebbShowGameWindow(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_EBB)
|
||||
// .param("action", 1)
|
||||
// .param("msgtype", 15)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 二八贝 主播创建游戏
|
||||
*/
|
||||
public static void ebbAnchorCreateGame(SocketClient client, String gameId) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_EBB)
|
||||
// .param("action", GameConsts.GAME_ACTION_CREATE)
|
||||
// .param("msgtype", 19)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("gameid", gameId)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 二八贝 主播关闭游戏
|
||||
*/
|
||||
public static void ebbAnchorCloseGame(SocketClient client) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_EBB)
|
||||
// .param("action", GameConsts.GAME_ACTION_CLOSE)
|
||||
// .param("msgtype", 19)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 二八贝 主播通知所有人下注
|
||||
* 此时服务器收到该socket后,自动计时,30秒后自动发送显示游戏结果的socket
|
||||
*/
|
||||
public static void ebbAnchorNotifyGameBet(SocketClient client, String liveUid, String gameId, String token, int time) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_EBB)
|
||||
// .param("action", GameConsts.GAME_ACTION_NOTIFY_BET)
|
||||
// .param("msgtype", 19)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("liveuid", liveUid)
|
||||
// .param("gameid", gameId)
|
||||
// .param("token", token)
|
||||
// .param("time", time)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
/**
|
||||
* 二八贝 观众把自己的下注信息广播给所有人
|
||||
*/
|
||||
public static void ebbAudienceBetGame(SocketClient client, int coin, int index) {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u == null) {
|
||||
return;
|
||||
}
|
||||
// client.send(new SocketSendBean()
|
||||
// .param("_method_", Constants.SOCKET_GAME_EBB)
|
||||
// .param("action", GameConsts.GAME_ACTION_BROADCAST_BET)
|
||||
// .param("msgtype", 19)
|
||||
// .param("level", u.getLevel())
|
||||
// .param("uname", u.getUserNiceName())
|
||||
// .param("uid", u.getId())
|
||||
// .param("money", coin)
|
||||
// .param("type", index)
|
||||
// .param("ct", "")
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,9 +2,6 @@ package com.yunbao.live.socket;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
@@ -69,7 +66,7 @@ public class SocketLinkMicPkUtil {
|
||||
.param("uhead", CommonAppConfig.getInstance().getUserBean().getAvatar())
|
||||
.param("name", CommonAppConfig.getInstance().getUserBean().getUserNiceName());
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendC2CTextMessage(msg.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
/* V2TIMManager.getInstance().sendC2CTextMessage(msg.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
@@ -110,7 +107,7 @@ public class SocketLinkMicPkUtil {
|
||||
ToastUtil.show("发送失败");
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -152,7 +149,7 @@ public class SocketLinkMicPkUtil {
|
||||
.param("ct", "");
|
||||
|
||||
msg.create();
|
||||
V2TIMManager.getInstance().sendC2CTextMessage(msg.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
/* V2TIMManager.getInstance().sendC2CTextMessage(msg.mResult.toString(), pkUid, new V2TIMSendCallback<V2TIMMessage>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
@@ -168,7 +165,7 @@ public class SocketLinkMicPkUtil {
|
||||
ToastUtil.show("发送失败");
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.google.android.exoplayer2.ui.StyledPlayerView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
@@ -45,9 +45,9 @@ public abstract class AbsLivePushViewHolder extends AbsViewHolder implements ILi
|
||||
protected ViewGroup mLeftContainer;
|
||||
protected ViewGroup mRightContainer;
|
||||
protected ViewGroup mPkContainer;
|
||||
public static TXCloudVideoView mPreView,dr1_preview,dr2_preview,dr3_preview,dr4_preview;
|
||||
public static StyledPlayerView mPreView,dr1_preview,dr2_preview,dr3_preview,dr4_preview;
|
||||
public static ImageView leave;
|
||||
public static TXCloudVideoView mPreView1;
|
||||
public static StyledPlayerView mPreView1;
|
||||
protected boolean mOpenCamera;//是否选择了相机
|
||||
|
||||
|
||||
|
||||
@@ -9,11 +9,6 @@ import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.TXLivePlayConfig;
|
||||
import com.tencent.rtmp.TXLivePlayer;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@@ -27,11 +22,11 @@ import cn.qqtheme.framework.util.ScreenUtils;
|
||||
* 连麦播放小窗口 使用腾讯sdk
|
||||
*/
|
||||
|
||||
public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder implements ITXLivePlayListener {
|
||||
public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder {
|
||||
|
||||
private static final String TAG = "LiveLinkMicPlayTxViewHolder";
|
||||
private TXCloudVideoView mVideoView;
|
||||
private TXLivePlayer mPlayer;
|
||||
// private TXCloudVideoView mVideoView;
|
||||
// private TXLivePlayer mPlayer;
|
||||
|
||||
public LiveLinkMicPlayTxViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
@@ -45,7 +40,7 @@ public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder im
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
/* mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
mPlayer = new TXLivePlayer(mContext);
|
||||
mPlayer.setPlayListener(this);
|
||||
mPlayer.setPlayerView(mVideoView);
|
||||
@@ -57,7 +52,7 @@ public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder im
|
||||
playConfig.setAutoAdjustCacheTime(true);
|
||||
playConfig.setMaxAutoAdjustCacheTime(5.0f);
|
||||
playConfig.setMinAutoAdjustCacheTime(1.0f);
|
||||
mPlayer.setConfig(playConfig);
|
||||
mPlayer.setConfig(playConfig);*/
|
||||
|
||||
|
||||
// TODO: 2019-11-10
|
||||
@@ -86,9 +81,9 @@ public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder im
|
||||
@Override
|
||||
public void play(final String url) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
if (mPlayer != null) {
|
||||
/* if (mPlayer != null) {
|
||||
mPlayer.stopPlay(true);
|
||||
}
|
||||
}*/
|
||||
mEndPlay = true;
|
||||
return;
|
||||
}
|
||||
@@ -97,9 +92,9 @@ public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder im
|
||||
@Override
|
||||
public void run() {
|
||||
mEndPlay = false;
|
||||
if (mPlayer != null) {
|
||||
/*if (mPlayer != null) {
|
||||
mPlayer.startPlay(url, TXLivePlayer.PLAY_TYPE_LIVE_RTMP_ACC);
|
||||
}
|
||||
}*/
|
||||
L.e(TAG, "play----url--->" + url);
|
||||
}
|
||||
}, 500);
|
||||
@@ -109,11 +104,11 @@ public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder im
|
||||
@Override
|
||||
public void release() {
|
||||
mEndPlay = true;
|
||||
if (mPlayer != null) {
|
||||
/* if (mPlayer != null) {
|
||||
mPlayer.stopPlay(false);
|
||||
mPlayer.setPlayListener(null);
|
||||
}
|
||||
mPlayer = null;
|
||||
mPlayer = null;*/
|
||||
if (mBtnClose != null) {
|
||||
mBtnClose.setOnClickListener(null);
|
||||
}
|
||||
@@ -126,72 +121,18 @@ public class LiveLinkMicPlayTxViewHolder extends AbsLiveLinkMicPlayViewHolder im
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
if (mPaused && mVideoView != null) {
|
||||
/*if (mPaused && mVideoView != null) {
|
||||
mPlayer.resume();
|
||||
}
|
||||
}*/
|
||||
mPaused = false;
|
||||
}
|
||||
@Override
|
||||
public void pause() {
|
||||
if (mVideoView != null) {
|
||||
/* if (mVideoView != null) {
|
||||
mPlayer.pause();
|
||||
}
|
||||
}*/
|
||||
mPaused = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPlayEvent(int e, Bundle bundle) {
|
||||
if (mEndPlay) {
|
||||
return;
|
||||
}
|
||||
switch (e) {
|
||||
case TXLiveConstants.PLAY_EVT_PLAY_BEGIN://播放开始
|
||||
if (mLoading != null && mLoading.getVisibility() == View.VISIBLE) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
break;
|
||||
case TXLiveConstants.PLAY_EVT_PLAY_LOADING:
|
||||
if (mLoading != null && mLoading.getVisibility() != View.VISIBLE) {
|
||||
mLoading.setVisibility(View.VISIBLE);
|
||||
}
|
||||
break;
|
||||
// case TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME://第一帧
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_EVT_PLAY_END://播放结束
|
||||
// break;
|
||||
case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION://获取视频宽高
|
||||
|
||||
// float width = bundle.getInt("EVT_PARAM1", 0);
|
||||
// float height = bundle.getInt("EVT_PARAM2", 0);
|
||||
// L.e(TAG, "流---width----->" + width);
|
||||
// L.e(TAG, "流---height----->" + height);
|
||||
|
||||
|
||||
|
||||
// RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
// int targetH = 0;
|
||||
// if (width / height > 0.5625f) {//横屏 9:16=0.5625
|
||||
// targetH = (int) (mVideoView.getWidth() / width * height);
|
||||
// } else {
|
||||
// targetH = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
// }
|
||||
// if (targetH != params.height) {
|
||||
// params.height = targetH;
|
||||
// params.addRule(RelativeLayout.CENTER_IN_PARENT);
|
||||
// mVideoView.requestLayout();
|
||||
// }
|
||||
|
||||
break;
|
||||
case TXLiveConstants.PLAY_ERR_NET_DISCONNECT://播放失败
|
||||
case TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND:
|
||||
ToastUtil.show(mContext.getString(R.string.live_play_error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,6 @@ import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.tencent.rtmp.ITXLivePushListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.TXLivePushConfig;
|
||||
import com.tencent.rtmp.TXLivePusher;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
@@ -22,11 +17,11 @@ import com.yunbao.live.R;
|
||||
* 连麦推流小窗口 腾讯sdk
|
||||
*/
|
||||
|
||||
public class LiveLinkMicPushTxViewHolder extends AbsLiveLinkMicPushViewHolder implements ITXLivePushListener {
|
||||
public class LiveLinkMicPushTxViewHolder extends AbsLiveLinkMicPushViewHolder {
|
||||
|
||||
private static final String TAG = "LiveLinkMicPushTxViewHolder";
|
||||
private TXLivePusher mLivePusher;
|
||||
private TXLivePushConfig mLivePushConfig;
|
||||
// private TXLivePusher mLivePusher;
|
||||
// private TXLivePushConfig mLivePushConfig;
|
||||
|
||||
public LiveLinkMicPushTxViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
@@ -39,7 +34,7 @@ public class LiveLinkMicPushTxViewHolder extends AbsLiveLinkMicPushViewHolder im
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
mLivePusher = new TXLivePusher(mContext);
|
||||
/* mLivePusher = new TXLivePusher(mContext);
|
||||
mLivePushConfig = new TXLivePushConfig();
|
||||
mLivePushConfig.setVideoFPS(15);//视频帧率
|
||||
mLivePushConfig.setVideoEncodeGop(1);//GOP大小
|
||||
@@ -55,7 +50,7 @@ public class LiveLinkMicPushTxViewHolder extends AbsLiveLinkMicPushViewHolder im
|
||||
mLivePusher.setConfig(mLivePushConfig);
|
||||
mLivePusher.setMirror(true);
|
||||
mLivePusher.setPushListener(this);
|
||||
mLivePusher.setMicVolume(4f);
|
||||
mLivePusher.setMicVolume(4f);*/
|
||||
}
|
||||
|
||||
|
||||
@@ -66,16 +61,16 @@ public class LiveLinkMicPushTxViewHolder extends AbsLiveLinkMicPushViewHolder im
|
||||
*/
|
||||
@Override
|
||||
public void startPush(String pushUrl) {
|
||||
if (mLivePusher != null) {
|
||||
/* if (mLivePusher != null) {
|
||||
mLivePusher.startCameraPreview((TXCloudVideoView) findViewById(R.id.camera_preview));
|
||||
mLivePusher.startPusher(pushUrl);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mLivePushListener = null;
|
||||
if (mLivePusher != null) {
|
||||
/* if (mLivePusher != null) {
|
||||
mLivePusher.stopPusher();
|
||||
mLivePusher.stopScreenCapture();
|
||||
mLivePusher.stopCameraPreview(false);
|
||||
@@ -85,70 +80,26 @@ public class LiveLinkMicPushTxViewHolder extends AbsLiveLinkMicPushViewHolder im
|
||||
if (mLivePushConfig != null) {
|
||||
mLivePushConfig.setPauseImg(null);
|
||||
}
|
||||
mLivePushConfig = null;
|
||||
mLivePushConfig = null;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
mPaused = true;
|
||||
if (mStartPush && mLivePusher != null) {
|
||||
/*if (mStartPush && mLivePusher != null) {
|
||||
mLivePusher.pausePusher();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
if (mPaused && mStartPush && mLivePusher != null) {
|
||||
/*if (mPaused && mStartPush && mLivePusher != null) {
|
||||
mLivePusher.resumePusher();
|
||||
}
|
||||
}*/
|
||||
mPaused = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPushEvent(int e, Bundle bundle) {
|
||||
if (e == TXLiveConstants.PUSH_ERR_OPEN_CAMERA_FAIL) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_push_failed_1));
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPushFailed();
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_ERR_OPEN_MIC_FAIL) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_push_failed_1));
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPushFailed();
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_ERR_NET_DISCONNECT || e == TXLiveConstants.PUSH_ERR_INVALID_ADDRESS) {
|
||||
L.e(TAG, "网络断开,推流失败------>");
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPushFailed();
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_WARNING_HW_ACCELERATION_FAIL) {
|
||||
L.e(TAG, "不支持硬件加速------>");
|
||||
if (mLivePushConfig != null && mLivePusher != null) {
|
||||
mLivePushConfig.setHardwareAcceleration(TXLiveConstants.ENCODE_VIDEO_SOFTWARE);
|
||||
mLivePusher.setConfig(mLivePushConfig);
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_EVT_FIRST_FRAME_AVAILABLE) {//预览成功
|
||||
L.e(TAG, "mStearm--->初始化完毕");
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPreviewStart();
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_EVT_PUSH_BEGIN) {//推流成功
|
||||
L.e(TAG, "mStearm--->推流成功");
|
||||
if (!mStartPush) {
|
||||
mStartPush = true;
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPushStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
private Bitmap decodeResource(Resources resources, int id) {
|
||||
TypedValue value = new TypedValue();
|
||||
resources.openRawResource(id, value);
|
||||
|
||||
@@ -11,10 +11,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.tencent.live2.V2TXLiveDef;
|
||||
import com.tencent.live2.V2TXLivePlayer;
|
||||
import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
@@ -35,8 +31,8 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private ViewGroup mLeftContainer;
|
||||
private ViewGroup mRightContainer;
|
||||
private RelativeLayout mPkContainer;
|
||||
public static TXCloudVideoView mVideoView;
|
||||
private V2TXLivePlayer mPlayer;
|
||||
// public static TXCloudVideoView mVideoView;
|
||||
// private V2TXLivePlayer mPlayer;
|
||||
|
||||
private View mLoading;
|
||||
private ImageView mCover;
|
||||
@@ -78,7 +74,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
mLeftContainer = (ViewGroup) findViewById(R.id.left_container);
|
||||
mRightContainer = (ViewGroup) findViewById(R.id.right_container);
|
||||
mPkContainer = (RelativeLayout) findViewById(R.id.pk_container);
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
// mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
leave = (ImageView) findViewById(R.id.leave);
|
||||
mLoading = findViewById(R.id.loading);
|
||||
mCover = (ImageView) findViewById(R.id.cover);
|
||||
@@ -129,14 +125,14 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
*/
|
||||
@Override
|
||||
public void play(String url,int playModel) {
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
/* mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mPlayer.setRenderView(mVideoView);
|
||||
mPlayer.startPlay(url);
|
||||
mPlayer.startPlay(url);*/
|
||||
// mPlayer.setRenderFillMode(V2TXLiveDef.V2TXLiveFillMode.V2TXLiveFillModeFit);
|
||||
onPrepared();
|
||||
|
||||
@@ -152,7 +148,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
public void release() {
|
||||
mEnd = true;
|
||||
mStarted = false;
|
||||
mPlayer.stopPlay();
|
||||
// mPlayer.stopPlay();
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
|
||||
@@ -169,20 +165,20 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@Override
|
||||
public void stopPlay2() {
|
||||
if (mPlayer != null) {
|
||||
/*if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void setViewUP() {
|
||||
Log.i("收", "整理");
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
|
||||
// params.height = contexts.getResources().getDimensionPixelOffset(R.dimen.live_view);
|
||||
params.height = vHeight;
|
||||
params.topMargin = contexts.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);*/
|
||||
// mVideoView.requestLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,17 +202,17 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
if (landscape == 2) {
|
||||
Log.i("收到socket--->", "还原9:16");
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/* RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
params.topMargin = 0;
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
} else {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
// params.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_view);
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
}
|
||||
hideCover();
|
||||
}
|
||||
@@ -224,12 +220,12 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
@Override
|
||||
public void setPkview() {
|
||||
Log.i("收到socket--->", "变成16:9");
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
// params.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_view);
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,18 +235,18 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
if (landscape == 2) {
|
||||
Log.i("收到socket--->", "还原9:16");
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
params.topMargin = 0;
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
|
||||
} else {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/*RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
// params.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_view);
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +318,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@Override
|
||||
public void changeToLeft() {
|
||||
if (mVideoView != null) {
|
||||
/* if (mVideoView != null) {
|
||||
|
||||
//
|
||||
// RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mVideoView.getWidth() / 2, DpUtil.dp2px(250));
|
||||
@@ -336,7 +332,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
|
||||
}
|
||||
}*/
|
||||
if (mLoading != null && mLeftContainer != null) {
|
||||
ViewParent viewParent = mLoading.getParent();
|
||||
if (viewParent != null) {
|
||||
@@ -351,11 +347,11 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@Override
|
||||
public void changeToBig() {
|
||||
if (mVideoView != null) {
|
||||
/*if (mVideoView != null) {
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
mVideoView.setLayoutParams(params);
|
||||
|
||||
}
|
||||
}*/
|
||||
if (mLoading != null && mRoot != null) {
|
||||
ViewParent viewParent = mLoading.getParent();
|
||||
if (viewParent != null) {
|
||||
@@ -370,10 +366,10 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (!mPausedPlay && mPaused && mVideoView != null) {
|
||||
/* if (!mPausedPlay && mPaused && mVideoView != null) {
|
||||
// mVideoView.runInForeground();
|
||||
// mVideoView.start();
|
||||
}
|
||||
}*/
|
||||
mPaused = false;
|
||||
}
|
||||
|
||||
@@ -393,24 +389,24 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
//全屏
|
||||
@Override
|
||||
public void fullScreen() {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/* RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
params.topMargin = 0;
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation270);
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
}
|
||||
|
||||
//小屏
|
||||
@Override
|
||||
public void smallScreen() {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
/* RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
// params.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_view);
|
||||
params.height = vHeight;
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation0);
|
||||
mVideoView.requestLayout();
|
||||
mVideoView.requestLayout();*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,545 +0,0 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.live2.V2TXLiveDef;
|
||||
import com.tencent.live2.V2TXLivePlayer;
|
||||
import com.tencent.live2.V2TXLivePlayerObserver;
|
||||
import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLivePlayConfig;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.common.http.LiveHttpConsts;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/10.
|
||||
* 直播间播放器 腾讯播放器
|
||||
*/
|
||||
|
||||
public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXLivePlayListener {
|
||||
|
||||
private static final String TAG = "LiveTxPlayViewHolder";
|
||||
private ViewGroup mRoot;
|
||||
private ViewGroup mSmallContainer;
|
||||
private ViewGroup mLeftContainer;
|
||||
private ViewGroup mRightContainer;
|
||||
private ViewGroup mPkContainer;
|
||||
private TXCloudVideoView mVideoView;
|
||||
private View mLoading;
|
||||
private ImageView mCover;
|
||||
private V2TXLivePlayer mPlayer;
|
||||
private boolean mPaused;//是否切后台了
|
||||
private boolean mStarted;//是否开始了播放
|
||||
private boolean mEnd;//是否结束了播放
|
||||
private boolean mPausedPlay;//是否被动暂停了播放
|
||||
private boolean mChangeToLeft;
|
||||
private boolean mChangeToAnchorLinkMic;
|
||||
private String mUrl;
|
||||
private int mPlayType;
|
||||
private HttpCallback mGetTxLinkMicAccUrlCallback;
|
||||
private Handler mHandler;
|
||||
private int mVideoLastProgress;
|
||||
|
||||
|
||||
public LivePlayTxViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPkview() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPkEndview() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrMicInfo(UserBean u) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLiveBeanLandscape(int landscape) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endPk() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endpk(String liveUid) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSwEngine(String liveUid) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLiveUid(String uid) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDetailView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPkView(String liveUid) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void claerDrPkInfoView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endLiveMic() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_live_play_tx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
mRoot = (ViewGroup) findViewById(R.id.root);
|
||||
mSmallContainer = (ViewGroup) findViewById(R.id.small_container);
|
||||
mLeftContainer = (ViewGroup) findViewById(R.id.left_container);
|
||||
mRightContainer = (ViewGroup) findViewById(R.id.right_container);
|
||||
mPkContainer = (ViewGroup) findViewById(R.id.pk_container);
|
||||
mLoading = findViewById(R.id.loading);
|
||||
mCover = (ImageView) findViewById(R.id.cover);
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
|
||||
// mPlayer.setPlayListener(this);
|
||||
// mPlayer.setPlayerView(mVideoView);
|
||||
// mPlayer.enableHardwareDecode(false);
|
||||
// 设置画面渲染方向
|
||||
// mPlayer.setRenderRotation(TXLiveConstants.RENDER_ROTATION_LANDSCAPE);
|
||||
TXLivePlayConfig playConfig = new TXLivePlayConfig();
|
||||
playConfig.setAutoAdjustCacheTime(true);
|
||||
playConfig.setMaxAutoAdjustCacheTime(5.0f);
|
||||
playConfig.setMinAutoAdjustCacheTime(1.0f);
|
||||
// mPlayer.setConfig(playConfig);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPlayEvent(int e, Bundle bundle) {
|
||||
if (mEnd) {
|
||||
return;
|
||||
}
|
||||
// switch (e) {
|
||||
// case TXLiveConstants.PLAY_EVT_PLAY_BEGIN://播放开始
|
||||
// if (mLoading != null && mLoading.getVisibility() == View.VISIBLE) {
|
||||
// mLoading.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_EVT_PLAY_LOADING:
|
||||
// if (mLoading != null && mLoading.getVisibility() != View.VISIBLE) {
|
||||
// mLoading.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME://第一帧
|
||||
// hideCover();
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_EVT_PLAY_END://播放结束
|
||||
// replay();
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION://获取视频宽高
|
||||
// if (mChangeToLeft || mChangeToAnchorLinkMic) {
|
||||
// return;
|
||||
// }
|
||||
// float width = bundle.getInt("EVT_PARAM1", 0);
|
||||
// float height = bundle.getInt("EVT_PARAM2", 0);
|
||||
// L.e(TAG, "流---width----->" + width);
|
||||
// L.e(TAG, "流---height----->" + height);
|
||||
// FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
// int targetH = 0;
|
||||
// if (width >= height) {//横屏 9:16=0.5625
|
||||
// targetH = (int) (mVideoView.getWidth() / width * height);
|
||||
// } else {
|
||||
// targetH = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
// }
|
||||
// if (targetH != params.height) {
|
||||
// params.height = targetH;
|
||||
// params.gravity = Gravity.TOP;
|
||||
// params.topMargin = 230;
|
||||
// mVideoView.requestLayout();
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_ERR_NET_DISCONNECT://播放失败
|
||||
// case TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND:
|
||||
// ToastUtil.show(mContext.getString(R.string.live_play_error));
|
||||
// break;
|
||||
// case TXLiveConstants.PLAY_EVT_PLAY_PROGRESS:
|
||||
// int progress = bundle.getInt("EVT_PLAY_PROGRESS_MS");
|
||||
// if (mVideoLastProgress == progress) {
|
||||
// replay();
|
||||
// } else {
|
||||
// mVideoLastProgress = progress;
|
||||
// }
|
||||
// break;
|
||||
// default:break;
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void hideCover() {
|
||||
if (mCover != null) {
|
||||
mCover.animate().alpha(0).setDuration(500).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCover(String coverUrl) {
|
||||
if (mCover != null) {
|
||||
ImgLoader.displayBlur(mContext, coverUrl, mCover);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fullScreen() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void smallScreen() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环播放
|
||||
*/
|
||||
private void replay() {
|
||||
if (mStarted && mPlayer != null) {
|
||||
// mPlayer.seek(0);
|
||||
// mPlayer.resume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 暂停播放
|
||||
*/
|
||||
@Override
|
||||
public void pausePlay() {
|
||||
if (!mPausedPlay) {
|
||||
mPausedPlay = true;
|
||||
if (!mPaused) {
|
||||
if (mPlayer != null) {
|
||||
// mPlayer.pause();
|
||||
}
|
||||
}
|
||||
if (mCover != null) {
|
||||
mCover.setAlpha(1f);
|
||||
if (mCover.getVisibility() != View.VISIBLE) {
|
||||
mCover.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停播放后恢复
|
||||
*/
|
||||
@Override
|
||||
public void resumePlay() {
|
||||
if (mPausedPlay) {
|
||||
mPausedPlay = false;
|
||||
if (!mPaused) {
|
||||
if (mPlayer != null) {
|
||||
// mPlayer.resume();
|
||||
}
|
||||
}
|
||||
hideCover();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始播放
|
||||
*
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url,int playModel) {
|
||||
url = "webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1";
|
||||
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
mPlayer.setRenderView(mVideoView);
|
||||
mPlayer.setObserver(new V2TXLivePlayerObserver() {
|
||||
|
||||
@Override
|
||||
public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||
Log.d(TAG, "[Player] onError: player-" + player + " code-" + code + " msg-" + msg + " info-" + extraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoPlayStatusUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayStatus status, V2TXLiveDef.V2TXLiveStatusChangeReason reason, Bundle bundle) {
|
||||
Log.d(TAG, "[Player] onVideoPlayStatusUpdate: player-" + player + ", status-" + status + ", reason-" + reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarning(V2TXLivePlayer v2TXLivePlayer, int i, String s, Bundle bundle) {
|
||||
Log.d(TAG, "[Player] Override: player-" + v2TXLivePlayer + ", i-" + i + ", s-" + s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderVideoFrame(V2TXLivePlayer player, V2TXLiveDef.V2TXLiveVideoFrame v2TXLiveVideoFrame) {
|
||||
super.onRenderVideoFrame(player, v2TXLiveVideoFrame);
|
||||
Log.d(TAG, "[Player] onRenderVideoFrame: player-" + player + ", v2TXLiveVideoFrame-" + v2TXLiveVideoFrame);
|
||||
}
|
||||
});
|
||||
|
||||
int result = mPlayer.startPlay(url);
|
||||
|
||||
Log.d(TAG, "startPlay : " + result);
|
||||
// if (TextUtils.isEmpty(url)) {
|
||||
// return;
|
||||
// }
|
||||
// int playType = -1;
|
||||
// if (url.startsWith("rtmp://")) {
|
||||
// playType = TXLivePlayer.PLAY_TYPE_LIVE_RTMP;
|
||||
// } else if (url.endsWith(".flv")) {
|
||||
// playType = TXLivePlayer.PLAY_TYPE_LIVE_FLV;
|
||||
// } else if (url.endsWith(".m3u8")) {
|
||||
// playType = TXLivePlayer.PLAY_TYPE_VOD_HLS;
|
||||
// } else if (url.endsWith(".mp4")) {
|
||||
// playType = TXLivePlayer.PLAY_TYPE_VOD_MP4;
|
||||
// }
|
||||
// if (playType == -1) {
|
||||
// ToastUtil.show(R.string.live_play_error_2);
|
||||
// return;
|
||||
// }
|
||||
// if (mPlayer != null) {
|
||||
// int result = mPlayer.startPlay(url);
|
||||
// if (result == 0) {
|
||||
mStarted = true;
|
||||
|
||||
// mUrl = url;
|
||||
// mPlayType = playType;
|
||||
// }
|
||||
// }
|
||||
L.e(TAG, "play----url--->" + url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchStream(String url, int playModel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay() {
|
||||
mChangeToLeft = false;
|
||||
mChangeToAnchorLinkMic = false;
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
if (mCover != null) {
|
||||
mCover.setAlpha(1f);
|
||||
if (mCover.getVisibility() != View.VISIBLE) {
|
||||
mCover.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
stopPlay2();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay2() {
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mEnd = true;
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
mHandler = null;
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_TX_LINK_MIC_ACC_URL);
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
// mPlayer.setPlayListener(null);
|
||||
}
|
||||
mPlayer = null;
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ViewGroup getSmallContainer() {
|
||||
return mSmallContainer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ViewGroup getRightContainer() {
|
||||
return mRightContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewGroup getPkContainer() {
|
||||
return mPkContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToLeft() {
|
||||
// mChangeToLeft = true;
|
||||
// if (mVideoView != null) {
|
||||
// FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
// params.width = mVideoView.getWidth() / 2;
|
||||
// params.height = DpUtil.dp2px(250);
|
||||
// params.topMargin = DpUtil.dp2px(130);
|
||||
// mVideoView.setLayoutParams(params);
|
||||
// }
|
||||
// if (mLoading != null && mLeftContainer != null) {
|
||||
// ViewParent viewParent = mLoading.getParent();
|
||||
// if (viewParent != null) {
|
||||
// ((ViewGroup) viewParent).removeView(mLoading);
|
||||
// }
|
||||
// FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(DpUtil.dp2px(24), DpUtil.dp2px(24));
|
||||
// params.gravity = Gravity.CENTER;
|
||||
// mLoading.setLayoutParams(params);
|
||||
// mLeftContainer.addView(mLoading);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToBig() {
|
||||
// mChangeToLeft = false;
|
||||
// if (mVideoView != null) {
|
||||
// FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
// params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
// params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
// params.topMargin = 0;
|
||||
// mVideoView.setLayoutParams(params);
|
||||
// }
|
||||
// if (mLoading != null && mRoot != null) {
|
||||
// ViewParent viewParent = mLoading.getParent();
|
||||
// if (viewParent != null) {
|
||||
// ((ViewGroup) viewParent).removeView(mLoading);
|
||||
// }
|
||||
// FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(DpUtil.dp2px(24), DpUtil.dp2px(24));
|
||||
// params.gravity = Gravity.CENTER;
|
||||
// mLoading.setLayoutParams(params);
|
||||
// mRoot.addView(mLoading);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (!mPausedPlay && mPaused && mPlayer != null) {
|
||||
// mPlayer.resume();
|
||||
}
|
||||
mPaused = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (!mPausedPlay && mPlayer != null) {
|
||||
// mPlayer.pause();
|
||||
}
|
||||
mPaused = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
release();
|
||||
}
|
||||
|
||||
/**
|
||||
* 腾讯sdk连麦时候切换低延时流
|
||||
*/
|
||||
public void onLinkMicTxAccEvent(boolean linkMic) {
|
||||
if (mStarted && mPlayer != null && !TextUtils.isEmpty(mUrl)) {
|
||||
mPlayer.stopPlay();
|
||||
if (linkMic) {
|
||||
if (mGetTxLinkMicAccUrlCallback == null) {
|
||||
mGetTxLinkMicAccUrlCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj != null) {
|
||||
String accUrl = obj.getString("streamUrlWithSignature");
|
||||
if (!TextUtils.isEmpty(accUrl) && mPlayer != null) {
|
||||
L.e(TAG, "低延时流----->" + accUrl);
|
||||
mPlayer.startPlay(accUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
LiveHttpUtil.getTxLinkMicAccUrl(mUrl, mGetTxLinkMicAccUrlCallback);
|
||||
} else {
|
||||
mPlayer.startPlay(mUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置主播连麦模式
|
||||
*
|
||||
* @param anchorLinkMic
|
||||
*/
|
||||
public void setAnchorLinkMic(final boolean anchorLinkMic, int delayTime) {
|
||||
// if (mVideoView == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (mHandler == null) {
|
||||
// mHandler = new Handler();
|
||||
// }
|
||||
// mHandler.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// mChangeToAnchorLinkMic = anchorLinkMic;
|
||||
// FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
// Log.d("aaaaa",""+anchorLinkMic);
|
||||
// if (anchorLinkMic) {
|
||||
// params.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_view);
|
||||
// params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
// params.gravity = Gravity.TOP;
|
||||
// } else {
|
||||
// params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
// params.topMargin = 0;
|
||||
// params.gravity = Gravity.CENTER;
|
||||
// }
|
||||
// mVideoView.setLayoutParams(params);
|
||||
// }
|
||||
// }, delayTime);
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,6 @@ import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.tencent.rtmp.ITXLivePushListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
@@ -73,7 +71,7 @@ import io.rong.message.TextMessage;
|
||||
* 腾讯云直播推流
|
||||
*/
|
||||
|
||||
public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITXLivePushListener {
|
||||
public class LivePushSwViewHolder extends AbsRyLivePushViewHolder {
|
||||
private int mMeiBaiVal;//基础美颜 美白
|
||||
private int mMoPiVal;//基础美颜 磨皮
|
||||
private int mHongRunVal;//基础美颜 红润
|
||||
@@ -529,8 +527,9 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
// rtcRoom = null;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void onPushEvent(int e, Bundle bundle) {
|
||||
public void onPushEvent(int e, Bundle bundle) {
|
||||
if (e == TXLiveConstants.PUSH_ERR_OPEN_CAMERA_FAIL) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_push_failed_1));
|
||||
|
||||
@@ -562,7 +561,7 @@ public class LivePushSwViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
private void aheadOfScheduleEndPK(String pkUid, String uname, String pkname) {
|
||||
if (!isPk) {
|
||||
|
||||
@@ -20,13 +20,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.liteav.device.TXDeviceManager;
|
||||
import com.tencent.rtmp.ITXLivePushListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.tencent.trtc.TRTCCloudListener;
|
||||
import com.google.android.exoplayer2.ui.StyledPlayerView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
@@ -49,16 +43,13 @@ import com.yunbao.live.socket.SocketSendBean;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_APP_SCENE_LIVE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
* 腾讯云直播推流
|
||||
*/
|
||||
|
||||
public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLivePushListener {
|
||||
public class LivePushTxViewHolder extends AbsLivePushViewHolder {
|
||||
|
||||
private int mMeiBaiVal;//基础美颜 美白
|
||||
private int mMoPiVal;//基础美颜 磨皮
|
||||
@@ -66,9 +57,9 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
private String mBgmPath;//背景音乐路径
|
||||
private Bitmap mFilterBmp;
|
||||
|
||||
public static TRTCCloud mTRTCCloud;
|
||||
private TXDeviceManager mTXDeviceManager;
|
||||
private TRTCCloudDef.TRTCParams mTRTCParams;
|
||||
// public static TRTCCloud mTRTCCloud;
|
||||
// private TXDeviceManager mTXDeviceManager;
|
||||
// private TRTCCloudDef.TRTCParams mTRTCParams;
|
||||
private Handler mMainHandler;
|
||||
public TencentTRTCBeautyManager tencentTRTCBeautyManager;
|
||||
public static Context contexts;
|
||||
@@ -89,19 +80,19 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
mPreView = (TXCloudVideoView) findViewById(R.id.camera_preview);
|
||||
mPreView1 = (TXCloudVideoView) findViewById(R.id.camera_preview1);
|
||||
dr1_preview = (TXCloudVideoView) findViewById(R.id.dr1_preview);
|
||||
dr2_preview = (TXCloudVideoView) findViewById(R.id.dr2_preview);
|
||||
dr3_preview = (TXCloudVideoView) findViewById(R.id.dr3_preview);
|
||||
dr4_preview = (TXCloudVideoView) findViewById(R.id.dr4_preview);
|
||||
mPreView = (StyledPlayerView) findViewById(R.id.camera_preview);
|
||||
mPreView1 = (StyledPlayerView) findViewById(R.id.camera_preview1);
|
||||
dr1_preview = (StyledPlayerView) findViewById(R.id.dr1_preview);
|
||||
dr2_preview = (StyledPlayerView) findViewById(R.id.dr2_preview);
|
||||
dr3_preview = (StyledPlayerView) findViewById(R.id.dr3_preview);
|
||||
dr4_preview = (StyledPlayerView) findViewById(R.id.dr4_preview);
|
||||
leave = (ImageView) findViewById(R.id.leave);
|
||||
dr_pk_view = (LinearLayout) findViewById(R.id.dr_pk_view);
|
||||
dr_pk_view.setVisibility(View.GONE);
|
||||
btn_close = (TextView) findViewById(R.id.btn_close);
|
||||
mTRTCCloud = TRTCCloud.sharedInstance(mContext);
|
||||
// mTRTCCloud = TRTCCloud.sharedInstance(mContext);
|
||||
mMainHandler = new Handler(Looper.getMainLooper());
|
||||
btn_close.setOnClickListener(new View.OnClickListener() {
|
||||
/* btn_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
DialogUitl.showSimpleDialog(mContext, WordUtil.isNewZh()?"是否要斷開連麥?":"Do you want to disconnect Link?", new DialogUitl.SimpleCallback() {
|
||||
@@ -227,7 +218,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
tencentTRTCBeautyManager.textureDestoryed();
|
||||
}
|
||||
});
|
||||
enterRoom();
|
||||
enterRoom();*/
|
||||
}
|
||||
|
||||
|
||||
@@ -260,7 +251,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
} else {
|
||||
mCameraFront = true;
|
||||
}
|
||||
mTXDeviceManager.switchCamera(mCameraFront);
|
||||
// mTXDeviceManager.switchCamera(mCameraFront);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,13 +279,13 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
@Override
|
||||
public void startPush(String pushUrl) {
|
||||
|
||||
mTRTCCloud.enterRoom(mTRTCParams, TRTC_APP_SCENE_LIVE);
|
||||
mTRTCCloud.startPublishing(getLiveStream(), TRTC_VIDEO_STREAM_TYPE_BIG);
|
||||
// mTRTCCloud.enterRoom(mTRTCParams, TRTC_APP_SCENE_LIVE);
|
||||
// mTRTCCloud.startPublishing(getLiveStream(), TRTC_VIDEO_STREAM_TYPE_BIG);
|
||||
startCountDown();
|
||||
}
|
||||
|
||||
|
||||
protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
/* protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
|
||||
private WeakReference<Context> mContext;
|
||||
|
||||
@@ -426,7 +417,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
// Bitmap bitmap = decodeResource(mContext.getResources(), R.mipmap.bg_live_tx_pause);
|
||||
|
||||
mTRTCCloud.startLocalAudio(TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
@@ -480,10 +471,10 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
public void release() {
|
||||
super.release();
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.LINK_MIC_TX_MIX_STREAM);
|
||||
mTRTCCloud = null;
|
||||
// mTRTCCloud = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public void onPushEvent(int e, Bundle bundle) {
|
||||
if (e == TXLiveConstants.PUSH_ERR_OPEN_CAMERA_FAIL) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_push_failed_1));
|
||||
@@ -519,7 +510,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
private Bitmap decodeResource(Resources resources, int id) {
|
||||
TypedValue value = new TypedValue();
|
||||
|
||||
@@ -19,11 +19,6 @@ import android.widget.FrameLayout;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tencent.rtmp.ITXLivePushListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.TXLivePushConfig;
|
||||
import com.tencent.rtmp.TXLivePusher;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.utils.DownloadUtil;
|
||||
@@ -47,11 +42,11 @@ import cn.qqtheme.framework.util.ScreenUtils;
|
||||
* 腾讯云直播推流
|
||||
*/
|
||||
|
||||
public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder implements ITXLivePushListener, SurfaceHolder.Callback,
|
||||
public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder implements SurfaceHolder.Callback,
|
||||
SurfaceTexture.OnFrameAvailableListener, Camera.PreviewCallback {
|
||||
|
||||
private TXLivePusher mLivePusher;
|
||||
private TXLivePushConfig mLivePushConfig;
|
||||
// private TXLivePusher mLivePusher;
|
||||
// private TXLivePushConfig mLivePushConfig;
|
||||
private int mMeiBaiVal;//基础美颜 美白
|
||||
private int mMoPiVal;//基础美颜 磨皮
|
||||
private int mHongRunVal;//基础美颜 红润
|
||||
@@ -87,7 +82,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
super.init();
|
||||
String mBeauty360TieZhiUrl= CommonAppConfig.getInstance().getBeauty360TieZhiUrl();
|
||||
|
||||
mLivePusher = new TXLivePusher(mContext);
|
||||
/* mLivePusher = new TXLivePusher(mContext);
|
||||
mLivePushConfig = new TXLivePushConfig();
|
||||
mLivePushConfig.setVideoFPS(15);//视频帧率
|
||||
mLivePushConfig.setVideoEncodeGop(1);//GOP大小
|
||||
@@ -108,7 +103,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
mLivePusher.setMicVolume(4f);
|
||||
|
||||
mLivePusher.setConfig(mLivePushConfig);
|
||||
mLivePusher.setPushListener(this);
|
||||
mLivePusher.setPushListener(this);*/
|
||||
|
||||
initBeauty360();
|
||||
|
||||
@@ -141,7 +136,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
String mBeautySdkType= CommonAppConfig.getInstance().getBeautySdkType();
|
||||
Log.d("mBeautySdkType",mBeautySdkType);
|
||||
if ("2".equals(mBeautySdkType)) {
|
||||
mLivePusher.setVideoProcessListener(new TXLivePusher.VideoCustomProcessListener() {
|
||||
/* mLivePusher.setVideoProcessListener(new TXLivePusher.VideoCustomProcessListener() {
|
||||
@Override
|
||||
public int onTextureCustomProcess(int i, int i1, int i2) {
|
||||
|
||||
@@ -154,7 +149,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
public void onTextureDestoryed() {
|
||||
}
|
||||
});
|
||||
mLivePusher.startCameraPreview((TXCloudVideoView) mPreView);
|
||||
mLivePusher.startCameraPreview((TXCloudVideoView) mPreView);*/
|
||||
} else if ("3".equals(mBeautySdkType)){
|
||||
|
||||
//遍历解压缩后的文件夹,获取所有贴纸列表
|
||||
@@ -174,7 +169,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
download360TieZhi(mBeauty360TieZhiUrl,CommonAppConfig.TIEZHI_360_NAME+".zip");
|
||||
}
|
||||
}else {
|
||||
mLivePusher.startCameraPreview((TXCloudVideoView) mPreView);
|
||||
// mLivePusher.startCameraPreview((TXCloudVideoView) mPreView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -296,7 +291,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
*/
|
||||
@Override
|
||||
public void toggleCamera() {
|
||||
if (mLivePusher != null) {
|
||||
/* if (mLivePusher != null) {
|
||||
if (mFlashOpen) {
|
||||
toggleFlash();
|
||||
}
|
||||
@@ -304,7 +299,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
// mPreviewUtils.switchCamera();
|
||||
mCameraFront = !mCameraFront;
|
||||
mLivePusher.setMirror(mCameraFront);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -317,14 +312,14 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
ToastUtil.show(mContext.getString(R.string.live_open_flash));
|
||||
return;
|
||||
}
|
||||
if (mLivePusher != null) {
|
||||
/* if (mLivePusher != null) {
|
||||
boolean open = !mFlashOpen;
|
||||
// if (mLivePusher.turnOnFlashLight(open)) {
|
||||
// mFlashOpen = open;
|
||||
// }
|
||||
// mPreviewUtils.switchCameraFlashLight();
|
||||
mFlashOpen = open;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,10 +329,10 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
*/
|
||||
@Override
|
||||
public void startPush(String pushUrl) {
|
||||
if (mLivePusher != null) {
|
||||
/*if (mLivePusher != null) {
|
||||
//启动 RTMP 推流 0-启动成功,1-启动失败
|
||||
mLivePusher.startPusher(pushUrl);
|
||||
}
|
||||
}*/
|
||||
startCountDown();
|
||||
}
|
||||
|
||||
@@ -345,10 +340,10 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
@Override
|
||||
public void onPause() {
|
||||
mPaused = true;
|
||||
if (mStartPush && mLivePusher != null) {
|
||||
/* if (mStartPush && mLivePusher != null) {
|
||||
mLivePusher.pauseBGM();
|
||||
mLivePusher.pausePusher();
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// mPreviewUtils.pause();
|
||||
@@ -363,10 +358,10 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (mPaused && mStartPush && mLivePusher != null) {
|
||||
/* if (mPaused && mStartPush && mLivePusher != null) {
|
||||
mLivePusher.resumePusher();
|
||||
mLivePusher.resumeBGM();
|
||||
}
|
||||
}*/
|
||||
mPaused = false;
|
||||
|
||||
//camera
|
||||
@@ -405,33 +400,33 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
}
|
||||
@Override
|
||||
public void startBgm(String path) {
|
||||
if (mLivePusher != null) {
|
||||
/*if (mLivePusher != null) {
|
||||
boolean result = mLivePusher.playBGM(path);
|
||||
if (result) {
|
||||
mBgmPath = path;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseBgm() {
|
||||
if (mLivePusher != null) {
|
||||
/*if (mLivePusher != null) {
|
||||
mLivePusher.pauseBGM();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeBgm() {
|
||||
if (mLivePusher != null) {
|
||||
/* if (mLivePusher != null) {
|
||||
mLivePusher.resumeBGM();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopBgm() {
|
||||
if (mLivePusher != null) {
|
||||
/*if (mLivePusher != null) {
|
||||
mLivePusher.stopBGM();
|
||||
}
|
||||
}*/
|
||||
mBgmPath = null;
|
||||
}
|
||||
|
||||
@@ -446,7 +441,7 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
public void release() {
|
||||
super.release();
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.LINK_MIC_TX_MIX_STREAM);
|
||||
if (mLivePusher != null) {
|
||||
/* if (mLivePusher != null) {
|
||||
mLivePusher.stopBGM();
|
||||
mLivePusher.stopPusher();
|
||||
// mLivePusher.stopScreenCapture();
|
||||
@@ -459,52 +454,12 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
if (mLivePushConfig != null) {
|
||||
mLivePushConfig.setPauseImg(null);
|
||||
}
|
||||
mLivePushConfig = null;
|
||||
mLivePushConfig = null;*/
|
||||
|
||||
// mPreviewUtils.freeRes();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPushEvent(int e, Bundle bundle) {
|
||||
// String msg = bundle.getString(TXLiveConstants.EVT_DESCRIPTION);
|
||||
|
||||
Log.d("onPushEvent",""+e+" "+bundle.toString());
|
||||
if (e == TXLiveConstants.PUSH_ERR_OPEN_CAMERA_FAIL) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_push_failed_1));
|
||||
|
||||
} else if (e == TXLiveConstants.PUSH_ERR_OPEN_MIC_FAIL) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_push_failed_2));
|
||||
|
||||
} else if (e == TXLiveConstants.PUSH_ERR_NET_DISCONNECT || e == TXLiveConstants.PUSH_ERR_INVALID_ADDRESS) {
|
||||
L.e(TAG, "网络断开,推流失败------>");
|
||||
|
||||
} else if (e == TXLiveConstants.PUSH_WARNING_HW_ACCELERATION_FAIL) {
|
||||
L.e(TAG, "不支持硬件加速------>");
|
||||
if (mLivePushConfig != null && mLivePusher != null) {
|
||||
mLivePushConfig.setHardwareAcceleration(TXLiveConstants.ENCODE_VIDEO_SOFTWARE);
|
||||
mLivePusher.setConfig(mLivePushConfig);
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_EVT_FIRST_FRAME_AVAILABLE) {//预览成功
|
||||
L.e(TAG, "mStearm--->初始化完毕");
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPreviewStart();
|
||||
}
|
||||
} else if (e == TXLiveConstants.PUSH_EVT_PUSH_BEGIN) {//推流成功
|
||||
L.e(TAG, "mStearm--->推流成功");
|
||||
if (!mStartPush) {
|
||||
mStartPush = true;
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPushStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
private Bitmap decodeResource(Resources resources, int id) {
|
||||
TypedValue value = new TypedValue();
|
||||
@@ -684,10 +639,10 @@ public class LivePushTxViewHolder360Beauty extends AbsLivePushViewHolder impleme
|
||||
if (mLivePushListener != null) {
|
||||
mLivePushListener.onPreviewStart();
|
||||
}
|
||||
if (mLivePusher != null)
|
||||
/*if (mLivePusher != null)
|
||||
{
|
||||
// int ret=mLivePusher.sendCustomVideoData(mPreviewUtils.getSkinSoftenByte(), TXLivePusher.RGB_RGBA, mPreviewUtils.getCameraHeight(), mPreviewUtils.getCameraWidth());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
import static com.yunbao.live.views.LivePushTxViewHolder.mTRTCCloud;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -23,9 +20,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMSendCallback;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
@@ -221,7 +215,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
||||
} else if (i == R.id.btn_locaiton) {
|
||||
switchLocation();
|
||||
} else if (i == R.id.btn_horizontally) {
|
||||
TRTCCloudDef.TRTCRenderParams t = new TRTCCloudDef.TRTCRenderParams();
|
||||
/* TRTCCloudDef.TRTCRenderParams t = new TRTCCloudDef.TRTCRenderParams();
|
||||
if (mrr == 0) {
|
||||
mrr = 1;
|
||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_ENABLE;
|
||||
@@ -231,7 +225,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
||||
t.mirrorType = TRTC_VIDEO_MIRROR_TYPE_DISABLE;
|
||||
mTRTCCloud.setVideoEncoderMirror(false);
|
||||
}
|
||||
mTRTCCloud.setLocalRenderParams(t);
|
||||
mTRTCCloud.setLocalRenderParams(t);*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,7 +493,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
||||
L.e("tx开播", "createRoom------->" + info[0]);
|
||||
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
||||
UserBean u = appConfig.getUserBean();
|
||||
V2TIMManager.getInstance().createGroup(V2TIMManager.GROUP_TYPE_AVCHATROOM, "g" + appConfig.getUid(), "直播", new V2TIMSendCallback<String>() {
|
||||
/* V2TIMManager.getInstance().createGroup(V2TIMManager.GROUP_TYPE_AVCHATROOM, "g" + appConfig.getUid(), "直播", new V2TIMSendCallback<String>() {
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
@@ -520,7 +514,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
||||
ToastUtil.show("开播失败,联系客服。");
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.TXVodPlayer;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/29.
|
||||
* 直播记录播放页面
|
||||
*/
|
||||
|
||||
public class LiveRecordPlayViewHolder extends AbsViewHolder implements ITXLivePlayListener {
|
||||
|
||||
private static final String TAG = "VideoPlayViewHolder";
|
||||
private TXCloudVideoView mVideoView;
|
||||
private View mLoading;
|
||||
private TXVodPlayer mPlayer;
|
||||
private boolean mClickPaused;
|
||||
private boolean mPaused;
|
||||
private boolean mStarted;
|
||||
private boolean mEnd;
|
||||
private long mDuration;
|
||||
private long mCurTime;
|
||||
private int mProgress;
|
||||
private ActionListener mActionListener;
|
||||
|
||||
public LiveRecordPlayViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_live_record_play;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
mLoading = findViewById(R.id.loading);
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
mVideoView.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
|
||||
mPlayer = new TXVodPlayer(mContext);
|
||||
mPlayer.setPlayerView(mVideoView);
|
||||
mPlayer.setAutoPlay(true);
|
||||
mPlayer.setPlayListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayEvent(int e, Bundle bundle) {
|
||||
switch (e) {
|
||||
case TXLiveConstants.PLAY_EVT_PLAY_PROGRESS://进度条
|
||||
if (mActionListener != null) {
|
||||
int duration = bundle.getInt("EVT_PLAY_DURATION_MS");
|
||||
if (mDuration != duration) {
|
||||
mDuration = duration;
|
||||
mActionListener.onDuration(duration);
|
||||
}
|
||||
int curTime = bundle.getInt("EVT_PLAY_PROGRESS_MS");
|
||||
if (mCurTime != curTime) {
|
||||
mCurTime = curTime;
|
||||
mActionListener.onCurTime(curTime);
|
||||
}
|
||||
int progress = curTime * 100 / duration;
|
||||
if (mProgress != progress) {
|
||||
mProgress = progress;
|
||||
mActionListener.onProgress(progress);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TXLiveConstants.PLAY_EVT_PLAY_BEGIN:
|
||||
if (!mEnd) {
|
||||
L.e(TAG, "VideoPlayView------>播放开始");
|
||||
if (mLoading != null && mLoading.getVisibility() == View.VISIBLE) {
|
||||
mLoading.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else {
|
||||
release();
|
||||
}
|
||||
break;
|
||||
case TXLiveConstants.PLAY_ERR_NET_DISCONNECT:
|
||||
case TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND:
|
||||
ToastUtil.show(mContext.getString(R.string.live_play_error));
|
||||
break;
|
||||
case TXLiveConstants.PLAY_EVT_PLAY_LOADING:
|
||||
if (mLoading != null && mLoading.getVisibility() != View.VISIBLE) {
|
||||
mLoading.setVisibility(View.VISIBLE);
|
||||
}
|
||||
break;
|
||||
case TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME:
|
||||
L.e(TAG, "VideoPlayView------>第一帧");
|
||||
break;
|
||||
case TXLiveConstants.PLAY_EVT_PLAY_END:
|
||||
onReplay();
|
||||
break;
|
||||
case TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION:
|
||||
int width = bundle.getInt("EVT_PARAM1", 0);
|
||||
int height = bundle.getInt("EVT_PARAM2", 0);
|
||||
if (mVideoView != null && width >= height) {//横屏视频
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
float rate = ((float) width) / height;
|
||||
params.height = (int) (mVideoView.getWidth() / rate);
|
||||
params.addRule(RelativeLayout.CENTER_IN_PARENT);
|
||||
mVideoView.requestLayout();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
L.e("onNetStatus-------->");
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环播放
|
||||
*/
|
||||
private void onReplay() {
|
||||
if (!mEnd && mStarted && mPlayer != null) {
|
||||
mPlayer.seek(0);
|
||||
mPlayer.resume();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始播放
|
||||
*/
|
||||
public void play(String url) {
|
||||
if (!mEnd && mPlayer != null) {
|
||||
if (mStarted) {
|
||||
mPlayer.stopPlay(false);
|
||||
}
|
||||
mPlayer.startPlay(url);
|
||||
mStarted = true;
|
||||
L.e(TAG, "play------->" + url);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
mActionListener = null;
|
||||
mEnd = true;
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay(true);
|
||||
}
|
||||
mPlayer = null;
|
||||
if (mVideoView != null) {
|
||||
mVideoView.onDestroy();
|
||||
}
|
||||
mVideoView = null;
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
|
||||
public void clickPause() {
|
||||
mClickPaused = true;
|
||||
if (!mEnd && mPlayer != null) {
|
||||
mPlayer.pause();
|
||||
}
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onClickPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void clickResume() {
|
||||
if (mClickPaused) {
|
||||
mClickPaused = false;
|
||||
if (!mEnd && mPlayer != null) {
|
||||
mPlayer.resume();
|
||||
}
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onClickResume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到视频流指定时间点.
|
||||
* 可实现视频快进,快退,进度条跳转等功能.
|
||||
*
|
||||
* @param time 视频流时间点,小数点后为毫秒
|
||||
*/
|
||||
public void seekTo(float time) {
|
||||
if (!mEnd && mPlayer != null) {
|
||||
mPlayer.seek(time);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
|
||||
void onProgress(int progress);
|
||||
|
||||
void onDuration(long duration);
|
||||
|
||||
void onCurTime(long curTime);
|
||||
|
||||
void onClickPause();
|
||||
|
||||
void onClickResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
mPaused = true;
|
||||
if (!mEnd && !mClickPaused && mPlayer != null) {
|
||||
mPlayer.pause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (mPaused) {
|
||||
mPaused = false;
|
||||
if (!mEnd && !mClickPaused && mPlayer != null) {
|
||||
mPlayer.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveRecordPlayActivity;
|
||||
import com.yunbao.live.adapter.LiveRecordAdapter;
|
||||
import com.yunbao.live.bean.LiveRecordBean;
|
||||
import com.yunbao.common.http.LiveHttpConsts;
|
||||
@@ -127,7 +126,7 @@ public class LiveRecordViewHolder extends AbsUserHomeViewHolder implements OnIte
|
||||
if (mActionListener != null) {
|
||||
UserBean userBean = mActionListener.getUserBean();
|
||||
if (userBean != null) {
|
||||
LiveRecordPlayActivity.forward(mContext, url, userBean);
|
||||
// LiveRecordPlayActivity.forward(mContext, url, userBean);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1355,9 +1355,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
topBanner1 = (Banner) findViewById(R.id.top_banner1);
|
||||
topBanner2 = (Banner) findViewById(R.id.top_banner2);
|
||||
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null ) {
|
||||
/* if (LivePushTxViewHolder.mTRTCCloud != null ) {
|
||||
fans_btn.setVisibility(View.GONE);
|
||||
}
|
||||
}*/
|
||||
mPkRankTopIcon.setVisibility(View.GONE);
|
||||
goto_room_view = (LinearLayout) findViewById(R.id.goto_room_view);
|
||||
goto_room_view.setVisibility(View.GONE);
|
||||
@@ -2343,9 +2343,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
if (d_pk_view != null) {
|
||||
d_pk_view.setVisibility(View.GONE);
|
||||
}
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null ) {
|
||||
/* if (LivePushTxViewHolder.mTRTCCloud != null ) {
|
||||
fans_btn.setVisibility(View.GONE);
|
||||
}
|
||||
}*/
|
||||
mRedVal.setVisibility(View.GONE);
|
||||
mBlueVal.setVisibility(View.GONE);
|
||||
mPkRankTopIcon.setVisibility(View.GONE);
|
||||
@@ -3444,10 +3444,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
});
|
||||
initPkRank();
|
||||
|
||||
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
public void setDelOtherInfo() {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
android:orientation="vertical"
|
||||
tools:context=".activity.LiveTRTCAnchorActivity">
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/live_cloud_view_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/live_cloud_view_two"
|
||||
android:background="@color/color_yellow"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:background="#333"
|
||||
>
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/camera_preview"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/camera_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
@@ -28,13 +28,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/dr1_preview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="125dp"
|
||||
android:background="@mipmap/live_icon_vacancy" />
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/dr2_preview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="125dp"
|
||||
@@ -47,13 +47,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/dr3_preview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="125dp"
|
||||
android:background="@mipmap/live_icon_vacancy" />
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/dr4_preview"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="125dp"
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
android:id="@+id/camera_preview1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000"
|
||||
>
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateBehavior="repeat"
|
||||
android:indeterminateDrawable="@drawable/anim_loading"
|
||||
android:indeterminateOnly="true"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user