Skip to content

Commit

Permalink
feat(android): add setIpResolveType 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 d84fa99 commit c8f9a73
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1362,4 +1362,28 @@ public interface OnVideoRenderedListener{
* @param color ARGB
*/
abstract public void setVideoBackgroundColor(int color);

/**
* IP 解析类型
*/
public static enum IPResolveType {
/**
* 任意类型
*/
IpResolveWhatEver,
/**
* 只使用ipV4
*/
IpResolveV4,
/**
* 只使用ipV6
*/
IpResolveV6
}

/**
* 设置网络ip解析类型
* @param type 见 {@link IPResolveType}
*/
abstract public void setIPResolveType(IPResolveType type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ public void setVideoBackgroundColor(int color) {
mCorePlayer.setVideoBackgroundColor(color);
}

@Override
public void setIPResolveType(IPResolveType type) {
mCorePlayer.setIPResolveType(type);
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ public void selectExtSubtitle(int index, boolean select){
nSelectExtSubtitle(index,select);
}

public void setIPResolveType(CicadaPlayer.IPResolveType type) {
nSetIPResolveType(type.ordinal());
}

public synchronized void setDefaultBandWidth(int bandWidth) {
nSetDefaultBandWidth(bandWidth);
}
Expand Down Expand Up @@ -556,6 +560,7 @@ public static void setBlackType(int type) {

protected static native void nSetBlackType(int type);

protected native void nSetIPResolveType(int type);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,15 @@ void NativeBase::java_SetBlackType(JNIEnv *env, jclass jclazz, jint type)
}
}

void NativeBase::java_SetIPResolveType(JNIEnv *env, jobject instance, jint type)
{
AF_TRACE;
MediaPlayer *player = getPlayer(env, instance);

if (player != nullptr) {
player->SetIPResolveType(static_cast<IpResolveType>((int)type));
}
}

jstring NativeBase::java_GetCacheFilePathByURL(JNIEnv *env, jobject instance, jstring URL)
{
Expand Down Expand Up @@ -967,6 +976,7 @@ static JNINativeMethod nativePlayer_method_table[] = {
{"nSnapShot", "()V", (void *) NativeBase::java_SnapShot},
{"nGetSdkVersion", "()Ljava/lang/String;", (void *) NativeBase::java_GetSdkVersion},
{"nSetBlackType", "(I)V", (void *) NativeBase::java_SetBlackType},
{"nSetIPResolveType", "(I)V", (void *) NativeBase::java_SetIPResolveType},
{"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 @@ -139,6 +139,8 @@ class NativeBase {

static void java_SetBlackType(JNIEnv *env, jclass jclazz, jint type);

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

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 c8f9a73

Please sign in to comment.