-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] add TCEffectPlayer and TEBeautyKit
- Loading branch information
1 parent
1d0c9da
commit c5030e7
Showing
683 changed files
with
112,212 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
plugins { | ||
id 'com.android.library' | ||
} | ||
|
||
android { | ||
compileSdk 34 | ||
namespace 'com.tencent.tcmediax.tceffectplayerkit' | ||
|
||
defaultConfig { | ||
minSdkVersion 19 | ||
versionName "1.0" | ||
versionCode 1 | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
api 'com.tencent.mediacloud:TCMediaX:2.1.0.112' | ||
implementation 'com.tencent.mediacloud:TCEffectPlayer:2.1.0.112' | ||
implementation "com.tencent.liteav.tuikit:tuicore:latest.release" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application> | ||
<provider | ||
android:name="com.tencent.tcmediax.tceffectplayerkit.core.TUIEffectPlayerProvider" | ||
android:authorities="${applicationId}.TUIEffectPlayerProvider" | ||
android:enabled="true" | ||
android:exported="false" /> | ||
</application> | ||
|
||
</manifest> |
16 changes: 16 additions & 0 deletions
16
...oid/tceffectplayerkit/src/main/java/com/tencent/tcmediax/tceffectplayerkit/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.tencent.tcmediax.tceffectplayerkit; | ||
|
||
public interface Constants { | ||
String KEY_EXTENSION_NAME = "TUIEffectPlayerExtension"; | ||
String KEY_SERVICE_NAME = "TUIEffectPlayerService"; | ||
String KEY_GET_VIEW = "TCEffectAnimView"; | ||
String KEY_METHOD_SET_LICENSE = "setLicense"; | ||
String KEY_METHOD_START_PLAY = "startPlay"; | ||
String KEY_METHOD_STOP_PLAY = "stopPlay"; | ||
String KEY_PARAM_PLAY_URL = "playUrl"; | ||
String KEY_PARAM_CONTEXT = "context"; | ||
String KEY_PARAM_VIEW = "view"; | ||
String KEY_PARAM_CLEAR_LAST_FRAME = "clearLastFrame"; | ||
String KEY_PARAM_LICENSE_URL = "licenseUrl"; | ||
String KEY_PARAM_LICENSE_KEY = "licenseKey"; | ||
} |
34 changes: 34 additions & 0 deletions
34
...t/src/main/java/com/tencent/tcmediax/tceffectplayerkit/core/TUIEffectPlayerExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.tencent.tcmediax.tceffectplayerkit.core; | ||
|
||
import android.content.Context; | ||
|
||
import com.tencent.qcloud.tuicore.interfaces.ITUIExtension; | ||
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionInfo; | ||
import com.tencent.tcmediax.tceffectplayerkit.Constants; | ||
import com.tencent.tcmediax.tceffectplayer.api.TCEffectAnimView; | ||
import com.tencent.tcmediax.tceffectplayer.api.TCEffectPlayerConstant; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class TUIEffectPlayerExtension implements ITUIExtension { | ||
|
||
@Override | ||
public List<TUIExtensionInfo> onGetExtension(String extensionID, Map<String, Object> param) { | ||
HashMap<String, Object> hashMap = new HashMap<>(); | ||
if (param != null && Constants.KEY_EXTENSION_NAME.equals(extensionID)) { | ||
Context context = (Context) param.get(Constants.KEY_PARAM_CONTEXT); | ||
if (param.containsKey(Constants.KEY_GET_VIEW)) { | ||
TCEffectAnimView animView = new TCEffectAnimView(context); | ||
animView.setScaleType(TCEffectPlayerConstant.ScaleType.FIT_XY); | ||
hashMap.put(Constants.KEY_GET_VIEW, animView); | ||
TUIExtensionInfo info = new TUIExtensionInfo(); | ||
info.setData(hashMap); | ||
return Collections.singletonList(info); | ||
} | ||
} | ||
return null; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...it/src/main/java/com/tencent/tcmediax/tceffectplayerkit/core/TUIEffectPlayerProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.tencent.tcmediax.tceffectplayerkit.core; | ||
|
||
import android.content.ContentProvider; | ||
import android.content.ContentValues; | ||
import android.database.Cursor; | ||
import android.net.Uri; | ||
import android.util.Log; | ||
|
||
import com.tencent.qcloud.tuicore.TUICore; | ||
import com.tencent.tcmediax.tceffectplayerkit.Constants; | ||
|
||
public final class TUIEffectPlayerProvider extends ContentProvider { | ||
private static final String TAG = "TUIEffectPlayerProvider"; | ||
|
||
@Override | ||
public boolean onCreate() { | ||
Log.d(TAG, "TUIEffectPlayerProvider onCreate"); | ||
TUICore.registerExtension(Constants.KEY_EXTENSION_NAME, new TUIEffectPlayerExtension()); | ||
TUICore.registerService(Constants.KEY_SERVICE_NAME, new TUIEffectPlayerService()); | ||
return false; | ||
} | ||
|
||
@Override | ||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { | ||
return null; | ||
} | ||
|
||
|
||
@Override | ||
public String getType(Uri uri) { | ||
return null; | ||
} | ||
|
||
|
||
@Override | ||
public Uri insert(Uri uri, ContentValues values) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int delete(Uri uri, String selection, String[] selectionArgs) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { | ||
return 0; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
...kit/src/main/java/com/tencent/tcmediax/tceffectplayerkit/core/TUIEffectPlayerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.tencent.tcmediax.tceffectplayerkit.core; | ||
|
||
import android.content.Context; | ||
import android.text.TextUtils; | ||
|
||
import com.tencent.qcloud.tuicore.interfaces.ITUIService; | ||
import com.tencent.qcloud.tuicore.interfaces.TUIServiceCallback; | ||
import com.tencent.tcmediax.api.TCMediaXBase; | ||
import com.tencent.tcmediax.tceffectplayerkit.Constants; | ||
import com.tencent.tcmediax.tceffectplayer.api.TCEffectAnimView; | ||
|
||
import java.util.Map; | ||
|
||
public class TUIEffectPlayerService implements ITUIService { | ||
|
||
@Override | ||
public Object onCall(String method, Map<String, Object> param, TUIServiceCallback callback) { | ||
if (param != null && TextUtils.equals(Constants.KEY_METHOD_START_PLAY, method)) { | ||
String url = (String) param.get(Constants.KEY_PARAM_PLAY_URL); | ||
Object view = param.get(Constants.KEY_PARAM_VIEW); | ||
if (view instanceof TCEffectAnimView) { | ||
TCEffectAnimView animView = (TCEffectAnimView) view; | ||
animView.setPlayListener(new AnimPlayListener(callback)); | ||
animView.startPlay(url); | ||
} | ||
} else if (param != null && TextUtils.equals(Constants.KEY_METHOD_STOP_PLAY, method)) { | ||
Object view = param.get(Constants.KEY_PARAM_VIEW); | ||
Boolean clearLastFrame = (Boolean) param.get(Constants.KEY_PARAM_CLEAR_LAST_FRAME); | ||
if (view instanceof TCEffectAnimView) { | ||
TCEffectAnimView animView = (TCEffectAnimView) view; | ||
animView.setPlayListener(null); | ||
animView.stopPlay(Boolean.TRUE.equals(clearLastFrame)); | ||
} | ||
} else if (param != null && TextUtils.equals(Constants.KEY_METHOD_SET_LICENSE, method)) { | ||
String url = (String) param.get(Constants.KEY_PARAM_LICENSE_URL); | ||
String key = (String) param.get(Constants.KEY_PARAM_LICENSE_KEY); | ||
Context context = (Context) param.get(Constants.KEY_PARAM_CONTEXT); | ||
TCMediaXBase.getInstance().setLicense(context, url, key, (i, s) -> { | ||
if (callback != null) { | ||
callback.onServiceCallback(i, s, null); | ||
} | ||
}); | ||
} | ||
return null; | ||
} | ||
|
||
private static final class AnimPlayListener implements TCEffectAnimView.IAnimPlayListener { | ||
|
||
private final TUIServiceCallback mCallback; | ||
|
||
public AnimPlayListener(TUIServiceCallback callback) { | ||
mCallback = callback; | ||
} | ||
|
||
@Override | ||
public void onPlayStart() { | ||
|
||
} | ||
|
||
@Override | ||
public void onPlayEnd() { | ||
if (mCallback != null) { | ||
mCallback.onServiceCallback(0, "", null); | ||
} | ||
} | ||
|
||
@Override | ||
public void onPlayError(int i) { | ||
if (mCallback != null) { | ||
mCallback.onServiceCallback(i, "", null); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdk 31 | ||
namespace "com.tencent.effect.beautykit" | ||
|
||
defaultConfig { | ||
minSdkVersion 19 | ||
|
||
consumerProguardFiles "consumer-rules.pro" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
debug { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'com.google.code.gson:gson:2.8.9' | ||
implementation 'com.squareup.okhttp3:okhttp:3.9.0' | ||
|
||
implementation 'com.github.bumptech.glide:glide:4.12.0' | ||
implementation 'com.github.bumptech.glide:gifdecoder:4.12.0' | ||
implementation 'com.github.bumptech.glide:disklrucache:4.12.0' | ||
|
||
implementation 'androidx.appcompat:appcompat:1.0.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' | ||
implementation 'androidx.recyclerview:recyclerview:1.2.1' | ||
|
||
implementation 'com.tencent.mediacloud:TencentEffect_S1-07:latest.release' | ||
|
||
implementation "com.tencent.liteav.tuikit:tuicore:latest.release" | ||
|
||
|
||
} | ||
|
||
gradle.projectsEvaluated { | ||
tasks.withType(JavaCompile) { | ||
options.compilerArgs << "-parameters" | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.tencent.effect.beautykit"> | ||
<application> | ||
|
||
<provider | ||
android:name=".tuiextension.TEBeautyProvider" | ||
android:authorities="${applicationId}.TUIBeautyProvider" | ||
android:enabled="true" | ||
android:exported="false" /> | ||
</application> | ||
</manifest> |
Binary file added
BIN
+281 KB
Android/tebeautykit/src/main/assets/MotionRes/2dMotionRes/video_boys/4pic.pag
Binary file not shown.
Binary file added
BIN
+2.81 KB
Android/tebeautykit/src/main/assets/MotionRes/2dMotionRes/video_boys/9pic.pag
Binary file not shown.
Binary file added
BIN
+114 KB
Android/tebeautykit/src/main/assets/MotionRes/2dMotionRes/video_boys/B.pag
Binary file not shown.
Binary file added
BIN
+2.64 KB
Android/tebeautykit/src/main/assets/MotionRes/2dMotionRes/video_boys/CustomGraph.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
Android/tebeautykit/src/main/assets/MotionRes/2dMotionRes/video_boys/DeviceCameraTexture.tex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "TextureData", | ||
"key": "DeviceCameraTexture" | ||
} |
1 change: 1 addition & 0 deletions
1
Android/tebeautykit/src/main/assets/MotionRes/2dMotionRes/video_boys/RenderTarget.rdt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"type":"RenderTarget","path":"RenderTarget.rdt","key":"RenderTarget","input":"DeviceCameraTexture"} |
Oops, something went wrong.