Skip to content

Commit

Permalink
feat(android): add setFastStart api
Browse files Browse the repository at this point in the history
  • Loading branch information
I-m-SuperMan authored and pingkai committed Jun 2, 2020
1 parent c8f9a73 commit f2d85e9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1386,4 +1386,7 @@ public static enum IPResolveType {
* @param type 见 {@link IPResolveType}
*/
abstract public void setIPResolveType(IPResolveType type);


abstract public void setFastStart(boolean open);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,11 @@ public void setVideoBackgroundColor(int color) {
public void setIPResolveType(IPResolveType type) {
mCorePlayer.setIPResolveType(type);
}

@Override
public void setFastStart(boolean open) {
mCorePlayer.setFastStart(open);
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ public void setIPResolveType(CicadaPlayer.IPResolveType type) {
nSetIPResolveType(type.ordinal());
}

public void setFastStart(boolean open) {
nSetFastStart(open);
}

public synchronized void setDefaultBandWidth(int bandWidth) {
nSetDefaultBandWidth(bandWidth);
}
Expand Down Expand Up @@ -562,6 +566,8 @@ public static void setBlackType(int type) {

protected native void nSetIPResolveType(int type);

protected native void nSetFastStart(boolean open);

//////==========--------------==================------------------================//

private CicadaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangedListener = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,16 @@ void NativeBase::java_SetIPResolveType(JNIEnv *env, jobject instance, jint type)
}
}

void NativeBase::java_SetFastStart(JNIEnv *env, jobject instance, jboolean open)
{
AF_TRACE;
MediaPlayer *player = getPlayer(env, instance);

if (player != nullptr) {
player->SetFastStart((bool) open);
}
}

jstring NativeBase::java_GetCacheFilePathByURL(JNIEnv *env, jobject instance, jstring URL)
{
AF_TRACE;
Expand Down Expand Up @@ -977,6 +987,7 @@ static JNINativeMethod nativePlayer_method_table[] = {
{"nGetSdkVersion", "()Ljava/lang/String;", (void *) NativeBase::java_GetSdkVersion},
{"nSetBlackType", "(I)V", (void *) NativeBase::java_SetBlackType},
{"nSetIPResolveType", "(I)V", (void *) NativeBase::java_SetIPResolveType},
{"nSetFastStart", "(Z)V", (void *) NativeBase::java_SetFastStart},
{"nGetCacheFilePath", "(Ljava/lang/String;)Ljava/lang/String;", (void *) NativeBase::java_GetCacheFilePathByURL},
{"nSetDefaultBandWidth", "(I)V", (void *) NativeBase::java_SetDefaultBandWidth},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class NativeBase {

static void java_SetIPResolveType(JNIEnv *env, jobject jobj, jint type);

static void java_SetFastStart(JNIEnv *env, jobject instance, jboolean open);

static jstring java_GetCacheFilePathByURL(JNIEnv *env, jobject instance, jstring URL);

static void java_SetDefaultBandWidth(JNIEnv *env , jobject instance , jint defaultBandWidth);
Expand Down

0 comments on commit f2d85e9

Please sign in to comment.