開播設置,修改開播接口新增分辨率設置參數

This commit is contained in:
18401019693 2022-12-29 17:04:23 +08:00
parent 87e3dddac5
commit d81e6b9f04
27 changed files with 691 additions and 35 deletions

View File

@ -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;

View File

@ -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();
}
/**
* 直播间取消网络请求
*/

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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>

View File

@ -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>

View 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>

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 883 B

After

Width:  |  Height:  |  Size: 883 B

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 955 B

After

Width:  |  Height:  |  Size: 955 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

View File

@ -1000,4 +1000,13 @@
<string name="standard_clear" translatable="false">流暢</string>
<string name="ultra_hd" translatable="false">超高清</string>
<string name="clarity_hint" translatable="false">確定清晰度開播後,需要重新開播才能更改</string>
<string name="confirmation_of_broadcast" translatable="false">開播設置確認</string>
<string name="clarity" translatable="false">清晰度</string>
<string name="live_class1" translatable="false">直播頻道</string>
<string name="broadcast" translatable="false">開播</string>
<string name="robot" translatable="false">機器人</string>
<string name="do_set" translatable="false">已設置</string>
<string name="not_set" translatable="false">未設置</string>
<string name="robot_no" translatable="false"></string>
<string name="robot_yes" translatable="false"></string>
</resources>

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -47,10 +47,11 @@ public class LiveHttpUtil {
/**
* 获取直播用户日榜/周榜
*
* @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);

View File

@ -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;
@ -23,6 +25,7 @@ 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;
@ -37,21 +40,25 @@ 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 cn.rongcloud.rtc.api.RCRTCEngine;
@ -78,6 +85,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);
@ -269,6 +277,9 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
liveClarity.setText(R.string.ultra_hd);
break;
}
if (liveOpenCustomPopup != null) {
liveOpenCustomPopup.setSelectClarity(selectClarity);
}
}
public void setManager(FaceManager manager) {
@ -299,8 +310,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 +496,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 +593,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 +615,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 +625,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 +640,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 +738,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 +764,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) {

View File

@ -565,7 +565,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
//设置分辨率
.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_640)
//设置帧率
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30)
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_24)
//设置最小码率480P下推荐200
.setMinRate(250)
//设置最大码率480P下推荐900
@ -732,7 +732,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
int height = 1280;
normal.setWidth(width); //视频宽
normal.setHeight(height); //视频高
normal.setFps(fps); //视频帧率
normal.setFps(25); //视频帧率
//2. 合流画布设置
//(请参照画布和声音配置示例代码)

View File

@ -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) {

View File

@ -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);
}
});
}