update 中英文

fix 播放器监测
This commit is contained in:
zlzw 2023-09-20 18:26:59 +08:00
parent 9ff382e35b
commit 3150489384
30 changed files with 225 additions and 41 deletions

View File

@ -21,6 +21,7 @@ import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.HintCustomPopup; import com.yunbao.common.views.HintCustomPopup;
import com.yunbao.common.views.LiveNewWishGiftPopup; import com.yunbao.common.views.LiveNewWishGiftPopup;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -149,7 +150,7 @@ public class LiveNewWishListFragment extends BaseFragment {
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show("修改成功"); ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
} }
@Override @Override
@ -181,7 +182,7 @@ public class LiveNewWishListFragment extends BaseFragment {
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show("修改成功"); ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
} }
@Override @Override
@ -200,7 +201,7 @@ public class LiveNewWishListFragment extends BaseFragment {
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show("修改成功"); ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
} }
@Override @Override

View File

@ -6,6 +6,7 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -100,7 +101,11 @@ public class IMRTCManager {
public void onSuccess() { public void onSuccess() {
callback.onSuccess(); callback.onSuccess();
if (!RandomPkManager.getInstance().isRandomModel()) { if (!RandomPkManager.getInstance().isRandomModel()) {
ToastUtil.show("发起邀请成功"); if(WordUtil.isNewZh()) {
ToastUtil.show("发起邀请成功");
}else{
ToastUtil.show("successful");
}
} }
requestUid.add(liveUid); requestUid.add(liveUid);
startRequestTimeoutTask(liveUid); startRequestTimeoutTask(liveUid);
@ -109,7 +114,11 @@ public class IMRTCManager {
@Override @Override
public void onFailed(RTCErrorCode errorCode) { public void onFailed(RTCErrorCode errorCode) {
if (!RandomPkManager.getInstance().isRandomModel()) { if (!RandomPkManager.getInstance().isRandomModel()) {
ToastUtil.show("邀请失败 " + errorCode.getValue()); if(WordUtil.isNewZh()) {
ToastUtil.show("邀请失败 " + errorCode.getValue());
}else{
ToastUtil.show("invite failed:" +errorCode.getValue());
}
} }
if (RandomPkManager.getInstance().isRequestPk()) { if (RandomPkManager.getInstance().isRequestPk()) {
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE); RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);

View File

@ -30,7 +30,7 @@ public class NobleUtil {
case 1:return "男爵"; case 1:return "男爵";
case 2:return "子爵"; case 2:return "子爵";
case 3:return "侯爵"; case 3:return "侯爵";
case 4:return "公爵"; case 4:return "公爵";
case 5:return "国王"; case 5:return "国王";
case 6:return "皇帝"; case 6:return "皇帝";
case 7:return "超皇"; case 7:return "超皇";
@ -39,15 +39,15 @@ public class NobleUtil {
} }
public static String nobleIdToStringNameForEn(int id){ public static String nobleIdToStringNameForEn(int id){
switch (id){ switch (id){
case 1:return "baron"; case 1:return "Baron";
case 2:return "viscount"; case 2:return "Viscount";
case 3:return "marquis"; case 3:return "Marquis";
case 4:return "duke"; case 4:return "Duke";
case 5:return "king"; case 5:return "King";
case 6:return "emperor"; case 6:return "Emperor";
case 7:return "SuperEmperor"; case 7:return "SuperKing";
} }
return "Not Opened"; return "Not opened";
} }
public static int getNobleBackgroundId(int id){ public static int getNobleBackgroundId(int id){
switch (id){ switch (id){

View File

@ -43,7 +43,7 @@ public class ToastUtil {
public static void show(int res) { public static void show(int res) {
show(WordUtil.getString(res)); show(WordUtil.getNewString(res));
} }
/** /**

View File

@ -14,6 +14,7 @@ import com.lxj.xpopup.animator.PopupAnimator;
import com.lxj.xpopup.core.CenterPopupView; import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
/** /**
@ -85,7 +86,7 @@ public class InputCustomPopup extends CenterPopupView {
public void onViewClicks() { public void onViewClicks() {
String textContent = content.getText().toString(); String textContent = content.getText().toString();
if (TextUtils.isEmpty(textContent)) { if (TextUtils.isEmpty(textContent)) {
ToastUtil.show("输入内容不可为空"); ToastUtil.show(WordUtil.isNewZh()?"输入内容不可为空":"The input cannot be empty");
return; return;
} }
if (listener != null) { if (listener != null) {

View File

@ -32,6 +32,7 @@ import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -332,7 +333,7 @@ public class LiveNewWishListPopup extends BottomPopupView {
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
@Override @Override
public void onSuccess(String data) { public void onSuccess(String data) {
ToastUtil.show("修改成功"); ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
} }
@Override @Override

View File

@ -1084,7 +1084,7 @@ Limited ride And limited avatar frame</string>
<string name="live_become_fans_medal">One-time gift ≥2000 diamonds), can obtain fan privilege yo</string> <string name="live_become_fans_medal">One-time gift ≥2000 diamonds), can obtain fan privilege yo</string>
<string name="live_go_charge">Top up</string> <string name="live_go_charge">Top up</string>
<string name="live_user_card_level">User level</string> <string name="live_user_card_level">User level</string>
<string name="live_noble_level_anchor">aristocracy</string> <string name="live_noble_level_anchor">Noble\nLevel</string>
<string name="live_noble_fens_anchor">Fan club</string> <string name="live_noble_fens_anchor">Fan club</string>
<string name="live_anchor_open_mic">Voice connection is not enabled</string> <string name="live_anchor_open_mic">Voice connection is not enabled</string>
<string name="live_honor_number_anchor">Wall of honor</string> <string name="live_honor_number_anchor">Wall of honor</string>
@ -1320,4 +1320,6 @@ Limited ride And limited avatar frame</string>
<string name="live_send_red_packge_fans_group">Join a fans club</string> <string name="live_send_red_packge_fans_group">Join a fans club</string>
<string name="live_pk_link_error">Sorry, your network failed to pull the other party.</string> <string name="live_pk_link_error">Sorry, your network failed to pull the other party.</string>
<string name="live_user_dialog_tips">say something</string> <string name="live_user_dialog_tips">say something</string>
<string name="live_free_pk_empty_tips">No match was found</string>
<string name="live_gift_dialog_select_add">Add</string>
</resources> </resources>

View File

@ -1317,4 +1317,6 @@
<string name="live_pk_link_error">抱歉,您的網絡不佳拉取對方畫面失敗</string> <string name="live_pk_link_error">抱歉,您的網絡不佳拉取對方畫面失敗</string>
<string name="live_user_dialog_tips">這家夥很懶,什麽都沒留下</string> <string name="live_user_dialog_tips">這家夥很懶,什麽都沒留下</string>
<string name="live_free_pk_empty_tips">沒有找到匹配結果~</string>
<string name="live_gift_dialog_select_add">確定添加</string>
</resources> </resources>

View File

@ -1316,4 +1316,6 @@
<string name="live_pk_link_error">抱歉,您的網絡不佳拉取對方畫面失敗</string> <string name="live_pk_link_error">抱歉,您的網絡不佳拉取對方畫面失敗</string>
<string name="live_user_dialog_tips">這家夥很懶,什麽都沒留下</string> <string name="live_user_dialog_tips">這家夥很懶,什麽都沒留下</string>
<string name="live_free_pk_empty_tips">沒有找到匹配結果~</string>
<string name="live_gift_dialog_select_add">確定添加</string>
</resources> </resources>

View File

@ -1316,4 +1316,6 @@
<string name="live_send_red_packge_fans_group">加入粉絲團</string> <string name="live_send_red_packge_fans_group">加入粉絲團</string>
<string name="live_pk_link_error">抱歉,您的網絡不佳拉取對方畫面失敗</string> <string name="live_pk_link_error">抱歉,您的網絡不佳拉取對方畫面失敗</string>
<string name="live_user_dialog_tips">這家夥很懶,什麽都沒留下</string> <string name="live_user_dialog_tips">這家夥很懶,什麽都沒留下</string>
<string name="live_free_pk_empty_tips">沒有找到匹配結果~</string>
<string name="live_gift_dialog_select_add">確定添加</string>
</resources> </resources>

View File

@ -1084,7 +1084,7 @@ Limited ride And limited avatar frame</string>
<string name="live_become_fans_medal">One-time gift ≥2000 diamonds), can obtain fan privilege yo</string> <string name="live_become_fans_medal">One-time gift ≥2000 diamonds), can obtain fan privilege yo</string>
<string name="live_go_charge">Top up</string> <string name="live_go_charge">Top up</string>
<string name="live_user_card_level">User level</string> <string name="live_user_card_level">User level</string>
<string name="live_noble_level_anchor">aristocracy</string> <string name="live_noble_level_anchor">Noble\nLevel</string>
<string name="live_noble_fens_anchor">Fan club</string> <string name="live_noble_fens_anchor">Fan club</string>
<string name="live_anchor_open_mic">Voice connection is not enabled</string> <string name="live_anchor_open_mic">Voice connection is not enabled</string>
<string name="live_honor_number_anchor">Wall of honor</string> <string name="live_honor_number_anchor">Wall of honor</string>
@ -1323,4 +1323,6 @@ Limited ride And limited avatar frame</string>
<string name="live_pk_link_error">Sorry, your network failed to pull the other party.</string> <string name="live_pk_link_error">Sorry, your network failed to pull the other party.</string>
<string name="live_user_dialog_tips">say something</string> <string name="live_user_dialog_tips">say something</string>
<string name="live_free_pk_empty_tips">No match was found</string>
<string name="live_gift_dialog_select_add">Add</string>
</resources> </resources>

View File

@ -70,6 +70,7 @@ import com.yunbao.common.utils.LogUtil;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.LiveNewWishListPopup; import com.yunbao.common.views.LiveNewWishListPopup;
import com.yunbao.common.views.LiveRobotSettingCustomPopup; import com.yunbao.common.views.LiveRobotSettingCustomPopup;
import com.yunbao.faceunity.FaceManager; import com.yunbao.faceunity.FaceManager;
@ -1244,7 +1245,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
}); });
//todo 安卓端状态码说明文档https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html //todo 安卓端状态码说明文档https://docs.rongcloud.cn/v4/views/rtc/call/code/android.html
Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + pkUid); Log.e("ry", rtcErrorCode + "aaaaaa" + CommonAppConfig.getInstance().getUid() + "VDSSSS" + pkUid);
ToastUtil.show("邀请 " + pkUid + " 发送失败 " + rtcErrorCode); if(WordUtil.isNewZh()) {
ToastUtil.show("邀请 " + pkUid + " 发送失败 " + rtcErrorCode);
}else{
ToastUtil.show("invite " + pkUid + " failed:"+rtcErrorCode);
}
} }
}); });
@ -1293,7 +1298,11 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
@Override @Override
public void onSuccess() { public void onSuccess() {
if (!extra.equals(SOCKET_LIVE_DRPK_RANDOM)) { if (!extra.equals(SOCKET_LIVE_DRPK_RANDOM)) {
ToastUtil.show("邀请 " + pkUid + " 发送成功"); if(WordUtil.isNewZh()) {
ToastUtil.show("邀请 " + pkUid + " 发送成功");
}else{
ToastUtil.show("invite " + pkUid + " successful");
}
} }
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override

View File

@ -221,9 +221,15 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
} }
if (bean.getType() == TYPE_MIC_REQUEST) { if (bean.getType() == TYPE_MIC_REQUEST) {
mBtn.setText("同意"); mBtn.setText("同意");
if(!WordUtil.isNewZh()){
mBtn.setText("agree");
}
mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_ok); mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_ok);
} else if (bean.getType() == TYPE_MIC_INVITE) { } else if (bean.getType() == TYPE_MIC_INVITE) {
mBtn.setText("邀请"); mBtn.setText("邀请");
if (!WordUtil.isNewZh()) {
mBtn.setText("invite");
}
mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_invite); mBtn.setBackgroundResource(R.drawable.bg_anchor_mic_info_btn_invite);
} }
ImgLoader.display(mContext, bean.getAvatar(), mAvatar); ImgLoader.display(mContext, bean.getAvatar(), mAvatar);

View File

@ -130,13 +130,13 @@ public class FreePkDialogFragment extends AbsDialogFragment implements View.OnCl
} }
}); });
if(!WordUtil.isNewZh()){ if(!WordUtil.isNewZh()){
mPkNumText.setText("Free PK remaining number"); mPkNumText.setText("Free PK number");
((TextView)findViewById(R.id.tmp_text2)).setText("Updated daily at 6am"); ((TextView)findViewById(R.id.tmp_text2)).setText("Updated daily at 6am");
} }
if (mDrPkNum != -1) { if (mDrPkNum != -1) {
mPkNumText.setText("多人PK剩余次數"); mPkNumText.setText("多人PK剩余次數");
if(!WordUtil.isNewZh()){ if(!WordUtil.isNewZh()){
mPkNumText.setText("multi-user PK remaining number"); mPkNumText.setText("multi-user PK number");
} }
} }
initRecycler(); initRecycler();

View File

@ -22,6 +22,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
@ -118,7 +119,7 @@ public class LiveNewWishListDialogFragment extends AbsDialogFragment implements
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
ToastUtil.show("修改成功"); ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
dismiss(); dismiss();
} else { } else {
ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg)); ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg));

View File

@ -18,6 +18,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.activity.LiveAnchorActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
@ -117,7 +118,7 @@ public class LiveWishListDialogFragment extends AbsDialogFragment implements OnI
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) { if (code == 0 && info.length > 0) {
ToastUtil.show("修改成功"); ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
dismiss(); dismiss();
} else { } else {
ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg)); ToastUtil.show("修改失败" + (msg.isEmpty() ? "" : msg));

View File

@ -57,6 +57,7 @@ import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ScreenDimenUtil;
import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.activity.LiveRyAnchorActivity;
@ -857,7 +858,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) {
rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener);
ToastUtil.show("接受成功"); ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success");
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
@ -976,7 +977,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
@Override @Override
public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) { public void onSuccess(RCRTCOtherRoom rcrtcOtherRoom) {
rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener); rcrtcOtherRoom.registerOtherRoomEventsListener(otherRoomEventsListener);
ToastUtil.show("接受成功"); ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success");
new Handler(Looper.getMainLooper()).post(new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() { public void run() {
Log.e("ry", liveid + "来了!!!!" + rcrtcOtherRoom.getRemoteUsers().size()); Log.e("ry", liveid + "来了!!!!" + rcrtcOtherRoom.getRemoteUsers().size());
@ -1659,7 +1660,7 @@ public class LiveRyLinkMicPkPresenter implements View.OnClickListener {
} }
Log.e("ry", "多人接受成功" + mApplyUid); Log.e("ry", "多人接受成功" + mApplyUid);
ToastUtil.show("接受成功"); ToastUtil.show(WordUtil.isNewZh()?"接受成功":"Success");
//遍历远端用户列表 //遍历远端用户列表
for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) { for (int i = 0; i < rcrtcOtherRoom.getRemoteUsers().size(); i++) {
Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcOtherRoom.getRemoteUsers().size()); Log.e("ry", rcrtcOtherRoom.getRemoteUsers().get(i).getUserId() + "收到rcrtcOtherRoom" + rcrtcOtherRoom.getRemoteUsers().size());

View File

@ -1,10 +1,12 @@
package com.yunbao.live.utils; package com.yunbao.live.utils;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log; import android.util.Log;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -18,9 +20,13 @@ import com.google.android.exoplayer2.analytics.AnalyticsListener;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.StyledPlayerView; import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.video.VideoSize; import com.google.android.exoplayer2.video.VideoSize;
import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import java.util.Timer;
import java.util.TimerTask;
/** /**
* 直播间播放器管理器 * 直播间播放器管理器
* 通过预加载子播放器来实现无缝切换分辨率功能 * 通过预加载子播放器来实现无缝切换分辨率功能
@ -40,6 +46,9 @@ public class LiveExoPlayerManager {
private static double log_buffer_time = 0, log_buffer_max_time; private static double log_buffer_time = 0, log_buffer_max_time;
private String url = ""; private String url = "";
private Context mContext; private Context mContext;
private TimerTask task;
TextView debugText;
public LiveExoPlayerManager(Context mContext) { public LiveExoPlayerManager(Context mContext) {
this.mContext = mContext; this.mContext = mContext;
@ -59,6 +68,109 @@ public class LiveExoPlayerManager {
handler = new Handler(Looper.getMainLooper()); handler = new Handler(Looper.getMainLooper());
setListener(); setListener();
setAnalyticsListener(); setAnalyticsListener();
//createDeBugDialog();
}
int index = 0;
private void createTask() {
if (task != null) {
return;
}
task = new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
try {
if (index > 5 && !player1.isPlaying() && !player2.isPlaying()) {
index = 0;
Log.i(TAG, "5秒内播放器没有播放重新播放");
ToastUtil.showDebug("强制重播");
handler.removeCallbacks(buffRunnable);
replay();
cancel();
} else if (player1.isPlaying() || player2.isPlaying()) {
index = 0;
} else {
index++;
}
} catch (Exception e) {
e.printStackTrace();
cancel();
task = null;
}
}
});
}
};
new Timer().schedule(task, 0, 1000);
}
private TimerTask debugTask;
private void createDeBugDialog() {
debugText = new TextView(mContext);
debugText.setText(getDebugText());
debugText.setBackgroundColor(Color.WHITE);
debugText.setTextColor(Color.BLACK);
EasyFloat.with(mContext)
.setTag("debug")
.setLayout(debugText)
.show();
debugTask = new TimerTask() {
@Override
public void run() {
updateDebug();
}
};
new Timer().schedule(debugTask, 0, 500);
}
private String getDebugText() {
StringBuilder sb = new StringBuilder();
try {
sb.append("player1: ").append(getPlayStateText(player1)).append("|").append(player1.isPlaying()).append("\n");
sb.append("player2: ").append(getPlayStateText(player2)).append("|").append(player2.isPlaying()).append("\n");
sb.append("卡顿计数器:").append(playBufferIndex).append("\n");
sb.append("强制播放计时器:").append(index).append("\n");
} catch (Exception e) {
e.printStackTrace();
EasyFloat.dismiss("debug");
debugTask.cancel();
}
return sb.toString();
}
private void updateDebug() {
handler.post(new Runnable() {
@Override
public void run() {
debugText.setText(getDebugText());
}
});
}
private String getPlayStateText(ExoPlayer player) {
switch (player.getPlaybackState()) {
case Player.STATE_READY:
return "STATE_READY";
case Player.STATE_BUFFERING:
return "STATE_BUFFERING";
case Player.STATE_ENDED:
return "STATE_ENDED";
case Player.STATE_IDLE:
return "STATE_IDLE";
default:
return player.getPlaybackState() + "";
}
} }
@ -171,6 +283,7 @@ public class LiveExoPlayerManager {
if (listener != null) { if (listener != null) {
listener.onIsPlayingChanged(true); listener.onIsPlayingChanged(true);
} }
createTask();
} }
} }
@ -245,6 +358,7 @@ public class LiveExoPlayerManager {
if (listener != null) { if (listener != null) {
listener.onIsPlayingChanged(true); listener.onIsPlayingChanged(true);
} }
createTask();
} }
} }
@ -280,6 +394,11 @@ public class LiveExoPlayerManager {
*/ */
public void startUrl(String url) { public void startUrl(String url) {
if (url != null && url.equals(this.url)) return; if (url != null && url.equals(this.url)) return;
if (task != null) {
task.cancel();
task = null;
}
Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode()); Log.i(TAG, "startUrl: " + url + " > " + mainView.getResizeMode());
handler.removeCallbacks(buffRunnable); handler.removeCallbacks(buffRunnable);
this.url = url; this.url = url;
@ -303,6 +422,10 @@ public class LiveExoPlayerManager {
*/ */
public void switchUrl(String url) { public void switchUrl(String url) {
if (url != null && url.equals(this.url)) return; if (url != null && url.equals(this.url)) return;
if (task != null) {
task.cancel();
task = null;
}
Log.i(TAG, "switchUrl: " + url + " src : " + this.url); Log.i(TAG, "switchUrl: " + url + " src : " + this.url);
this.url = url; this.url = url;
playBufferIndex = 0; playBufferIndex = 0;
@ -369,6 +492,14 @@ public class LiveExoPlayerManager {
if (getNextPlayer() != null) { if (getNextPlayer() != null) {
getNextPlayer().stop(); getNextPlayer().stop();
} }
if (listener != null) {
listener.onPlaybackStateChanged(Player.STATE_IDLE);
}
handler.removeCallbacks(buffRunnable);
if (task != null) {
task.cancel();
task = null;
}
String tmp = url; String tmp = url;
url = null; url = null;
startUrl(tmp); startUrl(tmp);
@ -394,6 +525,13 @@ public class LiveExoPlayerManager {
player2.clearVideoSurface(); player2.clearVideoSurface();
player2.release(); player2.release();
} }
if (task != null) {
task.cancel();
task = null;
}
if (debugTask != null) {
debugTask.cancel();
}
player1 = null; player1 = null;
player2 = null; player2 = null;
mainView.setKeepContentOnPlayerReset(false); mainView.setKeepContentOnPlayerReset(false);

View File

@ -218,7 +218,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
if (mTime != null) { if (mTime != null) {
Log.i("vvvs", content); Log.i("vvvs", content);
if (content.trim().equals("00:00")) { if (content.trim().equals("00:00")) {
mTime.setText("結算中"); mTime.setText(WordUtil.isNewZh()?"結算中":"waiting");
} else { } else {
mTime.setText(content); mTime.setText(content);
} }

View File

@ -1287,6 +1287,7 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder {
Player.Listener.super.onIsPlayingChanged(isPlaying); Player.Listener.super.onIsPlayingChanged(isPlaying);
if (isPlaying) { if (isPlaying) {
hideCover(); hideCover();
mLoading.setVisibility(View.INVISIBLE);
Log.i(TAG, "onIsPlayingChanged: 开始播放 | waitNextUrl = " + waitNextUrl); Log.i(TAG, "onIsPlayingChanged: 开始播放 | waitNextUrl = " + waitNextUrl);
OkDownload.getInstance().startAll(); OkDownload.getInstance().startAll();
if (loadingListener != null) { if (loadingListener != null) {

View File

@ -495,7 +495,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
btn_close.setOnClickListener(new View.OnClickListener() { btn_close.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { DialogUitl.showSimpleDialog(mContext,WordUtil.isNewZh()? "是否要斷開連麥?":"Do you want to disconnect Link?", new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag()); aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag());

View File

@ -36,6 +36,7 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.common.http.LiveHttpConsts; import com.yunbao.common.http.LiveHttpConsts;
@ -103,7 +104,7 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi
btn_close.setOnClickListener(new View.OnClickListener() { btn_close.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { DialogUitl.showSimpleDialog(mContext, WordUtil.isNewZh()?"是否要斷開連麥?":"Do you want to disconnect Link?", new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
//断开连麦 //断开连麦

View File

@ -681,7 +681,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
} }
} }
AppManager.runDebugCode(() -> { AppManager.runDebugCode(() -> {
liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000); // liveHandler.postDelayed(loadTimeoutRunnableGone, 1_000);
}); });
liveHandler.postDelayed(loadTimeoutRunnableGone, 15_000); liveHandler.postDelayed(loadTimeoutRunnableGone, 15_000);
if (TextUtils.equals(data.getEnterRoomInfo().getIsconnection(), "1")) { if (TextUtils.equals(data.getEnterRoomInfo().getIsconnection(), "1")) {

View File

@ -48,15 +48,17 @@
<TextView <TextView
android:id="@+id/giftInfo" android:id="@+id/giftInfo"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="9dp" android:layout_marginTop="9dp"
android:layout_marginEnd="32dp"
android:text="@string/live_fans_group_buy_info"
android:textColor="#B3000000" android:textColor="#B3000000"
android:textSize="10sp" android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/giftName" app:layout_constraintTop_toBottomOf="@+id/giftName" />
android:text="@string/live_fans_group_buy_info" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/giftList" android:id="@+id/giftList"

View File

@ -29,7 +29,7 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:background="@drawable/bg_live_prank_gift_add" android:background="@drawable/bg_live_prank_gift_add"
android:gravity="center" android:gravity="center"
android:text="确定添加" android:text="@string/live_gift_dialog_select_add"
android:textColor="#FFF" android:textColor="#FFF"
android:textSize="10sp" android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

View File

@ -505,13 +505,15 @@
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_marginStart="2dp" android:layout_marginStart="7dp"
android:src="@mipmap/img_fans_default" android:src="@mipmap/img_fans_default"
android:visibility="invisible" /> android:visibility="invisible" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginStart="5dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView

View File

@ -190,7 +190,7 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:text="結束連麥" android:text="@string/live_link_mic_3"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="13sp" android:textSize="13sp"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -135,7 +135,7 @@
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingRight="8dp" android:paddingRight="8dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:text="結束連麥" android:text="@string/live_link_mic_3"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="13sp" android:textSize="13sp"
android:visibility="gone" /> android:visibility="gone" />

View File

@ -19,7 +19,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="25dp" android:layout_marginTop="25dp"
android:text="沒有找到匹配結果~" android:text="@string/live_free_pk_empty_tips"
android:textColor="#C4C4C4" android:textColor="#C4C4C4"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -244,7 +244,7 @@ public class MainStartDialogFragment extends AbsDialogFragment implements View.O
LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback); LiveHttpUtil.getLiveSdk(mGetLiveSdkCallback);
}); });
} else { } else {
String tips="需要下载开播插件,是否下载"; String tips="需要下載開播插件,是否下載";
if(!WordUtil.isNewZh()){ if(!WordUtil.isNewZh()){
tips="You need to download the plug-in, whether to download"; tips="You need to download the plug-in, whether to download";
} }