Skip to content

Commit

Permalink
[Android] add TCEffectPlayer and TEBeautyKit
Browse files Browse the repository at this point in the history
  • Loading branch information
lanqiiliu authored and AbySwifter committed Aug 2, 2024
1 parent 1d0c9da commit c5030e7
Show file tree
Hide file tree
Showing 683 changed files with 112,212 additions and 101 deletions.
9 changes: 8 additions & 1 deletion Android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2.2.0
### New Features
- Android&iOS: UI overall interaction upgrade
- Android&iOS: Added new start page function settings (music, sound effects, settings)
- Android&iOS: Updated interaction of the function area at the bottom of the live page
- Android&iOS: Added microphone sound wave effects, microphone UI upgrade 5. Added microphone management list panel
- Android&iOS: Add plugins of beauty effects and gift effects
## 2.1.0
### New Features
- Android&iOS: Demo interactive upgrade.
Expand Down Expand Up @@ -25,4 +32,4 @@
- Android&iOS: Support audience microphone connection.
- Android&iOS: Support audience list.
- Android&iOS: Support bullet screen component.
- Android&iOS: Support gift components.
- Android&iOS: Support gift components.
5 changes: 4 additions & 1 deletion Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/app_ic_launcher"
android:label="@string/app_name"
android:resizeableActivity="true"
android:roundIcon="@drawable/app_ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
Expand All @@ -37,6 +38,8 @@
android:name=".view.login.ProfileActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity android:name=".view.main.StartLiveActivity" />
<activity
android:name=".view.main.StartLiveActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public class GenerateTestUserSig {
*/
private static final String SECRETKEY = "";

public static final String MAGIC_LICENSE_URL = "";

public static final String MAGIC_LICENSE_KEY = "";

public static final String TC_EFFECT_PLAYER_LICENSE_URL = "";

public static final String TC_EFFECT_PLAYER_LICENSE_KEY = "";


/**
* Calculating UserSig
Expand Down
1 change: 1 addition & 0 deletions Android/tceffectplayerkit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
31 changes: 31 additions & 0 deletions Android/tceffectplayerkit/build.gradle
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.
21 changes: 21 additions & 0 deletions Android/tceffectplayerkit/proguard-rules.pro
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
11 changes: 11 additions & 0 deletions Android/tceffectplayerkit/src/main/AndroidManifest.xml
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>
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";
}
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;
}
}
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;
}
}
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);
}
}
}
}
1 change: 1 addition & 0 deletions Android/tebeautykit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
48 changes: 48 additions & 0 deletions Android/tebeautykit/build.gradle
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.
21 changes: 21 additions & 0 deletions Android/tebeautykit/proguard-rules.pro
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
12 changes: 12 additions & 0 deletions Android/tebeautykit/src/main/AndroidManifest.xml
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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "TextureData",
"key": "DeviceCameraTexture"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"RenderTarget","path":"RenderTarget.rdt","key":"RenderTarget","input":"DeviceCameraTexture"}
Loading

0 comments on commit c5030e7

Please sign in to comment.