/
/
setVVCollector():设置VVCollector,收集播放器的VV统计信息。
/
/
video view (VV),意思为视频播放次数,根据广告播放次数,统计盈利。
public void setVVCollector(com.iqiyi.video.qyplayersdk.module.a.f.con conVar) {
com.iqiyi.video.qyplayersdk.module.a.aux auxVar
=
this.mStatistics;
if
(auxVar !
=
null) {
auxVar.setVVCollector(conVar);
}
}
/
/
init(): 初始化播放器界面
/
/
获取了mControlConfig中的一些配置信息,例如编解码类型、是否自动跳过片头片尾、色盲模式等,然后调用prn.aux构造方法创建一个prn对象,并设置这些配置信息,最后通过a()方法将prn对象和mPassportAdapter对象一起传入a方法中,完成播放器的初始化。
public void init() {
this.mPlayerCore.a(new prn.aux(this.mControlConfig.getCodecType())
.eH(this.mControlConfig.isAutoSkipTitle())
.eI(this.mControlConfig.isAutoSkipTrailer())
.kR(this.mControlConfig.getColorBlindnessType())
.lX(this.mControlConfig.getExtendInfo())
.lY(this.mControlConfig.getExtraDecoderInfo())
.aie(), com.iqiyi.video.qyplayersdk.core.data.aux.a(this.mPassportAdapter));
}
/
/
检查 RC 策略是否需要执行
/
/
RC 策略是指在不同的地理位置或网络环境下,根据不同的版权限制或合作协议,播放不同的内容或提供不同的服务。
public PlayData checkRcIfRcStrategyNeeded(PlayData playData) {
if
(playData
=
=
null) {
com.iqiyi.video.qyplayersdk.g.aux.d(TAG,
"QYMediaPlayerProxy checkRcIfRcStrategyNeeded source == null!"
);
return
playData;
}
int
rCCheckPolicy
=
playData.getRCCheckPolicy();
com.iqiyi.video.qyplayersdk.g.aux.d(TAG,
"QYMediaPlayerProxy checkRcIfRcStrategyNeeded strategy == "
+
rCCheckPolicy);
if
(this.mPlayerRecordAdapter
=
=
null) {
this.mPlayerRecordAdapter
=
new PlayerRecordAdapter();
}
/
/
根据 RCCheckPolicy (即 RC 策略) 的值。
/
/
如果值为
2
,直接返回 playData;如果值为
1
或
0
,,则调用 PlayerRecordAdapter 的 retrievePlayerRecord 方法,获取播放记录,
return
rCCheckPolicy
=
=
2
? playData : (rCCheckPolicy
=
=
1
|| rCCheckPolicy
=
=
0
) ?
com.iqiyi.video.qyplayersdk.player.data.b.con.a(playData, this.mPlayerRecordAdapter.retrievePlayerRecord(playData)) : playData;
}
/
/
获取登录用户信息
void login() {
IPassportAdapter iPassportAdapter;
/
/
mPlayerCore 是播放器核心,mPassportAdapter 是用户身份验证适配器。
if
(this.mPlayerCore
=
=
null || (iPassportAdapter
=
this.mPassportAdapter)
=
=
null) {
return
;
}
/
/
判断是不是VIP用户,并获取相应用户信息
this.mPlayerCore.login(com.iqiyi.video.qyplayersdk.core.data.aux.a(iPassportAdapter));
}
/
/
准备播放器重要核心配置
private void prepareBigCorePlayback(PlayData playData) {
boolean z;
org.qiyi.android.coreplayer.d.com7.beginSection(
"QYMediaPlayerProxy.prepareBigCorePlayback"
);
/
/
检查是否需要预加载
com.iqiyi.video.qyplayersdk.h.con conVar
=
this.mPreload;
if
(conVar !
=
null) {
conVar.aoj();
}
/
/
根据播放数据和控制配置,选择一个播放策略,根据策略选择对应操作
int
a2
=
com.iqiyi.video.qyplayersdk.player.data.b.nul.a(playData, this.mContext, this.mControlConfig);
com.iqiyi.video.qyplayersdk.g.aux.e(
"PLAY_SDK"
,
"vplay strategy : "
+
a2);
switch (a2) {
case
1
:
performBigCorePlayback(playData);
break
;
case
2
:
z
=
true;
doVPlayBeforePlay(playData, z);
break
;
case
3
:
doVPlayFullBeforePlay(playData);
break
;
case
4
:
doVPlayAfterPlay(playData);
break
;
case
5
:
if
(com.iqiyi.video.qyplayersdk.g.aux.isDebug()) {
throw new RuntimeException(
"address & tvid & ctype are null"
);
}
com.iqiyi.video.qyplayersdk.g.aux.e(
"PLAY_SDK"
,
"address & tvid & ctype are null"
);
break
;
case
6
:
z
=
false;
doVPlayBeforePlay(playData, z);
break
;
}
org.qiyi.android.coreplayer.d.com7.endSection();
}
/
/
视频播放结束后,继续获取视频的相关信息。
public void doVPlayAfterPlay(final PlayData playData) {
performBigCorePlayback(playData);
lpt6 lpt6Var
=
this.mTaskExecutor;
if
(lpt6Var !
=
null) {
lpt6Var.q(new Runnable() {
/
/
from
class
: com.iqiyi.video.qyplayersdk.player.QYMediaPlayerProxy.
1
@Override
/
/
java.lang.Runnable
public void run() {
QYMediaPlayerProxy.this.requestVplayInfo(playData);
}
});
}
}
/
/
在获取视频源前获取一些与视频相关的信息
private void doVPlayBeforePlay(PlayData playData, boolean z) {
VPlayParam a2
=
com.iqiyi.video.qyplayersdk.player.data.b.con.a(playData, VPlayHelper.CONTENT_TYPE_PLAY_CONDITION, this.mPassportAdapter);
this.mVPlayHelper.cancel();
/
/
请求 VPlay 信息
this.mVPlayHelper.requestVPlay(this.mContext, a2, new aux(this, playData, this.mSigt, z), this.mBigcoreVplayInterceptor);
sendVPlayRequestPingback(true, playData, this.mSigt);
com.iqiyi.video.qyplayersdk.b.com3.b(playData);
com.iqiyi.video.qyplayersdk.g.aux.d(
"PLAY_SDK"
, TAG,
" doVPlayBeforePlay needRequestFull="
, Boolean.valueOf(z));
}
/
/
判断是否需要网络拦截
private boolean isNeedNetworkInterceptor(PlayerInfo playerInfo) {
/
/
是否需要忽略用户代理的拦截
if
(ignoreNetworkInterceptByUA()) {
com.iqiyi.video.qyplayersdk.g.aux.d(
"PLAY_SDK"
, TAG,
"ignoreNetworkInterceptByUA "
);
return
false;
}
/
/
判断当前是否处于离线状态,并且要播放的视频是在线视频
boolean gW
=
org.iqiyi.video.l.aux.gW(this.mContext);
boolean D
=
com.iqiyi.video.qyplayersdk.player.data.b.nul.D(playerInfo);
if
(gW && D) {
/
/
获取当前的错误码版本号,根据不同的版本号来执行不同的逻辑
int
errorCodeVersion
=
getErrorCodeVersion();
com.iqiyi.video.qyplayersdk.g.aux.d(
"PLAY_SDK"
, TAG,
"isNeedNetworkInterceptor isOffNetWork = "
, Boolean.valueOf(gW),
" isOnLineVideo = "
, Boolean.valueOf(D),
" errorCodeVer = "
+
errorCodeVersion);
if
(errorCodeVersion
=
=
1
) {
/
/
自定义错误码为
900400
的播放器错误
this.mInvokerQYMediaPlayer.onError(PlayerError.createCustomError(
900400
,
"current network is offline, but you want to play online video"
));
return
true;
/
/
进行网络拦截
}
else
if
(errorCodeVersion
=
=
2
) {
/
/
返回错误码和错误信息
org.iqiyi.video.data.com7 bbQ
=
org.iqiyi.video.data.com7.bbQ();
bbQ.xC(String.valueOf(
900400
));
bbQ.setDesc(
"current network is offline, but you want to play online video"
);
this.mInvokerQYMediaPlayer.onErrorV2(bbQ);
return
true;
}
}
return
false;
/
/
不需要进行网络拦截
}