Skip to content

Commit

Permalink
feat(android): add setVideoBackground 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 400049c commit d84fa99
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1350,4 +1350,16 @@ public interface OnVideoRenderedListener{
}

abstract public void setOnVideoRenderedListener(OnVideoRenderedListener l);

/**
* 设置视频的背景色
*
* @param color ARGB
*
*/
/****
* Set video background color
* @param color ARGB
*/
abstract public void setVideoBackgroundColor(int color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,11 @@ public void setOnVideoRenderedListener(OnVideoRenderedListener listener){
}
}

@Override
public void setVideoBackgroundColor(int color) {
mCorePlayer.setVideoBackgroundColor(color);
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ public CicadaPlayer.ScaleMode getScaleMode() {
}
}

public void setVideoBackgroundColor(int color) {
nSetVideoBackgroundColor(color);
}

public void setRotateMode(CicadaPlayer.RotateMode rotateMode) {
int rotateValue = rotateMode.getValue();
Expand Down Expand Up @@ -501,6 +504,8 @@ public static void setBlackType(int type) {

protected native void nReload();

protected native void nSetVideoBackgroundColor(int color);

protected native void nSetScaleMode(int mode);

protected native int nGetScaleMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,17 @@ void NativeBase::java_SetDefaultBandWidth(JNIEnv *env, jobject instance, jint de
}
}

void NativeBase::java_SetVideoBackgroundColor(JNIEnv *env, jobject instance, jint color)
{
MediaPlayer *player = getPlayer(env, instance);

if (player == nullptr) {
return ;
}

return player->SetVideoBackgroundColor((uint32_t) color);
}

//callback...

void NativeBase::init(JNIEnv *env)
Expand Down Expand Up @@ -920,9 +931,10 @@ static JNINativeMethod nativePlayer_method_table[] = {
{"nSetVolume", "(F)V", (void *) NativeBase::java_SetVolume},
{"nGetVolume", "()F", (void *) NativeBase::java_GetVolume},
{"nSeekTo", "(JI)V", (void *) NativeBase::java_SeekTo},
{"nSetMaxAccurateSeekDelta", "(I)V", (void *) NativeBase::java_SetMaxAccurateSeekDelta},
{"nSetMaxAccurateSeekDelta", "(I)V", (void *) NativeBase::java_SetMaxAccurateSeekDelta},
{"nStop", "()V", (void *) NativeBase::java_Stop},
{"nRelease", "()V", (void *) NativeBase::java_Release},
{"nSetVideoBackgroundColor","(I)V", (void *) NativeBase::java_SetVideoBackgroundColor},
{"nGetDuration", "()J", (void *) NativeBase::java_GetDuration},
{"nGetCurrentStreamInfo", "(I)Ljava/lang/Object;", (void *) NativeBase::java_GetCurrentStreamInfo},
{"nGetCurrentPosition", "()J", (void *) NativeBase::java_GetCurrentPosition},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class NativeBase {

static void java_SetLoop(JNIEnv *env, jobject instance, jboolean on);

static void java_SetVideoBackgroundColor(JNIEnv *env, jobject instance, jint color);

static jboolean java_IsLoop(JNIEnv *env, jobject instance);

static jint java_GetVideoWidth(JNIEnv *env, jobject instance);
Expand Down

0 comments on commit d84fa99

Please sign in to comment.