Skip to content

Commit

Permalink
feat(mediaplayer): add liveStartIndex config
Browse files Browse the repository at this point in the history
  • Loading branch information
I-m-SuperMan authored and pingkai committed Jun 30, 2020
1 parent 0a7516b commit 431495e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ private PlayerConfig() {
* The maximum network reconnection attempts. networkTimeout specifies the reconnection interval. networkRetryCount=0 indicates that automatic reconnection is disabled. The reconnection policy depends on the app. Default: 2.
*/
public int mNetworkRetryCount = 2;
/**
* HLS直播时,起播分片位置。
*/
/****
* The start playing index of fragments, when HLS is live, .
*/
public int mLiveStartIndex = -3;

private String[] mCustomHeaders = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jfieldID gj_playerconfig_ClearFrameWhenStop = nullptr;
jfieldID gj_playerconfig_EnableTunnelRender = nullptr;
jfieldID gj_playerconfig_UserAgent = nullptr;
jfieldID gj_playerconfig_NetworkRetryCount = nullptr;
jfieldID gj_playerconfig_LiveStartIndex = nullptr;


void JavaPlayerConfig::init(JNIEnv *env)
Expand Down Expand Up @@ -84,6 +85,9 @@ void JavaPlayerConfig::init(JNIEnv *env)
gj_playerconfig_NetworkRetryCount = env->GetFieldID(gj_PlayerConfig_class,
"mNetworkRetryCount",
"I");
gj_playerconfig_LiveStartIndex = env->GetFieldID(gj_PlayerConfig_class,
"mLiveStartIndex",
"I");
}
}

Expand Down Expand Up @@ -117,6 +121,8 @@ jobject JavaPlayerConfig::getJPlayerConfig(JNIEnv *mEnv, const MediaPlayerConfig
(jboolean) (playerConfig->bEnableTunnelRender));
mEnv->SetIntField(jPlayerConfig, gj_playerconfig_NetworkRetryCount,
playerConfig->networkRetryCount);
mEnv->SetIntField(jPlayerConfig, gj_playerconfig_LiveStartIndex,
playerConfig->liveStartIndex);
NewStringUTF tmpreferrer(mEnv, playerConfig->referer.c_str());
jstring referrer = tmpreferrer.getString();
mEnv->SetObjectField(jPlayerConfig, gj_playerconfig_Referrer, referrer);
Expand Down Expand Up @@ -179,6 +185,8 @@ MediaPlayerConfig JavaPlayerConfig::convertTo(JNIEnv *env, jobject playerConfig)
gj_playerconfig_EnableTunnelRender);
jint networkRetryCount = env->GetIntField(playerConfig,
gj_playerconfig_NetworkRetryCount);
jint liveStartIndex = env->GetIntField(playerConfig,
gj_playerconfig_LiveStartIndex);
GetStringUTFChars tmpHttpProxy(env, httpProxyStr);
char *httpProxy = tmpHttpProxy.getChars();
GetStringUTFChars tmpreferrer(env, referrerStr);
Expand All @@ -196,6 +204,7 @@ MediaPlayerConfig JavaPlayerConfig::convertTo(JNIEnv *env, jobject playerConfig)
config.bClearShowWhenStop = clearFrameWhenStop;
config.bEnableTunnelRender = enableTunnelRender;
config.networkRetryCount = networkRetryCount;
config.liveStartIndex = liveStartIndex;
CallObjectMethod getHeaderMethod(env, playerConfig, gj_playerconfig_getCustomHeaders);
jobjectArray headersArray = (jobjectArray) getHeaderMethod.getValue();

Expand Down

0 comments on commit 431495e

Please sign in to comment.