Files
daycard-app/mediaplayertv/src/main/java/com/pukka/videoplayertv/ConfigPlayer.java

67 lines
2.0 KiB
Java
Raw Normal View History

package com.pukka.videoplayertv;
import com.pukka.libcore.boxShared.BoxSharedParamsUtils;
import com.pukka.libcore.utils.LogUtils;
import com.pukka.libcore.utils.StringUtils;
/**
* Author: wxf
* Date: 2023/8/11 13:44
* Description:盒子播放器没有第一帧回调(info=3)的兼容处理
*/
public class ConfigPlayer {
private static ConfigPlayer configPlayer;
public static ConfigPlayer getInstance() {
if (configPlayer == null) {
synchronized (ConfigPlayer.class) {
if (configPlayer == null) {
configPlayer = new ConfigPlayer();
}
}
}
return configPlayer;
}
//适配的渠道名单 : 青海
public String[] channelIds = {"400500000010315","400500000010321","400500000010319" };
//适配的盒子型号
public String[] models = {"b860av2.1" };
//当前渠道号
//private String channelId = BoxSharedParameters.getInstance().getChannelId();
private String channelId;
//当前的盒子型号
private String model = BoxSharedParamsUtils.getInstance().getModel();
/**
* 判断是否兼容盒子未返回第一帧(info=3)
* @return true 兼容;false 不兼容
**/
public boolean isNeedStartFirstFrame() {
boolean isNeed = false;
if (!StringUtils.isEmpty(channelId) && !StringUtils.isEmpty(model)) {
boolean isHaveChannel = false;
for (int i=0;i<channelIds.length;i++){
if(channelIds[i].equals(channelId)){
isHaveChannel = true;
}
}
boolean isHaveModel = false;
for (int j=0;j<models.length;j++){
if(model.toLowerCase().contains(models[j])){
isHaveModel = true;
}
}
if (isHaveChannel && isHaveModel){
isNeed = true;
}
}
LogUtils.d("channelId:"+channelId+" model:"+model);
LogUtils.d("isNeed:"+isNeed);
return isNeed;
}
}