Merge remote-tracking branch 'origin/master'
@ -28,6 +28,8 @@ public class EnterRoomNewModel extends BaseModel {
|
||||
private String isUseHotCard = "";//是否使用热度卡
|
||||
@SerializedName("liveRoomActivity")
|
||||
private List<LiveRoomActivityModel> liveRoomActivityModels = new ArrayList<>();//活动列表
|
||||
@SerializedName("clarityType")
|
||||
private int clarityType;
|
||||
|
||||
public List<LiveRoomActivityModel> getLiveRoomActivityModels() {
|
||||
return liveRoomActivityModels;
|
||||
@ -109,4 +111,12 @@ public class EnterRoomNewModel extends BaseModel {
|
||||
this.isUseHotCard = isUseHotCard;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getClarityType() {
|
||||
return clarityType;
|
||||
}
|
||||
|
||||
public void setClarityType(int clarityType) {
|
||||
this.clarityType = clarityType;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.yunbao.live.bean;
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.common.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -17,6 +17,7 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
|
||||
import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
@ -1034,6 +1035,34 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开播设置数据获取
|
||||
*
|
||||
* @param liveUid
|
||||
* @param callback
|
||||
*/
|
||||
public void getLiveStetUpStatus(String liveUid, HttpCallback<LiveStetUpStatusModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getLiveStetUpStatus(liveUid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<LiveStetUpStatusModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<LiveStetUpStatusModel> liveStetUpStatusModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(liveStetUpStatusModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
@ -37,6 +37,8 @@ public class RandomPkManager {
|
||||
private String pkUid;//对方房间ID
|
||||
public static String debugUid;
|
||||
private RankPkInfoBean rankPkInfoBean;//排位赛信息
|
||||
private int exitTimer;//退出倒计时
|
||||
private TimerTask exitTask = null;//退出任务
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private RandomPkManager() {
|
||||
@ -118,6 +120,8 @@ public class RandomPkManager {
|
||||
return String.format(Locale.CHINA, "%02d:%02d", min, sec);
|
||||
}
|
||||
|
||||
private Runnable pkRunnable = this::next;
|
||||
|
||||
/**
|
||||
* 对方拒绝,开始下一轮匹配
|
||||
*/
|
||||
@ -125,11 +129,11 @@ public class RandomPkManager {
|
||||
if (status != PK_STATUS_DEFAULT && status != PK_STATUS_REFUSE) {
|
||||
return;
|
||||
}
|
||||
new Handler(Looper.getMainLooper()).postDelayed(this::next, 5000);
|
||||
handler.postDelayed(pkRunnable, 5000);
|
||||
}
|
||||
|
||||
private void next() {
|
||||
if (task==null) {
|
||||
if (task == null) {
|
||||
return;
|
||||
}
|
||||
status = PK_STATUS_REQUEST;
|
||||
@ -243,19 +247,9 @@ public class RandomPkManager {
|
||||
}
|
||||
}
|
||||
|
||||
private int exitTimer;
|
||||
|
||||
/**
|
||||
* 退出匹配
|
||||
*/
|
||||
public void exitPk() {
|
||||
if (status == PK_STATUS_EXIT_ING) {
|
||||
return;
|
||||
}
|
||||
callEndPkStart();
|
||||
status = PK_STATUS_EXIT_ING;
|
||||
exitTimer = 11;
|
||||
new Timer().schedule(new TimerTask() {
|
||||
private TimerTask createExitTask() {
|
||||
return new TimerTask() {
|
||||
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@ -269,10 +263,25 @@ public class RandomPkManager {
|
||||
end();
|
||||
callEndPkSuccess();
|
||||
cancel();
|
||||
exitTask = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 0, 1000);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出匹配
|
||||
*/
|
||||
public void exitPk() {
|
||||
if (status == PK_STATUS_EXIT_ING) {
|
||||
return;
|
||||
}
|
||||
callEndPkStart();
|
||||
status = PK_STATUS_EXIT_ING;
|
||||
exitTimer = 11;
|
||||
exitTask = createExitTask();
|
||||
new Timer().schedule(exitTask, 0, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -387,6 +396,23 @@ public class RandomPkManager {
|
||||
return exitTimer + "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空状态,下播时调用
|
||||
*/
|
||||
public void release() {
|
||||
status = PK_STATUS_REQUEST;
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
}
|
||||
if (exitTask != null) {
|
||||
exitTask.cancel();
|
||||
}
|
||||
randomPkTimer.clear();
|
||||
rankPkInfoBean = null;
|
||||
pkUid = null;
|
||||
handler.removeCallbacks(pkRunnable);
|
||||
}
|
||||
|
||||
|
||||
public static abstract class OnRandomPkTimer {
|
||||
/**
|
||||
|
@ -6,10 +6,15 @@ import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Point;
|
||||
import android.net.TrafficStats;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* 设备通用类
|
||||
*/
|
||||
@ -97,10 +102,40 @@ public class DeviceUtils {
|
||||
return mi.lowMemory;
|
||||
}
|
||||
|
||||
public static String getMemory(Context context) {
|
||||
/**
|
||||
* 获取可用内存 格式化
|
||||
*/
|
||||
public static String getMemoryToFormat(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||
am.getMemoryInfo(mi);
|
||||
return Formatter.formatFileSize(context, mi.availMem);// 将获取的内存大小规格化
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用内存
|
||||
*/
|
||||
public static String getMemory(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||
am.getMemoryInfo(mi);
|
||||
return mi.availMem + "";
|
||||
}
|
||||
|
||||
private static long lastTotalRxBytes = 0;
|
||||
private static long lastTimeStamp = 0;
|
||||
|
||||
/**
|
||||
* 获取上传网速
|
||||
*/
|
||||
public static long getNetSpeed(Context context) {
|
||||
long nowTotalRxBytes = TrafficStats.getUidTxBytes(context.getApplicationInfo().uid) == TrafficStats.UNSUPPORTED ? 0 : (TrafficStats.getTotalTxBytes() / 1024);
|
||||
long nowTimeStamp = System.currentTimeMillis();
|
||||
long speed = ((nowTotalRxBytes - lastTotalRxBytes) * 1000 / (nowTimeStamp - lastTimeStamp));//毫秒转换
|
||||
lastTimeStamp = nowTimeStamp;
|
||||
lastTotalRxBytes = nowTotalRxBytes;
|
||||
return speed;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -4,6 +4,8 @@ import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.Spanned;
|
||||
@ -68,6 +70,20 @@ public class DialogUitl {
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
public static void showToast(Context context,String content,long delayMillis){
|
||||
Dialog dialog = new Dialog(context, R.style.dialog);
|
||||
dialog.setContentView(R.layout.dialog_toast);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
TextView titleView = (TextView) dialog.findViewById(R.id.text);
|
||||
if (titleView != null) {
|
||||
titleView.setText(content);
|
||||
}
|
||||
}
|
||||
dialog.show();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss,delayMillis);
|
||||
}
|
||||
|
||||
|
||||
public static Dialog loadingDialog(Context context) {
|
||||
@ -494,8 +510,12 @@ public class DialogUitl {
|
||||
}
|
||||
}
|
||||
};
|
||||
btnConfirm.setOnClickListener(listener);
|
||||
btnCancel.setOnClickListener(listener);
|
||||
if(btnConfirm!=null) {
|
||||
btnConfirm.setOnClickListener(listener);
|
||||
}
|
||||
if(btnCancel!=null) {
|
||||
btnCancel.setOnClickListener(listener);
|
||||
}
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialogInterface) {
|
||||
|
@ -127,8 +127,10 @@ public class CustomDrawerPopupView extends DrawerPopupView {
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.system_notice), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
// dismiss();
|
||||
|
||||
dismiss();
|
||||
if (callBack != null) {
|
||||
callBack.systemNotice();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class HintCustomPopup extends CenterPopupView {
|
||||
private String title, contest;
|
||||
|
||||
public HintCustomPopup(@NonNull Context context, String title, String contest) {
|
||||
super(context);
|
||||
this.title = title;
|
||||
this.contest = contest;
|
||||
}
|
||||
|
||||
public HintCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.hint_custom_popup;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
TextView titleText = findViewById(R.id.title);
|
||||
TextView contestText = findViewById(R.id.contest);
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleText.setText(title);
|
||||
}
|
||||
if (!TextUtils.isEmpty(contest)) {
|
||||
contestText.setText(contest);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_ok), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.onSure();
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_cancel), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.onCancel();
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private HintCustomCallBack callBack;
|
||||
|
||||
public HintCustomPopup setCallBack(HintCustomCallBack callBack) {
|
||||
this.callBack = callBack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface HintCustomCallBack {
|
||||
void onSure();
|
||||
|
||||
void onCancel();
|
||||
}
|
||||
}
|
@ -1,27 +1,55 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.DoubleSummaryStatistics;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveClarityCustomPopup extends BottomPopupView implements View.OnClickListener {
|
||||
public static final int BAN_720 = 1;
|
||||
public static final int BAN_1080 = 2;
|
||||
private int selectClarity = 1;
|
||||
private RelativeLayout lineSd, lineHd, lineFhd;
|
||||
private ImageView iconSd, iconHd, iconFhd;
|
||||
private ImageView titleSDImg, titleHDImg, titleFHDImg;
|
||||
private TextView titleSDText, titleHDText, titleFHDText;
|
||||
private int banSelect;
|
||||
|
||||
public int getSelectClarity() {
|
||||
return selectClarity;
|
||||
}
|
||||
|
||||
public LiveClarityCustomPopup(@NonNull Context context, int selectClarity, int banSelect) {
|
||||
super(context);
|
||||
this.banSelect = banSelect;
|
||||
if (selectClarity == -1) {
|
||||
selectClarity = 0;
|
||||
}
|
||||
this.selectClarity = selectClarity;
|
||||
}
|
||||
|
||||
public LiveClarityCustomPopup(@NonNull Context context, int selectClarity) {
|
||||
super(context);
|
||||
if (selectClarity == -1) {
|
||||
selectClarity = 0;
|
||||
}
|
||||
this.selectClarity = selectClarity;
|
||||
}
|
||||
|
||||
@ -55,6 +83,12 @@ public class LiveClarityCustomPopup extends BottomPopupView implements View.OnCl
|
||||
iconSd = findViewById(R.id.icon_sd);
|
||||
iconHd = findViewById(R.id.icon_hd);
|
||||
iconFhd = findViewById(R.id.icon_fhd);
|
||||
titleSDImg = findViewById(R.id.sd);
|
||||
titleHDImg = findViewById(R.id.hd);
|
||||
titleFHDImg = findViewById(R.id.fhd);
|
||||
titleSDText = findViewById(R.id.sd_text);
|
||||
titleHDText = findViewById(R.id.hd_text);
|
||||
titleFHDText = findViewById(R.id.fhd_text);
|
||||
selectClarity(selectClarity);
|
||||
//流畅
|
||||
ViewClicksAntiShake.clicksAntiShake(lineSd, () -> {
|
||||
@ -64,17 +98,70 @@ public class LiveClarityCustomPopup extends BottomPopupView implements View.OnCl
|
||||
});
|
||||
//高清
|
||||
ViewClicksAntiShake.clicksAntiShake(lineHd, () -> {
|
||||
selectClarity = 1;
|
||||
selectClarity(selectClarity);
|
||||
dismiss();
|
||||
String memorg = formateFileSize(Long.parseLong(DeviceUtils.getMemory(getContext())));
|
||||
if (Double.parseDouble(memorg) > 7 && netAverage > 100) {
|
||||
selectClarity = 1;
|
||||
selectClarity(selectClarity);
|
||||
dismiss();
|
||||
} else {
|
||||
new XPopup.Builder(getContext())
|
||||
.asCustom(new HintCustomPopup(getContext(), getContext().getString(R.string.net_hint), getContext().getString(R.string.net_hint2)).setCallBack(new HintCustomPopup.HintCustomCallBack() {
|
||||
@Override
|
||||
public void onSure() {
|
||||
selectClarity = 1;
|
||||
selectClarity(selectClarity);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
//超高清
|
||||
ViewClicksAntiShake.clicksAntiShake(lineFhd, () -> {
|
||||
selectClarity = 2;
|
||||
selectClarity(selectClarity);
|
||||
dismiss();
|
||||
|
||||
new XPopup.Builder(getContext())
|
||||
.asCustom(new HintCustomPopup(getContext()).setCallBack(new HintCustomPopup.HintCustomCallBack() {
|
||||
@Override
|
||||
public void onSure() {
|
||||
selectClarity = 2;
|
||||
selectClarity(selectClarity);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
|
||||
|
||||
});
|
||||
if (banSelect == BAN_720) {
|
||||
lineFhd.setEnabled(false);
|
||||
lineHd.setEnabled(false);
|
||||
titleHDImg.setImageAlpha(40);
|
||||
titleFHDImg.setImageAlpha(40);
|
||||
titleHDText.setAlpha(0.2f);
|
||||
titleFHDText.setAlpha(0.2f);
|
||||
} else if (banSelect == BAN_1080) {
|
||||
lineFhd.setEnabled(false);
|
||||
titleFHDText.setAlpha(0.2f);
|
||||
titleFHDImg.setImageAlpha(20);
|
||||
}
|
||||
}
|
||||
|
||||
//调用系统函数,字符串转换 long -String KB/MB
|
||||
private String formateFileSize(long size) {
|
||||
String fileSize = Formatter.formatFileSize(getContext(), size);
|
||||
return fileSize.substring(0, fileSize.length() - 3);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,6 +198,28 @@ public class LiveClarityCustomPopup extends BottomPopupView implements View.OnCl
|
||||
}
|
||||
}
|
||||
|
||||
private Handler netHandler = new Handler();
|
||||
private Runnable netRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (netSpeeds.size() < 11) {
|
||||
netSpeeds.add(DeviceUtils.getNetSpeed(getContext()));
|
||||
netHandler.postDelayed(netRunnable, 100);
|
||||
} else {
|
||||
long min = Collections.min(netSpeeds);
|
||||
long max = Collections.max(netSpeeds);
|
||||
|
||||
DoubleSummaryStatistics statistics = netSpeeds.stream().mapToDouble(Number::doubleValue).summaryStatistics();
|
||||
netAverage = statistics.getAverage();
|
||||
Log.e("网络速度", "最大值:" + max + " 最小值:" + min + " 平均值:" + netAverage);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
private List<Long> netSpeeds = new ArrayList<>();
|
||||
private double netAverage = 0;
|
||||
|
||||
private void initDate() {
|
||||
netHandler.postDelayed(netRunnable, 100);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,178 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveStetUpStatusModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class LiveOpenCustomPopup extends CenterPopupView {
|
||||
//清晰度
|
||||
private int selectClarity;
|
||||
//直播类型
|
||||
private LiveClassBean classBean;
|
||||
//房间类型
|
||||
private LiveRoomTypeBean liveRoomTypeBean;
|
||||
|
||||
private TextView textClarity, textLiveRoomType, textLiveClass, textLiveWishlist, textRobot;
|
||||
|
||||
public LiveOpenCustomPopup setClassBean(LiveClassBean classBean) {
|
||||
this.classBean = classBean;
|
||||
textLiveClass.setText(classBean.getName());
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveOpenCustomPopup setLiveRoomTypeBean(LiveRoomTypeBean liveRoomTypeBean) {
|
||||
this.liveRoomTypeBean = liveRoomTypeBean;
|
||||
textLiveRoomType.setText(liveRoomTypeBean.getName());
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveOpenCustomPopup(@NonNull Context context, int selectClarity, LiveClassBean classBean, LiveRoomTypeBean liveRoomTypeBean) {
|
||||
super(context);
|
||||
this.selectClarity = selectClarity;
|
||||
this.classBean = classBean;
|
||||
this.liveRoomTypeBean = liveRoomTypeBean;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_live_open;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
initView();
|
||||
initDate();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
textClarity = findViewById(R.id.text_clarity);
|
||||
textLiveRoomType = findViewById(R.id.text_live_room_type);
|
||||
textLiveClass = findViewById(R.id.text_live_class);
|
||||
textLiveWishlist = findViewById(R.id.text_live_wishlist);
|
||||
textRobot = findViewById(R.id.text_robot);
|
||||
if (classBean != null) {
|
||||
textLiveClass.setText(classBean.getName());
|
||||
}
|
||||
if (liveRoomTypeBean != null) {
|
||||
textLiveRoomType.setText(liveRoomTypeBean.getName());
|
||||
}
|
||||
setSelectClarity(selectClarity);
|
||||
//關閉彈窗
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_cancel), () -> dismiss());
|
||||
//開播
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_ok), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.startLive(liveRoomTypeBean, classBean);
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
//設置直播類型
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_class), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.openLiveClass(classBean);
|
||||
}
|
||||
});
|
||||
//設置清晰度
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_clarity), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.selectClarity(selectClarity);
|
||||
}
|
||||
});
|
||||
//設置房間類型
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_room_type), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.openLiveRoomType(liveRoomTypeBean);
|
||||
}
|
||||
});
|
||||
//打開心願單
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_live_wishlist), () -> {
|
||||
if (callBack != null) {
|
||||
callBack.openWishlist();
|
||||
}
|
||||
});
|
||||
//設置機器人
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.line_robot), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (callBack != null) {
|
||||
callBack.openRobot();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setSelectClarity(int selectClarity) {
|
||||
switch (selectClarity) {
|
||||
case 0:
|
||||
textClarity.setText(R.string.standard_clear);
|
||||
break;
|
||||
case 1:
|
||||
textClarity.setText(R.string.high_definition);
|
||||
break;
|
||||
case 2:
|
||||
textClarity.setText(R.string.ultra_hd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void initDate() {
|
||||
LiveNetManager.get(getContext())
|
||||
.getLiveStetUpStatus(String.valueOf(IMLoginManager.get(getContext()).getUserInfo().getId()),
|
||||
new HttpCallback<LiveStetUpStatusModel>() {
|
||||
@Override
|
||||
public void onSuccess(LiveStetUpStatusModel data) {
|
||||
textLiveWishlist.setText(data.getWishListState() ? R.string.do_set : R.string.not_set);
|
||||
textRobot.setText(data.getAiStateState() ? R.string.robot_yes : R.string.robot_no);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private LiveOpenCallBack callBack;
|
||||
|
||||
public LiveOpenCustomPopup setCallBack(LiveOpenCallBack callBack) {
|
||||
this.callBack = callBack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface LiveOpenCallBack {
|
||||
//開播
|
||||
void startLive(LiveRoomTypeBean liveRoomTypeBean, LiveClassBean classBean);
|
||||
|
||||
//選擇清晰度
|
||||
void selectClarity(int selectClarity);
|
||||
|
||||
//打開機器人
|
||||
void openRobot();
|
||||
|
||||
//打開直播間類型
|
||||
void openLiveRoomType(LiveRoomTypeBean liveRoomTypeBean);
|
||||
|
||||
//打開直播類型
|
||||
void openLiveClass(LiveClassBean classBean);
|
||||
|
||||
//打開心願單
|
||||
void openWishlist();
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.yunbao.common.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@ -24,8 +23,6 @@ import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveRobotSettingCustomPopup extends BottomPopupView implements View.OnClickListener {
|
||||
private static String TAG = "AI机器人";
|
||||
private EditText robotNameSetting;
|
||||
@ -36,6 +33,10 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View
|
||||
|
||||
private int robotStateInt = 1;
|
||||
|
||||
public int getRobotStateInt() {
|
||||
return robotStateInt;
|
||||
}
|
||||
|
||||
public LiveRobotSettingCustomPopup(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white" />
|
||||
<stroke
|
||||
android:width="1.2dp"
|
||||
android:color="#FFAE05" />
|
||||
<corners android:radius="21dp" />
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFC621" />
|
||||
<corners android:radius="21dp" />
|
||||
</shape>
|
@ -41,6 +41,7 @@
|
||||
android:src="@mipmap/icon_sd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sd_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/sd"
|
||||
@ -79,6 +80,7 @@
|
||||
android:src="@mipmap/icon_hd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hd_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/hd"
|
||||
@ -116,6 +118,7 @@
|
||||
android:src="@mipmap/icon_fhd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fhd_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/fhd"
|
||||
|
18
common/src/main/res/layout/dialog_toast.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_loading_dialog"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/loading"
|
||||
android:textColor="@color/white"
|
||||
android:layout_margin="15dp"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
71
common/src/main/res/layout/hint_custom_popup.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="180dp"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="18dp"
|
||||
app:cardElevation="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/ultra_hd_hint"
|
||||
android:textColor="#161616"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contest"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/ultra_hd_hint2"
|
||||
android:textColor="#999999"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/live_open_cancel"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/backgroud_live_open_lfet"
|
||||
android:gravity="center"
|
||||
android:text="@string/back"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/live_open_ok"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/backgroud_live_open_right"
|
||||
android:gravity="center"
|
||||
android:text="@string/stick_to_choice"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
@ -46,10 +46,10 @@
|
||||
android:layout_width="87dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:background="@mipmap/tipbox_btn_gray"
|
||||
android:background="@drawable/backgroud_live_open_lfet"
|
||||
android:gravity="center"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="#B1B1B1"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
|
245
common/src/main/res/layout/view_live_open.xml
Normal file
@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="340dp"
|
||||
android:orientation="vertical"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/confirmation_of_broadcast"
|
||||
android:textColor="#161616"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line_clarity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="29dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:layout_marginEnd="29dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/clarity"
|
||||
android:textColor="#999999"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_clarity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/clarity"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@mipmap/icon_more_open" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line_live_room_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="29dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="29dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_room_type"
|
||||
android:textColor="#999999"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_live_room_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/clarity"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@mipmap/icon_more_open" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line_live_class"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="29dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="29dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_class1"
|
||||
android:textColor="#999999"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_live_class"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_class1"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@mipmap/icon_more_open" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line_live_wishlist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="29dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="29dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_wishlist"
|
||||
android:textColor="#999999"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_live_wishlist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/clarity"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@mipmap/icon_more_open" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line_robot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="29dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="29dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/robot"
|
||||
android:textColor="#999999"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_robot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/clarity"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@mipmap/icon_more_open" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/live_open_cancel"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/backgroud_live_open_lfet"
|
||||
android:gravity="center"
|
||||
android:text="@string/back"
|
||||
android:textColor="#FFC621"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/live_open_ok"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/backgroud_live_open_right"
|
||||
android:gravity="center"
|
||||
android:text="@string/broadcast"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 955 B After Width: | Height: | Size: 955 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_more_open.png
Normal file
After Width: | Height: | Size: 632 B |
@ -934,4 +934,64 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="studio_gift_effects">Blocking gift effects</string>
|
||||
<string name="studio_ride_effects">Blocking seat effects</string>
|
||||
<string name="want_pre">If you want to Minimize Play,\nYou can go to set the license.</string>
|
||||
|
||||
|
||||
<string name="in_batch">In a batch</string>
|
||||
<string name="chat_chat">Chat</string>
|
||||
<string name="lucky_angel" >Congratulations %s have won %s in the Lucky Angel! The next lucky angel will be you!</string>
|
||||
<string name="user_card_guard" >Guardian group %s people</string>
|
||||
<string name="to_receive" >receive</string>
|
||||
<string name="to_complete" >去完成</string>
|
||||
<string name="already_collected" >已領取</string>
|
||||
<string name="image_quality_selection" >畫質選擇</string>
|
||||
<string name="more_settings" >更多設置</string>
|
||||
<string name="moer">查看更多</string>
|
||||
<string name="gift_way">礼物正在获取中...</string>
|
||||
<string name="start_pk">開始PK</string>
|
||||
<string name="number_of_remaining_times">剩餘次數:%s</string>
|
||||
<string name="confirmed_to_proceed">是否確認進行多人PK(確認後扣除1點次數)當日剩餘次數: %s</string>
|
||||
<string name="invite_anchor">邀請\n主播</string>
|
||||
<string name="end_pk">結束\nPK</string>
|
||||
<string name="pk_time">時間 %s</string>
|
||||
|
||||
<string name="random_pk_dialog_apply" >接受</string>
|
||||
<string name="random_pk_dialog_refuse" >拒绝</string>
|
||||
<string name="random_pk_dialog_refuse_again" >坚持拒绝</string>
|
||||
<string name="random_pk_dialog_title" >随机PK提示</string>
|
||||
|
||||
<string name="speech_robot_setup" >自動發言機器人設置</string>
|
||||
<string name="robot_switch" >機器人開關</string>
|
||||
<string name="robot_name_setting" >機器人名字設置</string>
|
||||
<string name="word_limit" >字數限制2-8個字</string>
|
||||
<string name="automatic_greeting_setting" >自動打招呼設置</string>
|
||||
<string name="configured_items" >已配置條數</string>
|
||||
<string name="automatic_message_sending" >自動發消息設置</string>
|
||||
<string name="robot_go_setting" >前往設置</string>
|
||||
<string name="robot_hint" >感謝送禮、PK開始、PK結束的自動機器人消息,\n暫不支持自定義。</string>
|
||||
<string name="robot_add_content" >添加內容</string>
|
||||
<string name="robot_add_content_hint1" >每隔一段時間,機器人自動隨機以下一句話發出。</string>
|
||||
<string name="robot_add_content_hint2" >填寫內容推薦,如:求送心願單、加粉絲團等</string>
|
||||
<string name="robot_automatic_speech_interval" >自動發言間隔時間(分鐘)</string>
|
||||
<string name="robot_minimum_interval" >最少間隔5分鐘1次</string>
|
||||
<string name="robot_add_content_hint3" >當有用戶進入直播間時,機器人會@該用戶並自動</string>
|
||||
<string name="robot_add_content_hint4" >隨機以下一句話。最少設置1條,最多20條。</string>
|
||||
<string name="robot_setup" >機器人設置</string>
|
||||
<string name="high_definition" >高清</string>
|
||||
<string name="standard_clear" >流暢</string>
|
||||
<string name="ultra_hd" >超高清</string>
|
||||
<string name="clarity_hint" >確定清晰度開播後,需要重新開播才能更改</string>
|
||||
<string name="confirmation_of_broadcast" >開播設置確認</string>
|
||||
<string name="clarity" >清晰度</string>
|
||||
<string name="live_class1" >直播頻道</string>
|
||||
<string name="broadcast" >開播</string>
|
||||
<string name="robot" >機器人</string>
|
||||
<string name="do_set" >已設置</string>
|
||||
<string name="not_set" >未設置</string>
|
||||
<string name="robot_no" >關</string>
|
||||
<string name="robot_yes" >開</string>
|
||||
<string name="ultra_hd_hint" >超高清提示</string>
|
||||
<string name="ultra_hd_hint2" >在網速不穩定的情況下,選擇超高清將會有可能導致直播間畫面卡頓,是否確認選擇?</string>
|
||||
<string name="stick_to_choice" >堅持選擇</string>
|
||||
<string name="net_hint" >網絡提示</string>
|
||||
<string name="net_hint2" >系統監測到您的網絡不穩定,設備內存不足將會影響到您的直播流暢度,因此建議您選擇流暢清晰度。</string>
|
||||
</resources>
|
||||
|
@ -723,7 +723,7 @@
|
||||
<string name="live_wishlist">心願單</string>
|
||||
<string name="live_zg">娛樂整蠱</string>
|
||||
<string name="live_dr">多人PK</string>
|
||||
<string name="live_random" translatable="false">随机PK</string>
|
||||
<string name="live_random" >随机PK</string>
|
||||
<string name="live_mic">語音連麥</string>
|
||||
<string name="live_wks">周星榜</string>
|
||||
<string name="live_zslk">暫時離開</string>
|
||||
@ -958,13 +958,13 @@
|
||||
<string name="in_batch">換一批</string>
|
||||
<string name="chat_chat">聊聊天</string>
|
||||
<string name="want_pre">想在其他APP上方也顯示小窗,\n可前往設置進行授權。</string>
|
||||
<string name="lucky_angel" translatable="false">恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦!</string>
|
||||
<string name="user_card_guard" translatable="false">守護團%s人</string>
|
||||
<string name="to_receive" translatable="false">領取</string>
|
||||
<string name="to_complete" translatable="false">去完成</string>
|
||||
<string name="already_collected" translatable="false">已領取</string>
|
||||
<string name="image_quality_selection" translatable="false">畫質選擇</string>
|
||||
<string name="more_settings" translatable="false">更多設置</string>
|
||||
<string name="lucky_angel" >恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦!</string>
|
||||
<string name="user_card_guard" >守護團%s人</string>
|
||||
<string name="to_receive" >領取</string>
|
||||
<string name="to_complete" >去完成</string>
|
||||
<string name="already_collected" >已領取</string>
|
||||
<string name="image_quality_selection" >畫質選擇</string>
|
||||
<string name="more_settings" >更多設置</string>
|
||||
<string name="moer">查看更多</string>
|
||||
<string name="gift_way">礼物正在获取中...</string>
|
||||
<string name="start_pk">開始PK</string>
|
||||
@ -974,30 +974,44 @@
|
||||
<string name="end_pk">結束\nPK</string>
|
||||
<string name="pk_time">時間 %s</string>
|
||||
|
||||
<string name="random_pk_dialog_apply" translatable="false">接受</string>
|
||||
<string name="random_pk_dialog_refuse" translatable="false">拒绝</string>
|
||||
<string name="random_pk_dialog_refuse_again" translatable="false">坚持拒绝</string>
|
||||
<string name="random_pk_dialog_title" translatable="false">随机PK提示</string>
|
||||
<string name="random_pk_dialog_apply" >接受</string>
|
||||
<string name="random_pk_dialog_refuse" >拒绝</string>
|
||||
<string name="random_pk_dialog_refuse_again" >坚持拒绝</string>
|
||||
<string name="random_pk_dialog_title" >随机PK提示</string>
|
||||
|
||||
<string name="speech_robot_setup" translatable="false">自動發言機器人設置</string>
|
||||
<string name="robot_switch" translatable="false">機器人開關</string>
|
||||
<string name="robot_name_setting" translatable="false">機器人名字設置</string>
|
||||
<string name="word_limit" translatable="false">字數限制2-8個字</string>
|
||||
<string name="automatic_greeting_setting" translatable="false">自動打招呼設置</string>
|
||||
<string name="configured_items" translatable="false">已配置條數</string>
|
||||
<string name="automatic_message_sending" translatable="false">自動發消息設置</string>
|
||||
<string name="robot_go_setting" translatable="false">前往設置</string>
|
||||
<string name="robot_hint" translatable="false">感謝送禮、PK開始、PK結束的自動機器人消息,\n暫不支持自定義。</string>
|
||||
<string name="robot_add_content" translatable="false">添加內容</string>
|
||||
<string name="robot_add_content_hint1" translatable="false">每隔一段時間,機器人自動隨機以下一句話發出。</string>
|
||||
<string name="robot_add_content_hint2" translatable="false">填寫內容推薦,如:求送心願單、加粉絲團等</string>
|
||||
<string name="robot_automatic_speech_interval" translatable="false">自動發言間隔時間(分鐘)</string>
|
||||
<string name="robot_minimum_interval" translatable="false">最少間隔5分鐘1次</string>
|
||||
<string name="robot_add_content_hint3" translatable="false">當有用戶進入直播間時,機器人會@該用戶並自動</string>
|
||||
<string name="robot_add_content_hint4" translatable="false">隨機以下一句話。最少設置1條,最多20條。</string>
|
||||
<string name="robot_setup" translatable="false">機器人設置</string>
|
||||
<string name="high_definition" translatable="false">高清</string>
|
||||
<string name="standard_clear" translatable="false">流暢</string>
|
||||
<string name="ultra_hd" translatable="false">超高清</string>
|
||||
<string name="clarity_hint" translatable="false">確定清晰度開播後,需要重新開播才能更改</string>
|
||||
<string name="speech_robot_setup" >自動發言機器人設置</string>
|
||||
<string name="robot_switch" >機器人開關</string>
|
||||
<string name="robot_name_setting" >機器人名字設置</string>
|
||||
<string name="word_limit" >字數限制2-8個字</string>
|
||||
<string name="automatic_greeting_setting" >自動打招呼設置</string>
|
||||
<string name="configured_items" >已配置條數</string>
|
||||
<string name="automatic_message_sending" >自動發消息設置</string>
|
||||
<string name="robot_go_setting" >前往設置</string>
|
||||
<string name="robot_hint" >感謝送禮、PK開始、PK結束的自動機器人消息,\n暫不支持自定義。</string>
|
||||
<string name="robot_add_content" >添加內容</string>
|
||||
<string name="robot_add_content_hint1" >每隔一段時間,機器人自動隨機以下一句話發出。</string>
|
||||
<string name="robot_add_content_hint2" >填寫內容推薦,如:求送心願單、加粉絲團等</string>
|
||||
<string name="robot_automatic_speech_interval" >自動發言間隔時間(分鐘)</string>
|
||||
<string name="robot_minimum_interval" >最少間隔5分鐘1次</string>
|
||||
<string name="robot_add_content_hint3" >當有用戶進入直播間時,機器人會@該用戶並自動</string>
|
||||
<string name="robot_add_content_hint4" >隨機以下一句話。最少設置1條,最多20條。</string>
|
||||
<string name="robot_setup" >機器人設置</string>
|
||||
<string name="high_definition" >高清</string>
|
||||
<string name="standard_clear" >流暢</string>
|
||||
<string name="ultra_hd" >超高清</string>
|
||||
<string name="clarity_hint" >確定清晰度開播後,需要重新開播才能更改</string>
|
||||
<string name="confirmation_of_broadcast" >開播設置確認</string>
|
||||
<string name="clarity" >清晰度</string>
|
||||
<string name="live_class1" >直播頻道</string>
|
||||
<string name="broadcast" >開播</string>
|
||||
<string name="robot" >機器人</string>
|
||||
<string name="do_set" >已設置</string>
|
||||
<string name="not_set" >未設置</string>
|
||||
<string name="robot_no" >關</string>
|
||||
<string name="robot_yes" >開</string>
|
||||
<string name="ultra_hd_hint" >超高清提示</string>
|
||||
<string name="ultra_hd_hint2" >在網速不穩定的情況下,選擇超高清將會有可能導致直播間畫面卡頓,是否確認選擇?</string>
|
||||
<string name="stick_to_choice" >堅持選擇</string>
|
||||
<string name="net_hint" >網絡提示</string>
|
||||
<string name="net_hint2" >系統監測到您的網絡不穩定,設備內存不足將會影響到您的直播流暢度,因此建議您選擇流暢清晰度。</string>
|
||||
</resources>
|
||||
|
@ -1 +1 @@
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'../libs/beautysdk-202202241203',ext:'aar')
implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar')
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
api project(path: ':common')
api project(path:':FaceUnity')//新娱美颜
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
}
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'../libs/beautysdk-202202241203',ext:'aar')
implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar')
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
api project(path: ':common')
api project(path:':FaceUnity')//新娱美颜
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
//ExoPlayer,腾讯的播放器不支持无缝切换
implementation 'com.google.android.exoplayer:exoplayer:2.18.2'
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar'
}
|
@ -864,7 +864,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
public void systemNotice() {
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setBean(mLiveBean)
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.NOTICE));
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,10 +112,14 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCStatusReportListener;
|
||||
import cn.rongcloud.rtc.api.report.StatusBean;
|
||||
import cn.rongcloud.rtc.api.report.StatusReport;
|
||||
import cn.rongcloud.rtc.base.RCRTCRect;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import io.rong.imlib.IRongCallback;
|
||||
@ -208,6 +212,27 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
Bus.getOn(this);
|
||||
Intent intent = getIntent();
|
||||
initFaceManager();
|
||||
// RCRTCEngine.getInstance().registerStatusReportListener(new IRCRTCStatusReportListener() {
|
||||
//
|
||||
// @Override
|
||||
// public void onConnectionStats(StatusReport statusReport) {
|
||||
// //视频发送信息
|
||||
// for (Map.Entry<String, StatusBean> entry : statusReport.statusVideoSends.entrySet()) {
|
||||
// StatusBean statusBean = entry.getValue();
|
||||
// //获取userID
|
||||
// String userId = statusBean.uid;
|
||||
// //获取视频 宽x高@帧率
|
||||
// String resolution = statusBean.frameWidth + "x" + statusBean.frameHeight + "@" + statusBean.frameRate;
|
||||
// //获取码率
|
||||
// long bitRate = statusBean.bitRate;
|
||||
// //丢包率
|
||||
// long lossRate = statusBean.packetLostRate;
|
||||
// //带宽
|
||||
// String googAvailableSendBandwidth = statusReport.googAvailableSendBandwidth;
|
||||
// Log.e("网速和内存", "码率:" +bitRate+ " 丢包率:" + lossRate+" 带宽:"+googAvailableSendBandwidth);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
leave_img = findViewById(R.id.leave_img);
|
||||
mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY);
|
||||
mLiveKsyConfigBean = intent.getParcelableExtra(Constants.LIVE_KSY_CONFIG);
|
||||
@ -843,6 +868,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
|
||||
PKing = false;
|
||||
isDRPK = 0;
|
||||
endLive();
|
||||
RandomPkManager.getInstance().release();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.live.dialog.LiveBeautyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
@ -213,7 +213,7 @@ public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
return;
|
||||
}
|
||||
String title = mEditTitle.getText().toString().trim();
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null, new HttpCallback() {
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null,0, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, final String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
|
@ -115,7 +115,7 @@ public class FreePkRecyclerAdapter extends RefreshAdapter<RandomPkUserBean> {
|
||||
}
|
||||
if (freePkNum == 0 && mDrPkNum == -1) {
|
||||
ToastUtil.show(R.string.free_pk_num_null);
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
LiveHttpUtil.getMicList(LiveRyAnchorActivity.mLiveUid, 0, new com.yunbao.common.http.HttpCallback() {
|
||||
|
@ -129,7 +129,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (isBottom && dy >= 0) return;
|
||||
// Log.i(TAG, "onScrolled: " + dy);
|
||||
// Log.i(TAG, "onScrolled: " + dy);
|
||||
mRecyclerViewScrolledDy = dy;
|
||||
isBottom = false;
|
||||
}
|
||||
@ -138,11 +138,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
if (newState == 0 && isSlideToBottom(recyclerView)) {
|
||||
// Log.i(TAG, "onScrollStateChanged: 到底部了");
|
||||
// Log.i(TAG, "onScrollStateChanged: 到底部了");
|
||||
mRecyclerViewScrolledDy = 0;
|
||||
isBottom = true;
|
||||
} else if (newState == 0) {
|
||||
// Log.i(TAG, "onScrollStateChanged: 不是底部");
|
||||
// Log.i(TAG, "onScrollStateChanged: 不是底部");
|
||||
isBottom = false;
|
||||
}
|
||||
}
|
||||
@ -398,7 +398,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
if (bean == null) {
|
||||
return;
|
||||
}
|
||||
// Log.i(TAG, "insertItem: " + bean.getContent());
|
||||
// Log.i(TAG, "insertItem: " + bean.getContent()+" size = "+(mList.size()+1));
|
||||
int size = mList.size();
|
||||
//设置最大展示99条消息
|
||||
if (size == 100) {
|
||||
|
@ -15,7 +15,7 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -18,7 +18,6 @@ import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveReadyClassAdapter;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -19,7 +19,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -14,7 +14,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveRoomTypeAdapter;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/8.
|
||||
|
@ -256,7 +256,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
UP_PK_TWO(51, "PK头像信息"),
|
||||
CUSTOM_FULL_SERVICE_NOTIFY(51, "全服通知"),
|
||||
CHANGE_VIEW(52, "更改连胜位置"),
|
||||
UPDATA_ROBOT(53, "更新机器人消息");
|
||||
UPDATA_ROBOT(53, "更新机器人消息"),
|
||||
LIVE_VIDEO(54, "画质选择");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -47,10 +47,11 @@ public class LiveHttpUtil {
|
||||
|
||||
/**
|
||||
* 获取直播用户日榜/周榜
|
||||
* @param liveUid 主播uid
|
||||
*
|
||||
* @param liveUid 主播uid
|
||||
* @param callback 回调
|
||||
*/
|
||||
public static void getUserRankList(String liveUid,HttpCallback callback){
|
||||
public static void getUserRankList(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Contribute.index", LiveHttpConsts.GET_USER_LIST)
|
||||
.params("uid", liveUid)
|
||||
.execute(callback);
|
||||
@ -685,7 +686,7 @@ public class LiveHttpUtil {
|
||||
* @param file 封面图片文件
|
||||
* @param callback
|
||||
*/
|
||||
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, HttpCallback callback) {
|
||||
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType, HttpCallback callback) {
|
||||
|
||||
PostRequest<JsonBean> request = HttpClient.getInstance().post("Live.createRoom2", LiveHttpConsts.CREATE_ROOM)
|
||||
.params("title", title)
|
||||
@ -693,7 +694,8 @@ public class LiveHttpUtil {
|
||||
.params("type", type)
|
||||
.params("landscape", "2")
|
||||
.params("class_type", "0")
|
||||
.params("type_val", typeVal);
|
||||
.params("type_val", typeVal)
|
||||
.params("clarityType ", clarityType);
|
||||
if (file != null) {
|
||||
request.params("file", file);
|
||||
}
|
||||
@ -902,16 +904,17 @@ public class LiveHttpUtil {
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*/
|
||||
public static void nobleUseTrumpet(String trumpet_msg,String anchor_id,HttpCallback callback) {
|
||||
public static void nobleUseTrumpet(String trumpet_msg, String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Noble.nobleUseTrumpet", "nobleUseTrumpet")
|
||||
.params("", trumpet_msg)
|
||||
.params("", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*/
|
||||
public static void getStarChallengeStatus(String liveUid,HttpCallback callback) {
|
||||
public static void getStarChallengeStatus(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("StarChallenge.getStarChallengeStatus", "StarChallengeStatus")
|
||||
.params("liveUid", liveUid)
|
||||
.execute(callback);
|
||||
|
@ -0,0 +1,268 @@
|
||||
package com.yunbao.live.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.analytics.AnalyticsListener;
|
||||
import com.google.android.exoplayer2.analytics.PlaybackStats;
|
||||
import com.google.android.exoplayer2.analytics.PlaybackStatsListener;
|
||||
import com.google.android.exoplayer2.video.VideoSize;
|
||||
|
||||
/**
|
||||
* 直播间播放器管理器
|
||||
* 通过预加载子播放器来实现无缝切换分辨率功能
|
||||
*/
|
||||
public class LiveExoPlayerManager {
|
||||
private final int MODEL_PLAY1 = 0;//当前主播放器
|
||||
private final int MODEL_PLAY2 = 1;//当前子播放器
|
||||
private Context mContext;
|
||||
private ExoPlayer player1, player2;
|
||||
private SurfaceView mainView;//渲染视图
|
||||
private int status = MODEL_PLAY1;
|
||||
private Player.Listener listener;
|
||||
private boolean isSwitchUrl = false;//是否为主动切换播放器
|
||||
private String TAG = "播放";
|
||||
private int playBufferIndex = 0;//卡顿计数器
|
||||
private Handler handler;
|
||||
|
||||
public LiveExoPlayerManager(Context mContext) {
|
||||
this.mContext = mContext;
|
||||
player1 = new ExoPlayer.Builder(mContext).build();
|
||||
player2 = new ExoPlayer.Builder(mContext).build();
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
setListener();
|
||||
setAnalyticsListener();
|
||||
}
|
||||
|
||||
public void setListener(Player.Listener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void setMainView(SurfaceView mainView) {
|
||||
this.mainView = mainView;
|
||||
}
|
||||
|
||||
private void setAnalyticsListener() {
|
||||
player1.addAnalyticsListener(new AnalyticsListener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(
|
||||
EventTime eventTime, int state) {
|
||||
Log.d(TAG, "onPlaybackStateChanged(1) called with: eventTime = [" + eventTime + "], state = [" + state + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDroppedVideoFrames(
|
||||
EventTime eventTime, int droppedFrames, long elapsedMs) {
|
||||
Log.d(TAG, "onDroppedVideoFrames(1) called with: eventTime = [" + eventTime + "], droppedFrames = [" + droppedFrames + "], elapsedMs = [" + elapsedMs + "]");
|
||||
}
|
||||
});
|
||||
|
||||
player2.addAnalyticsListener(new AnalyticsListener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(
|
||||
EventTime eventTime, int state) {
|
||||
Log.d(TAG, "onPlaybackStateChanged(2) called with: eventTime = [" + eventTime.totalBufferedDurationMs + "], state = [" + state + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDroppedVideoFrames(
|
||||
EventTime eventTime, int droppedFrames, long elapsedMs) {
|
||||
Log.d(TAG, "onDroppedVideoFrames(2) called with: eventTime = [" + eventTime + "], droppedFrames = [" + droppedFrames + "], elapsedMs = [" + elapsedMs + "]");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟1秒还未恢复播放则认为卡顿了,可以切分辨率了
|
||||
*/
|
||||
private Runnable buffRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
playBufferIndex = 0;
|
||||
listener.onPlaybackStateChanged(Player.STATE_BUFFERING);
|
||||
}
|
||||
};
|
||||
|
||||
private void setListener() {
|
||||
player1.addListener(new Player.Listener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
||||
Log.i(TAG, "onPlaybackStateChanged 1: " + playbackState);
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
player2.stop();
|
||||
player2.setVideoSurface(null);
|
||||
player1.play();
|
||||
Log.i(TAG, "切换播放器1");
|
||||
handler.removeCallbacks(buffRunnable);
|
||||
playBufferIndex = 0;
|
||||
} else if (playbackState == Player.STATE_BUFFERING && status == MODEL_PLAY1 && !isSwitchUrl) {
|
||||
if (listener != null) {
|
||||
if (playBufferIndex++ == 0) {
|
||||
handler.postDelayed(buffRunnable, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsPlayingChanged(boolean isPlaying) {
|
||||
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
||||
if (isPlaying) {
|
||||
Log.i(TAG, "onIsPlayingChanged1: 播放了");
|
||||
player1.setVideoSurfaceView(mainView);
|
||||
status = MODEL_PLAY1;
|
||||
isSwitchUrl = false;
|
||||
if (listener != null) {
|
||||
listener.onIsPlayingChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||
if (listener != null) {
|
||||
listener.onVideoSizeChanged(videoSize);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsLoadingChanged(boolean isLoading) {
|
||||
Player.Listener.super.onIsLoadingChanged(isLoading);
|
||||
Log.i(TAG, "onIsLoadingChanged: 1 " + isLoading);
|
||||
}
|
||||
});
|
||||
|
||||
player2.addListener(new Player.Listener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
||||
Log.i(TAG, "onPlaybackStateChanged 2: " + playbackState);
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
player1.stop();
|
||||
player1.setVideoSurface(null);
|
||||
player2.play();
|
||||
Log.i(TAG, "切换播放器2 " + player2.isPlaying());
|
||||
handler.removeCallbacks(buffRunnable);
|
||||
playBufferIndex = 0;
|
||||
} else if (playbackState == Player.STATE_BUFFERING && status == MODEL_PLAY2 && !isSwitchUrl) {
|
||||
if (listener != null) {
|
||||
if (playBufferIndex++ == 0) {
|
||||
handler.postDelayed(buffRunnable, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsPlayingChanged(boolean isPlaying) {
|
||||
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
||||
if (isPlaying) {
|
||||
Log.i(TAG, "onIsPlayingChanged2: 播放了");
|
||||
player2.setVideoSurfaceView(mainView);
|
||||
status = MODEL_PLAY2;
|
||||
isSwitchUrl = false;
|
||||
if (listener != null) {
|
||||
listener.onIsPlayingChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||
if (listener != null) {
|
||||
listener.onVideoSizeChanged(videoSize);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsLoadingChanged(boolean isLoading) {
|
||||
Player.Listener.super.onIsLoadingChanged(isLoading);
|
||||
Log.i(TAG, "onIsLoadingChanged: 2 " + isLoading);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始播放
|
||||
*
|
||||
* @param url 地址
|
||||
*/
|
||||
public void startUrl(String url) {
|
||||
isSwitchUrl = true;
|
||||
playBufferIndex = 0;
|
||||
getNowPlayer().setVideoSurfaceView(mainView);
|
||||
getNowPlayer().setMediaItem(createMediaItem(url));
|
||||
getNowPlayer().prepare();
|
||||
getNowPlayer().play();
|
||||
}
|
||||
|
||||
/**
|
||||
* 无缝切换
|
||||
*
|
||||
* @param url 地址
|
||||
*/
|
||||
public void switchUrl(String url) {
|
||||
Log.i(TAG, "switchUrl: " + url);
|
||||
playBufferIndex = 0;
|
||||
isSwitchUrl = true;
|
||||
getNextPlayer().setMediaItem(createMediaItem(url));
|
||||
getNextPlayer().prepare();
|
||||
}
|
||||
|
||||
private MediaItem createMediaItem(String url) {
|
||||
return MediaItem.fromUri(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前播放器
|
||||
*/
|
||||
public ExoPlayer getNowPlayer() {
|
||||
return status == MODEL_PLAY1 ? player1 : player2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一个播放器。
|
||||
*/
|
||||
private ExoPlayer getNextPlayer() {
|
||||
return status == MODEL_PLAY1 ? player2 : player1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否正在播放
|
||||
*/
|
||||
public boolean isPlaying() {
|
||||
return getNowPlayer().isPlaying();
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止播放
|
||||
*/
|
||||
public void stop() {
|
||||
getNowPlayer().stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始播放
|
||||
*/
|
||||
public void play() {
|
||||
getNowPlayer().play();
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放播放器
|
||||
*/
|
||||
public void release() {
|
||||
player1.release();
|
||||
player2.release();
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.yunbao.live.views;
|
||||
|
||||
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.WISH_LIST_UPDATE;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@ -7,6 +9,8 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -23,12 +27,14 @@ import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
@ -37,25 +43,35 @@ import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
import com.yunbao.common.views.LiveClarityCustomPopup;
|
||||
import com.yunbao.common.views.LiveOpenCustomPopup;
|
||||
import com.yunbao.common.views.LiveRobotSettingCustomPopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.faceunity.FaceManager;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewRoomClassDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewRoomTypeDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveNewWishListDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveTimeDialogFragment;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCStatusReportListener;
|
||||
import cn.rongcloud.rtc.api.report.StatusBean;
|
||||
import cn.rongcloud.rtc.api.report.StatusReport;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCCameraOutputStream;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
|
||||
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
||||
|
||||
public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnClickListener {
|
||||
|
||||
@ -78,6 +94,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
private TextView faceTextView;//提示人脸未检测到的TextView
|
||||
private ImageView imgClarity;
|
||||
private int selectClarity = 1;
|
||||
private LiveOpenCustomPopup liveOpenCustomPopup;
|
||||
|
||||
public LiveNewReadyRyViewHolder(Context context, ViewGroup parentView, int liveSdk) {
|
||||
super(context, parentView, liveSdk);
|
||||
@ -194,12 +211,16 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
|
||||
}
|
||||
//设置清晰度
|
||||
// DeviceUtils.getMemory(mContext); //获取可用内存
|
||||
// DeviceUtils.getNetSpeed(mContext);//获取当前上传网速
|
||||
// Log.e("网速和内存", "内存:" + + " 网速:" + DeviceUtils.getNetSpeed(mContext));
|
||||
|
||||
selectClarity = IMLoginManager.get(mContext).getSelectClarity();
|
||||
setSelectClarity(selectClarity);
|
||||
ViewClicksAntiShake
|
||||
.clicksAntiShake(
|
||||
findViewById(R.id.btn_live_clarity), () -> {
|
||||
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, selectClarity);
|
||||
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, IMLoginManager.get(mContext).getSelectClarity());
|
||||
new XPopup.Builder(mContext)
|
||||
.setPopupCallback(new XPopupCallback() {
|
||||
@Override
|
||||
@ -253,6 +274,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
}
|
||||
|
||||
private void setSelectClarity(int selectClarity) {
|
||||
|
||||
this.selectClarity = selectClarity;
|
||||
IMLoginManager.get(mContext).setSelectClarity(selectClarity);
|
||||
switch (selectClarity) {
|
||||
@ -269,12 +291,46 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
liveClarity.setText(R.string.ultra_hd);
|
||||
break;
|
||||
}
|
||||
if (liveOpenCustomPopup != null) {
|
||||
liveOpenCustomPopup.setSelectClarity(selectClarity);
|
||||
}
|
||||
//設置開播分辨率
|
||||
RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
|
||||
int minRate = 200;
|
||||
int maxRate = 900;
|
||||
switch (selectClarity) {
|
||||
case 0:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
|
||||
minRate = 200;
|
||||
maxRate = 900;
|
||||
break;
|
||||
case 1:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280;
|
||||
minRate = 250;
|
||||
maxRate = 2200;
|
||||
break;
|
||||
case 2:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920;
|
||||
minRate = 400;
|
||||
maxRate = 4000;
|
||||
break;
|
||||
}
|
||||
RCRTCVideoStreamConfig config =
|
||||
RCRTCVideoStreamConfig.Builder.create()
|
||||
.setMinRate(minRate)
|
||||
.setMaxRate(maxRate)
|
||||
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_15)
|
||||
.setVideoResolution(rcrtcVideoResolution)
|
||||
.build();
|
||||
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoConfig(config);
|
||||
}
|
||||
|
||||
public void setManager(FaceManager manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!canClick()) {
|
||||
@ -299,8 +355,156 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
} else if (i == R.id.btn_room_type) {
|
||||
chooseLiveType();
|
||||
} else if (i == R.id.btn_start_live) {
|
||||
startLive();
|
||||
// startLive();
|
||||
liveOpenCustomPopup = new LiveOpenCustomPopup(mContext, selectClarity, classBean, liveRoomTypeBean)
|
||||
.setCallBack(new LiveOpenCustomPopup.LiveOpenCallBack() {
|
||||
@Override
|
||||
public void startLive(LiveRoomTypeBean liveRoomTypeModel, LiveClassBean classModel) {
|
||||
if (classModel != null) {
|
||||
classBean = classModel;
|
||||
mLiveClassID = classBean.getId();
|
||||
}
|
||||
liveRoomTypeBean = liveRoomTypeModel;
|
||||
mLiveType = liveRoomTypeModel.getId();
|
||||
startLiveInit();
|
||||
liveOpenCustomPopup = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectClarity(int selectClarity) {
|
||||
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, selectClarity);
|
||||
new XPopup.Builder(mContext)
|
||||
.setPopupCallback(new XPopupCallback() {
|
||||
@Override
|
||||
public void onCreated(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(BasePopupView popupView) {
|
||||
setSelectClarity(liveClarityCustomPopup.getSelectClarity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDismiss(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed(BasePopupView popupView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickOutside(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
})
|
||||
.asCustom(liveClarityCustomPopup)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openRobot() {
|
||||
LiveRobotSettingCustomPopup liveRobotSettingCustomPopup = new LiveRobotSettingCustomPopup(mContext);
|
||||
new XPopup.Builder(mContext)
|
||||
.setPopupCallback(new XPopupCallback() {
|
||||
@Override
|
||||
public void onCreated(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(BasePopupView popupView) {
|
||||
if (liveOpenCustomPopup != null) {
|
||||
liveOpenCustomPopup.initDate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDismiss(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed(BasePopupView popupView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickOutside(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
})
|
||||
.asCustom(liveRobotSettingCustomPopup)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openLiveRoomType(LiveRoomTypeBean liveRoomTypeModel) {
|
||||
liveRoomTypeBean = liveRoomTypeModel;
|
||||
mLiveType = liveRoomTypeModel.getId();
|
||||
chooseLiveType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openLiveClass(LiveClassBean classModel) {
|
||||
if (classModel != null) {
|
||||
classBean = classModel;
|
||||
mLiveClassID = classBean.getId();
|
||||
}
|
||||
chooseLiveClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openWishlist() {
|
||||
//点击心愿单
|
||||
openWishListWindow();
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(mContext)
|
||||
.asCustom(liveOpenCustomPopup)
|
||||
.show();
|
||||
} else if (i == R.id.btn_locaiton) {
|
||||
switchLocation();
|
||||
} else if (i == R.id.btn_horizontally) {
|
||||
@ -337,6 +541,16 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
|
||||
if (mContext instanceof LiveRyAnchorActivity) {
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "RY");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void updateStart(LiveAudienceEvent event) {
|
||||
if (event.getType() == WISH_LIST_UPDATE) {
|
||||
if (liveOpenCustomPopup != null) {
|
||||
liveOpenCustomPopup.initDate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,6 +638,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
classBean = bean;
|
||||
mLiveClassID = classBean.getId();
|
||||
mLiveClass.setText(bean.getName());
|
||||
if (liveOpenCustomPopup != null) {
|
||||
liveOpenCustomPopup.setClassBean(classBean);
|
||||
}
|
||||
}
|
||||
});
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
|
||||
@ -443,6 +660,8 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
/**
|
||||
* 选择直播类型
|
||||
*/
|
||||
private LiveRoomTypeBean liveRoomTypeBean = new LiveRoomTypeBean(0, WordUtil.getString(R.string.live_room_public));
|
||||
|
||||
private void chooseLiveType() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(Constants.CHECKED_ID, mLiveType);
|
||||
@ -451,6 +670,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
fragment.setCallback(new CommonCallback<LiveRoomTypeBean>() {
|
||||
@Override
|
||||
public void callback(LiveRoomTypeBean bean) {
|
||||
liveRoomTypeBean = bean;
|
||||
switch (bean.getId()) {
|
||||
case Constants.LIVE_TYPE_NORMAL:
|
||||
onLiveTypeNormal(bean);
|
||||
@ -465,6 +685,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
onLiveTypeTime(bean);
|
||||
break;
|
||||
}
|
||||
if (liveOpenCustomPopup != null) {
|
||||
liveOpenCustomPopup.setLiveRoomTypeBean(liveRoomTypeBean);
|
||||
}
|
||||
}
|
||||
});
|
||||
fragment.show(((LiveRyAnchorActivity) mContext).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
|
||||
@ -560,7 +783,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
/**
|
||||
* 点击开始直播按钮
|
||||
*/
|
||||
private void startLive() {
|
||||
private void startLiveInit() {
|
||||
boolean startPreview = ((LiveRyAnchorActivity) mContext).isStartPreview();
|
||||
// if (!startPreview) {
|
||||
// ToastUtil.show(R.string.please_wait);
|
||||
@ -586,7 +809,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
|
||||
return;
|
||||
}
|
||||
String title = mEditTitle.getText().toString().trim();
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() {
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, selectClarity + 1, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, final String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
|
@ -128,7 +128,7 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url,int playModel) {
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
@ -142,6 +142,11 @@ public class LivePlayKsyViewHolder extends LiveRoomPlayViewHolder {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchStream(String url, int playModel) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
|
@ -6,15 +6,14 @@ import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL
|
||||
import android.Manifest;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
@ -23,19 +22,22 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.PlaybackException;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
import com.google.android.exoplayer2.Tracks;
|
||||
import com.google.android.exoplayer2.video.VideoSize;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.interfaces.XPopupCallback;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzy.okserver.OkDownload;
|
||||
import com.lzy.okserver.download.DownloadTask;
|
||||
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.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.bean.CrashSaveBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
@ -43,9 +45,12 @@ import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.LiveClarityCustomPopup;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.event.LiveAudienceEvent;
|
||||
import com.yunbao.live.utils.LiveExoPlayerManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -56,7 +61,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import cn.rongcloud.rtc.api.RCRTCRemoteUser;
|
||||
@ -89,7 +93,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private ViewGroup mLeftContainer;
|
||||
private ViewGroup mRightContainer;
|
||||
private RelativeLayout mPkContainer;
|
||||
public static TXCloudVideoView mVideoView;
|
||||
public static SurfaceView mVideoView;
|
||||
|
||||
private View mLoading, mLoading2;
|
||||
private ImageView mCover;
|
||||
@ -101,20 +105,19 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
private boolean mPausedPlay;//是否被动暂停了播放
|
||||
public int landscape; //1h 2s
|
||||
public static Context contexts;
|
||||
public V2TXLivePlayer mPlayer;
|
||||
public static FrameLayout ry_view;
|
||||
|
||||
private static final int VIDEO_VERTICAL = 1;
|
||||
private static final int VIDEO_HORIZONTAL = 2;
|
||||
int videoLandscape; // 视频方向,1=竖屏,2=横屏
|
||||
private static final int VIDEO_VERTICAL = 2;
|
||||
private static final int VIDEO_HORIZONTAL = 1;
|
||||
int videoLandscape = -1; // 视频方向,2=竖屏,1=横屏
|
||||
|
||||
static int vHeight;//视频高
|
||||
private TextView debugView;
|
||||
|
||||
private LiveExoPlayerManager mPlayer;
|
||||
|
||||
//0未申请1申请中2连麦中
|
||||
RCRTCRoom rcrtcRoom;
|
||||
String purl;
|
||||
String purl, srcUrl;
|
||||
|
||||
public int getLandscape() {
|
||||
return landscape;
|
||||
@ -136,12 +139,13 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
@Override
|
||||
public void init() {
|
||||
EventBus.getDefault().register(this);
|
||||
Bus.getOn(this);
|
||||
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 = (RelativeLayout) findViewById(R.id.pk_container);
|
||||
mVideoView = (TXCloudVideoView) findViewById(R.id.video_view);
|
||||
mVideoView = (SurfaceView) findViewById(R.id.video_view);
|
||||
ry_view = (FrameLayout) findViewById(R.id.ry_view);
|
||||
leave = (ImageView) findViewById(R.id.leave);
|
||||
mLoading = findViewById(R.id.loading);
|
||||
@ -154,9 +158,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mPkContainer.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
mPkContainer.requestLayout();
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
mPlayer.setRenderView(mVideoView);
|
||||
|
||||
mPlayer = new LiveExoPlayerManager(mContext);
|
||||
mPlayer.setMainView(mVideoView);
|
||||
mPlayer.setListener(new ExoPlayerListener());
|
||||
debugView = new TextView(mContext);
|
||||
debugView.setBackgroundColor(Color.WHITE);
|
||||
|
||||
@ -193,6 +198,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
@Override
|
||||
public synchronized void setLiveBeanLandscape(int landscape) {
|
||||
this.landscape = landscape;
|
||||
this.videoLandscape = landscape;
|
||||
if (landscape == 2) {
|
||||
Log.i("收到socket--->", "还原9:16");
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
@ -247,13 +253,12 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
*/
|
||||
@Override
|
||||
public void resumePlay() {
|
||||
if (mPlayer.isPlaying() != 1) {
|
||||
if (!mPlayer.isPlaying()) {
|
||||
new Handler(Looper.getMainLooper())
|
||||
.postDelayed(() -> {
|
||||
mPlayer.stopPlay();
|
||||
int val = mPlayer.startPlay(purl);
|
||||
mPlayer.stop();
|
||||
mPlayer.play();
|
||||
// ToastUtil.show("强制播放" + val);
|
||||
Log.i(TAG, "强制播放: " + val);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
@ -264,7 +269,44 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url, int playModel) {
|
||||
srcUrl = url;
|
||||
PLAY_MODEL = playModel;
|
||||
if (playModel != PLAY_MODEL_DEF) {
|
||||
if (videoLandscape == VIDEO_VERTICAL) {
|
||||
url = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
|
||||
} else if (videoLandscape == VIDEO_HORIZONTAL) {
|
||||
url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
|
||||
}
|
||||
}
|
||||
Log.e("purl121", url);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
return;
|
||||
}
|
||||
if (mPlayer.isPlaying()) {
|
||||
mPlayer.stop();
|
||||
}
|
||||
mPlayer.startUrl(url);
|
||||
purl = url;
|
||||
onPrepared();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchStream(String url, int playModel) {
|
||||
srcUrl = url;
|
||||
PLAY_MODEL = playModel;
|
||||
if (playModel != PLAY_MODEL_DEF) {
|
||||
if (videoLandscape == VIDEO_VERTICAL) {
|
||||
url = url.replace(".flv", videoRatioVertical[playModel] + videoFps[0] + ".flv");
|
||||
} else if (videoLandscape == VIDEO_HORIZONTAL) {
|
||||
url = url.replace(".flv", videoRatioHorizontal[playModel] + videoFps[0] + ".flv");
|
||||
}
|
||||
}
|
||||
Log.e("purl121", url);
|
||||
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
@ -275,140 +317,26 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
if (TextUtils.isEmpty(url) || mVideoView == null) {
|
||||
return;
|
||||
}
|
||||
mVideoView.clearLastFrame(true);
|
||||
mPlayer.setObserver(new V2TXLivePlayerObserver() {
|
||||
String TAG = "播放流";
|
||||
|
||||
@Override
|
||||
public void onError(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||
super.onError(player, code, msg, extraInfo);
|
||||
Log.i(TAG, "onError: player = " + player + ", code = " + code + ", msg = " + msg + ", extraInfo = " + extraInfo);
|
||||
debugView.setText("播放出错code=" + code + " msg=" + msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarning(V2TXLivePlayer player, int code, String msg, Bundle extraInfo) {
|
||||
super.onWarning(player, code, msg, extraInfo);
|
||||
Log.i(TAG, "onWarning: " + "player = " + player + ", code = " + code + ", msg = " + msg + ", extraInfo = " + extraInfo);
|
||||
if (code == 2105) {
|
||||
// mPlayer.resumeVideo();
|
||||
// mPlayer.resumeAudio();
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.startPlay(purl);
|
||||
}
|
||||
debugView.setText("播放警告code=" + code + " msg=" + msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoPlayStatusUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayStatus status, V2TXLiveDef.V2TXLiveStatusChangeReason reason, Bundle extraInfo) {
|
||||
super.onVideoPlayStatusUpdate(player, status, reason, extraInfo);
|
||||
//Log.i(TAG, "onVideoPlayStatusUpdate: " + "player = " + player + ", status = " + status + ", reason = " + reason + ", extraInfo = " + extraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioPlayStatusUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayStatus status, V2TXLiveDef.V2TXLiveStatusChangeReason reason, Bundle extraInfo) {
|
||||
super.onAudioPlayStatusUpdate(player, status, reason, extraInfo);
|
||||
//Log.i(TAG, "onAudioPlayStatusUpdate: " + "player = " + player + ", status = " + status + ", reason = " + reason + ", extraInfo = " + extraInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayoutVolumeUpdate(V2TXLivePlayer player, int volume) {
|
||||
super.onPlayoutVolumeUpdate(player, volume);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatisticsUpdate(V2TXLivePlayer player, V2TXLiveDef.V2TXLivePlayerStatistics statistics) {
|
||||
super.onStatisticsUpdate(player, statistics);
|
||||
Map<String, DownloadTask> taskMap = OkDownload.getInstance().getTaskMap();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("|");
|
||||
for (String key : taskMap.keySet()) {
|
||||
DownloadTask task = taskMap.get(key);
|
||||
buffer.append(task.progress.fileName).append(":");
|
||||
int status = task.progress.status;
|
||||
switch (status) {
|
||||
case 0:
|
||||
buffer.append("无状态");
|
||||
break;
|
||||
case 1:
|
||||
buffer.append("等待");
|
||||
break;
|
||||
case 2:
|
||||
buffer.append("下载中:").append(task.progress.fraction);
|
||||
break;
|
||||
case 3:
|
||||
buffer.append("暂停");
|
||||
break;
|
||||
case 4:
|
||||
buffer.append("错误");
|
||||
break;
|
||||
case 5:
|
||||
buffer.append("完成");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
buffer.append("|");
|
||||
}
|
||||
hideCover();
|
||||
String debugText = "视频码率:" + statistics.videoBitrate + "\n" +
|
||||
"音频码率:" + statistics.audioBitrate + "\n" +
|
||||
"FPS:" + statistics.fps + "\n" +
|
||||
"CPU:" + statistics.appCpu + "\n" +
|
||||
"剩余内存:" + DeviceUtils.getMemory(mContext) + "\n" +
|
||||
"分辨率:" + statistics.height + "x" + statistics.width + "\n" +
|
||||
"播放状态:" + mPlayer.isPlaying() + "\n" +
|
||||
"运行时间:" + (System.currentTimeMillis() - CrashSaveBean.getInstance().getStartTime()) / 1000 + "\n";
|
||||
debugView.setText(debugText);
|
||||
Log.i(TAG, "onStatisticsUpdate: " + JSON.toJSONString(statistics) + " |当前下载数 : " + OkDownload.getInstance().getTaskMap().size() + buffer);
|
||||
if (statistics.height > statistics.width) {
|
||||
videoLandscape = VIDEO_VERTICAL;
|
||||
} else {
|
||||
videoLandscape = VIDEO_HORIZONTAL;
|
||||
}
|
||||
if (statistics.fps == 0) {
|
||||
OkDownload.getInstance().pauseAll();
|
||||
} else {
|
||||
OkDownload.getInstance().startAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSnapshotComplete(V2TXLivePlayer player, Bitmap image) {
|
||||
super.onSnapshotComplete(player, image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderVideoFrame(V2TXLivePlayer player, V2TXLiveDef.V2TXLiveVideoFrame videoFrame) {
|
||||
super.onRenderVideoFrame(player, videoFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveSeiMessage(V2TXLivePlayer player, int payloadType, byte[] data) {
|
||||
super.onReceiveSeiMessage(player, payloadType, data);
|
||||
}
|
||||
});
|
||||
|
||||
mPlayer.switchUrl(url);
|
||||
purl = url;
|
||||
int V2TXLiveCode = mPlayer.startPlay(url);
|
||||
onPrepared();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mEnd = true;
|
||||
mStarted = false;
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
}
|
||||
Bus.getOff(this);
|
||||
EventBus.getDefault().unregister(this);
|
||||
L.e(TAG, "release------->");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay() {
|
||||
Log.i(TAG, "stopPlay: ");
|
||||
if (mCover != null) {
|
||||
mCover.setAlpha(1f);
|
||||
if (mCover.getVisibility() != View.VISIBLE) {
|
||||
@ -416,7 +344,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
}
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.stop();
|
||||
}
|
||||
stopPlay2();
|
||||
}
|
||||
@ -629,7 +557,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
params.topMargin = 0;
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation270);
|
||||
// mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation270);
|
||||
mVideoView.requestLayout();
|
||||
}
|
||||
|
||||
@ -639,7 +567,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mVideoView.getLayoutParams();
|
||||
params.height = vHeight;
|
||||
params.topMargin = mContext.getResources().getDimensionPixelOffset(R.dimen.live_top);
|
||||
mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation0);
|
||||
// mPlayer.setRenderRotation(V2TXLiveDef.V2TXLiveRotation.V2TXLiveRotation0);
|
||||
params.addRule(RelativeLayout.ALIGN_TOP);
|
||||
mVideoView.requestLayout();
|
||||
}
|
||||
@ -703,10 +631,10 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
Log.e("ry", "退出多人房间成功");
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
mPlayer.startPlay(purl);
|
||||
mPlayer.play();
|
||||
Log.e("ry", mPlayer.isPlaying() + "purl" + purl);
|
||||
if (mPlayer.isPlaying() != 1) {
|
||||
mPlayer.startPlay(purl);
|
||||
if (!mPlayer.isPlaying()) {
|
||||
mPlayer.switchUrl(purl);
|
||||
}
|
||||
ry_view.removeAllViews();
|
||||
ry_view.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
@ -755,6 +683,87 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onOpenDrawer(LiveAudienceEvent event) {
|
||||
if (event.getType() == LiveAudienceEvent.LiveAudienceType.LIVE_VIDEO) {
|
||||
int ban = roomModel.getClarityType() - 1 == PLAY_MODEL_720 ? LiveClarityCustomPopup.BAN_1080 : roomModel.getClarityType() - 1 == PLAY_MODEL_480 ? LiveClarityCustomPopup.BAN_720 : 0;
|
||||
LiveClarityCustomPopup liveClarityCustomPopup = new LiveClarityCustomPopup(mContext, PLAY_MODEL, ban);
|
||||
new XPopup.Builder(mContext)
|
||||
.setPopupCallback(new XPopupCallback() {
|
||||
@Override
|
||||
public void onCreated(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(BasePopupView popupView) {
|
||||
int selectClarity = liveClarityCustomPopup.getSelectClarity();
|
||||
if (selectClarity == PLAY_MODEL) return;
|
||||
if (selectClarity == 2) {
|
||||
new DialogUitl.Builder(mContext)
|
||||
.setTitle("超高清提示")
|
||||
.setContent("在網速不穩定的情況下,選擇超高清將會有可能導致直播間畫面卡頓,是否確認選擇?")
|
||||
.setConfrimString("堅持選擇")
|
||||
.setCancelString("返回")
|
||||
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
switchStream(srcUrl, selectClarity);
|
||||
dialog.dismiss();
|
||||
showToast();
|
||||
}
|
||||
}).build().show();
|
||||
} else {
|
||||
switchStream(srcUrl, selectClarity);
|
||||
showToast();
|
||||
}
|
||||
}
|
||||
|
||||
private void showToast() {
|
||||
DialogUitl.showToast(mContext, " 設置成功\n" +
|
||||
"正在為你轉換中", 3000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDismiss(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed(BasePopupView popupView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBoardStateChanged(BasePopupView popupView, int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickOutside(BasePopupView popupView) {
|
||||
|
||||
}
|
||||
})
|
||||
.asCustom(liveClarityCustomPopup)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把观众转换成主播
|
||||
*/
|
||||
@ -783,7 +792,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
for (RCRTCInputStream stream : data.getLiveStreams()) {
|
||||
if (stream.getMediaType() == RCRTCMediaType.VIDEO) {
|
||||
//暂停播放
|
||||
mPlayer.stopPlay();
|
||||
mPlayer.stop();
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
|
||||
//如果远端用户发布的是视频流,创建显示视图RCRTCVideoView,并添加到布局中显示
|
||||
@ -1020,4 +1029,67 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showLoadingDialog() {
|
||||
if (PLAY_MODEL == PLAY_MODEL_480) return;
|
||||
|
||||
new DialogUitl.Builder(mContext)
|
||||
.setTitle("網絡提示")
|
||||
.setContent("系統監測到您的網絡不穩定,對此將清晰度變成了流暢,您可以在側邊菜單中的「清晰度」選擇調回。")
|
||||
.setView(R.layout.dialog_simple_tip)
|
||||
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}).build().show();
|
||||
PLAY_MODEL = PLAY_MODEL_480;
|
||||
String url = srcUrl;
|
||||
if (videoLandscape == VIDEO_VERTICAL) {
|
||||
url = url.replace(".flv", videoRatioVertical[PLAY_MODEL_480] + videoFps[0] + ".flv");
|
||||
} else if (videoLandscape == VIDEO_HORIZONTAL) {
|
||||
url = url.replace(".flv", videoRatioHorizontal[PLAY_MODEL_480] + videoFps[0] + ".flv");
|
||||
}
|
||||
mPlayer.switchUrl(url);
|
||||
}
|
||||
|
||||
private class ExoPlayerListener implements Player.Listener {
|
||||
String TAG = "播放流";
|
||||
|
||||
@Override
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
Player.Listener.super.onPlayerError(error);
|
||||
debugView.setText("播放出错code=" + error.errorCode + " msg=" + error.getErrorCodeName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
Player.Listener.super.onVideoSizeChanged(videoSize);
|
||||
Log.i(TAG, "onVideoSizeChanged: width = " + videoSize.width + " height = " + videoSize.height);
|
||||
// ToastUtil.show("分辨率: width = " + videoSize.width + " height = " + videoSize.height);
|
||||
if (videoSize.height > videoSize.width) {
|
||||
videoLandscape = VIDEO_VERTICAL;
|
||||
} else {
|
||||
videoLandscape = VIDEO_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
Player.Listener.super.onPlaybackStateChanged(playbackState);
|
||||
if (playbackState == Player.STATE_BUFFERING) {
|
||||
showLoadingDialog();
|
||||
OkDownload.getInstance().pauseAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIsPlayingChanged(boolean isPlaying) {
|
||||
Player.Listener.super.onIsPlayingChanged(isPlaying);
|
||||
if (isPlaying) {
|
||||
hideCover();
|
||||
OkDownload.getInstance().startAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url,int playModel) {
|
||||
url = "webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1";
|
||||
|
||||
mPlayer = new V2TXLivePlayerImpl(mContext);
|
||||
@ -318,6 +318,11 @@ public class LivePlayTxViewHolder extends LiveRoomPlayViewHolder implements ITXL
|
||||
L.e(TAG, "play----url--->" + url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchStream(String url, int playModel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay() {
|
||||
mChangeToLeft = false;
|
||||
|
@ -251,7 +251,7 @@ public class LivePlayTxViewHolder_backup extends LiveRoomPlayViewHolder implemen
|
||||
* @param url 流地址
|
||||
*/
|
||||
@Override
|
||||
public void play(String url) {
|
||||
public void play(String url,int playModel) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return;
|
||||
}
|
||||
@ -280,6 +280,11 @@ public class LivePlayTxViewHolder_backup extends LiveRoomPlayViewHolder implemen
|
||||
L.e(TAG, "play----url--->" + url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchStream(String url, int playModel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay() {
|
||||
mChangeToLeft = false;
|
||||
|
@ -25,7 +25,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.tencent.liteav.device.TXDeviceManager;
|
||||
import com.tencent.rtmp.ITXLivePushListener;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
@ -35,11 +34,11 @@ import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.AnchorInfoEvent;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.IMRTCManager;
|
||||
import com.yunbao.common.manager.RandomPkManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@ -72,12 +71,14 @@ import cn.rongcloud.rtc.api.RCRTCRoomConfig;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
|
||||
import cn.rongcloud.rtc.api.callback.IRCRTCVideoOutputFrameListener;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
|
||||
import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
|
||||
import cn.rongcloud.rtc.base.RCRTCParamsType;
|
||||
import cn.rongcloud.rtc.base.RCRTCRoomType;
|
||||
import cn.rongcloud.rtc.base.RCRTCVideoFrame;
|
||||
import cn.rongcloud.rtc.base.RTCErrorCode;
|
||||
import cn.rongcloud.rtc.core.CameraVideoCapturer;
|
||||
import cn.rongcloud.rtc.core.RendererCommon;
|
||||
@ -114,11 +115,11 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUPAnchorInfo(AnchorInfoEvent e) {
|
||||
if (e != null) {
|
||||
if(e.isClear()==false) {
|
||||
if (e.isClear() == false) {
|
||||
tv_avatarOther_name.setText(e.getUserNiceName());
|
||||
ImgLoader.displayAvatar(mContext, e.getAvatar(), avatarOther);
|
||||
goto_room_view.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
goto_room_view.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
@ -417,7 +418,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
//断开连麦
|
||||
LiveRyAnchorActivity.isDRPK=0;
|
||||
LiveRyAnchorActivity.isDRPK = 0;
|
||||
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
@ -560,16 +561,37 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
|
||||
RCRTCEngine.getInstance().init(contexts, config);
|
||||
RCRTCEngine.getInstance().getDefaultAudioStream().setAudioQuality(RCRTCParamsType.AudioQuality.MUSIC_HIGH, RCRTCParamsType.AudioScenario.MUSIC_CHATROOM);
|
||||
//設置開播分辨率
|
||||
RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
|
||||
int minRate = 200;
|
||||
int maxRate = 900;
|
||||
switch (IMLoginManager.get(mContext).getSelectClarity()) {
|
||||
case 0:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
|
||||
minRate = 200;
|
||||
maxRate = 900;
|
||||
break;
|
||||
case 1:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280;
|
||||
minRate = 250;
|
||||
maxRate = 2200;
|
||||
break;
|
||||
case 2:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920;
|
||||
minRate = 400;
|
||||
maxRate = 4000;
|
||||
break;
|
||||
}
|
||||
|
||||
RCRTCVideoStreamConfig videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create()
|
||||
//设置分辨率
|
||||
.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_640)
|
||||
.setVideoResolution(rcrtcVideoResolution)
|
||||
//设置帧率
|
||||
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30)
|
||||
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_24)
|
||||
//设置最小码率,480P下推荐200
|
||||
.setMinRate(250)
|
||||
.setMinRate(minRate)
|
||||
//设置最大码率,480P下推荐900
|
||||
.setMaxRate(5000)
|
||||
.setMaxRate(maxRate)
|
||||
.build();
|
||||
|
||||
// 创建本地视频显示视图
|
||||
@ -595,7 +617,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
mPreView.addView(rongRTCVideoView);
|
||||
tencentTRTCBeautyManager = new TencentTRTCBeautyManager(mContext);
|
||||
|
||||
|
||||
//加入房间成功后可以通过 RCRTCLocalUser 对象发布本地默认音视频流,包括:麦克风采集的音频和摄像头采集的视频。
|
||||
RCRTCEngine.getInstance().getDefaultVideoStream().setEncoderMirror(true);
|
||||
if (rtcRoom == null || rtcRoom.getLocalUser() == null) {
|
||||
@ -615,20 +636,13 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
room.registerRoomListener(roomEventsListener);
|
||||
|
||||
//美颜
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
public void run() {
|
||||
//旧美颜不需要了
|
||||
/*RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
|
||||
@Override
|
||||
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame rtcVideoFrame) {
|
||||
// 使用数据进行美颜/录像等处理后,需要把数据再返回给 SDK 做发送。
|
||||
rtcVideoFrame.setTextureId(tencentTRTCBeautyManager.renderWithTexture(rtcVideoFrame.getTextureId(), rtcVideoFrame.getWidth(), rtcVideoFrame.getHeight(), false));
|
||||
return rtcVideoFrame;
|
||||
}
|
||||
});*/
|
||||
|
||||
}
|
||||
});
|
||||
// new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
// public void run() {
|
||||
// //旧美颜不需要了
|
||||
//
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -716,24 +730,38 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
RCRTCMixConfig config = new RCRTCMixConfig();
|
||||
RCRTCMixConfig.MediaConfig mediaConfig = new RCRTCMixConfig.MediaConfig();
|
||||
config.setMediaConfig(mediaConfig);
|
||||
//视频输出配置
|
||||
//视频输出配置
|
||||
RCRTCMixConfig.MediaConfig.VideoConfig videoConfig = new RCRTCMixConfig.MediaConfig.VideoConfig();
|
||||
mediaConfig.setVideoConfig(videoConfig);
|
||||
//大流视频的输出参数
|
||||
//大流视频的输出参数
|
||||
RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout normal = new RCRTCMixConfig.MediaConfig.VideoConfig.VideoLayout();
|
||||
videoConfig.setVideoLayout(normal);
|
||||
//推荐宽、高、帧率参数值可以通过默认视频流的配置获取,也可以根据实际需求来自定义设置
|
||||
//如不设置宽高值则服务端将使用默认宽高 360 * 640
|
||||
//例:发布的视频分辨率为720 * 1280,如果不设置则观众端看到的视频分辨率为 360 * 640,
|
||||
//所以如果想让观众端看到的视频分辨率和发布视频分辨率一致,则应从发布的视频流中获取分辨率配置并设置到 mediaConfig 中
|
||||
RCRTCVideoStreamConfig defaultVideoConfig = RCRTCEngine.getInstance().getDefaultVideoStream().getVideoConfig();
|
||||
int fps = defaultVideoConfig.getVideoFps().getFps();
|
||||
int width = 720;
|
||||
int height = 1280;
|
||||
|
||||
//推荐宽、高、帧率参数值可以通过默认视频流的配置获取,也可以根据实际需求来自定义设置
|
||||
//如不设置宽高值则服务端将使用默认宽高 360 * 640
|
||||
//例:发布的视频分辨率为720 * 1280,如果不设置则观众端看到的视频分辨率为 360 * 640,
|
||||
//所以如果想让观众端看到的视频分辨率和发布视频分辨率一致,则应从发布的视频流中获取分辨率配置并设置到 mediaConfig 中
|
||||
//設置開播分辨率
|
||||
//設置開播分辨率
|
||||
RCRTCParamsType.RCRTCVideoResolution rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
|
||||
int minRate = 200;
|
||||
int maxRate = 900;
|
||||
switch (IMLoginManager.get(mContext).getSelectClarity()) {
|
||||
case 0:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_848;
|
||||
break;
|
||||
case 1:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_720_1280;
|
||||
break;
|
||||
case 2:
|
||||
rcrtcVideoResolution = RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_1080_1920;
|
||||
break;
|
||||
}
|
||||
int width = rcrtcVideoResolution.getWidth();
|
||||
int height = rcrtcVideoResolution.getHeight();
|
||||
normal.setWidth(width); //视频宽
|
||||
normal.setHeight(height); //视频高
|
||||
normal.setFps(fps); //视频帧率
|
||||
|
||||
normal.setFps(15); //视频帧率
|
||||
videoConfig.setVideoLayout(normal);
|
||||
//2. 合流画布设置
|
||||
//(请参照画布和声音配置示例代码)
|
||||
//3. 假设以画布设置的宽高为 300 * 300为例(应以真实设置的宽高为准),设置每个视频流小窗口的坐标及宽高
|
||||
@ -747,6 +775,16 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
videoLayout1.setY(0); //Y 坐标
|
||||
videoLayout1.setWidth(720); // 视频窗口的宽
|
||||
videoLayout1.setHeight(1280); // 视频窗口的高
|
||||
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoFrameListener(new IRCRTCVideoOutputFrameListener() {
|
||||
@Override
|
||||
public RCRTCVideoFrame processVideoFrame(RCRTCVideoFrame rtcVideoFrame) {
|
||||
// 使用数据进行美颜/录像等处理后,需要把数据再返回给 SDK 做发送。
|
||||
// rtcVideoFrame.setTextureId(tencentTRTCBeautyManager.renderWithTexture(rtcVideoFrame.getTextureId(), rtcVideoFrame.getWidth(), rtcVideoFrame.getHeight(), false));
|
||||
Log.e("视频流", "Width---------------------" + rtcVideoFrame.getWidth());
|
||||
Log.e("视频流", "Height---------------------" + rtcVideoFrame.getHeight());
|
||||
return rtcVideoFrame;
|
||||
}
|
||||
});
|
||||
//2. 合流画布设置
|
||||
rcrtcLiveInfo.setMixConfig(config, new IRCRTCResultCallback() {
|
||||
@Override
|
||||
@ -762,6 +800,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveChooseClassActivity;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.adapter.LiveReadyShareAdapter;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.common.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveTimeDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveWishListDialogFragment;
|
||||
@ -471,7 +471,7 @@ public class LiveReadyRyViewHolder extends AbsViewHolder implements View.OnClick
|
||||
return;
|
||||
}
|
||||
String title = mEditTitle.getText().toString().trim();
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() {
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile,0, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, final String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
|
@ -1,12 +1,13 @@
|
||||
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;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -17,12 +18,17 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
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;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@ -42,7 +48,6 @@ import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAnchorActivity;
|
||||
import com.yunbao.live.activity.LiveChooseClassActivity;
|
||||
import com.yunbao.live.adapter.LiveReadyShareAdapter;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveTimeDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveWishListDialogFragment;
|
||||
@ -51,10 +56,6 @@ import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
* 开播前准备
|
||||
@ -491,7 +492,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
||||
return;
|
||||
}
|
||||
String title = mEditTitle.getText().toString().trim();
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, new HttpCallback() {
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, mAvatarFile, 0, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, final String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
@ -535,7 +536,7 @@ public class LiveReadyViewHolder extends AbsViewHolder implements View.OnClickLi
|
||||
@Override
|
||||
public void onError(Response<JsonBean> response) {
|
||||
super.onError(response);
|
||||
System.out.println("tx 开播失败 = "+response);
|
||||
System.out.println("tx 开播失败 = " + response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.yunbao.live.views;
|
||||
import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.views.AbsViewHolder;
|
||||
import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
@ -13,14 +14,25 @@ import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
|
||||
public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements ILiveLinkMicViewHolder {
|
||||
protected LiveBean mLiveBean;
|
||||
public static final int PLAY_MODEL_DEF = -1;
|
||||
public static final int PLAY_MODEL_480 = 0;
|
||||
public static final int PLAY_MODEL_720 = 1;
|
||||
public static final int PLAY_MODEL_1080 = 2;
|
||||
public static int PLAY_MODEL = PLAY_MODEL_DEF;
|
||||
|
||||
public static final String[] videoRatioHorizontal = new String[]{"_848_480", "_1280_720", "_1920_1080"};
|
||||
public static final String[] videoRatioVertical = new String[]{"_480_848", "_720_1280", "_1080_1920"};
|
||||
public static final String[] videoFps = new String[]{"_24", "_30"};
|
||||
OnMicCallback onMicCallback;//连麦回调
|
||||
public EnterRoomNewModel roomModel;
|
||||
|
||||
public LiveRoomPlayViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
}
|
||||
|
||||
public abstract void play(String url);
|
||||
public abstract void play(String url, int playModel);
|
||||
|
||||
public abstract void switchStream(String url, int playModel);
|
||||
|
||||
public abstract void stopPlay();
|
||||
|
||||
@ -58,8 +70,13 @@ public abstract class LiveRoomPlayViewHolder extends AbsViewHolder implements IL
|
||||
this.onMicCallback = onMicCallback;
|
||||
}
|
||||
|
||||
public void setLiveEnterRoomNewModel(EnterRoomNewModel data) {
|
||||
data.setClarityType(2);
|
||||
this.roomModel = data;
|
||||
}
|
||||
|
||||
public interface OnMicCallback{
|
||||
|
||||
public interface OnMicCallback {
|
||||
void onMikUpdate();
|
||||
|
||||
}
|
||||
|
@ -186,6 +186,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
private int landscape;
|
||||
private String leaveStream = "", leaveGroupId = "";
|
||||
public static PortraitLiveManager portraitLiveManager;
|
||||
|
||||
|
||||
public PortraitLiveManager setQuitF(boolean quitF) {
|
||||
isQuitF = quitF;
|
||||
@ -196,6 +198,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
this.mContext = context;
|
||||
this.mIntent = intent;
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
portraitLiveManager = this;
|
||||
ininView();
|
||||
}
|
||||
|
||||
@ -296,7 +299,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
mask.setVisibility(View.VISIBLE);
|
||||
mLivePlayViewHolder.setLiveBean(mLiveBean);
|
||||
mLivePlayViewHolder.setCover(mLiveBean.getAvatar());
|
||||
mLivePlayViewHolder.play(mLiveBean.getPull());
|
||||
mLivePlayViewHolder.play(mLiveBean.getPull(), LiveRoomPlayViewHolder.PLAY_MODEL_DEF);
|
||||
mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() {
|
||||
@Override
|
||||
public void onMikUpdate() {
|
||||
@ -327,6 +330,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Runnable sendFIm = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -352,6 +356,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
landscape = data.getLiveInfo().getLandscape();
|
||||
mLivePlayViewHolder.setLiveBeanLandscape(landscape);
|
||||
mLivePlayViewHolder.setLiveEnterRoomNewModel(data);
|
||||
mLivePlayViewHolder.switchStream(mLiveBean.getPull(), data.getClarityType() - 1);
|
||||
//是否热度卡加成
|
||||
liveHandler.postDelayed(() -> mLiveRoomViewHolder.getIsHot(data.getIsUseHotCard()), 700);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<com.tencent.rtmp.ui.TXCloudVideoView
|
||||
<SurfaceView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|