Skip to content

Commit

Permalink
Dev/1.0.7 (#26)
Browse files Browse the repository at this point in the history
* [Android]Fix fu lock crash, fix camera config init bug and etc.

* [Android]Add video config options for demo and fix sense time render bug switching to 2d from i420.

* [Android]Fix fu async texture render bug and add sync texture process for fu.

* [Android]Perfect rtc sdk gradle config.

* [Android]remove setBeautyPreset calling.

* [Android]move third party beauty sdk lib to cloud.

* [Android]change version to 1.0.6.

* [Android]enable fu texture async function default for some rtc version needed.

* [Android]remove unused error code and etc.

* remove default beauty

* update change log.

* add package_script

* [Android]fix fu texture sync bug.

* [Android]perfect beauty swithing effect and etc.

* [Android]perfect fu beauty demo ui and etc.

* update changelog.

* update script

* update pofile

* update pofile

* [Android]fix beauty effect bug.

* [Android]fix mirror bug of leaving the previous frame.

* [Android]add licence tip and show origin video when auth failed.

* update byte license

* [Android]update rtc version to 4.2.6.5 and etc.

* [Android]add APIReporter.

* add report func

* [Android]fix fu mirror bug and perfect demo.

* [Android]perfect demo.

* [Android]perfect fu config.

* [Android]close fu enableTextureAsync default.

* fix: build fail when remove fu

* fix: init fu beauty before setup sticker/animation/...

* fix: setup func name

* feat: add lic check and toast

* fix: license check

* fix: auth check fix

* Update README.

---------

Co-authored-by: zhaoyongqiang <[email protected]>
Co-authored-by: wushengtao <[email protected]>
  • Loading branch information
3 people authored May 14, 2024
1 parent d654ed1 commit 277a77d
Show file tree
Hide file tree
Showing 56 changed files with 1,736 additions and 270 deletions.
11 changes: 7 additions & 4 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ android {

defaultConfig {
applicationId "io.agora.test.entfull"
// applicationId "com.thankyo.hwgame"
minSdkVersion 21
targetSdkVersion 31
versionCode 6
versionName "1.0.6"
versionName "1.0.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -73,9 +74,11 @@ android {
applicationVariants.all {
variant ->
variant.outputs.all { output ->
outputFileName = new File(rootProject.name + "_" +
"v" + defaultConfig.versionName + "_" +
new Date().format("yyyyMMddHHmm") + ".apk")
outputFileName = new File(rootProject.name
+ "_v" + defaultConfig.versionName
+ "_" + new Date().format("yyyyMMddHHmm")
+ "_" + defaultConfig.applicationId
+ ".apk")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

package io.agora.beautyapi.demo.module.bytedance

import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.pm.ActivityInfo
Expand All @@ -37,7 +38,6 @@ import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.constraintlayout.widget.ConstraintLayout
import io.agora.base.VideoFrame
import io.agora.beautyapi.bytedance.BeautyPreset
import io.agora.beautyapi.bytedance.CameraConfig
import io.agora.beautyapi.bytedance.CaptureMode
import io.agora.beautyapi.bytedance.Config
Expand Down Expand Up @@ -240,7 +240,20 @@ class ByteDanceActivity : ComponentActivity() {
Log.d(TAG, "BeautyStats stats = $stats")
},
onEffectInitialized = {
ByteDanceBeautySDK.initEffect(applicationContext)
val authSuccess = ByteDanceBeautySDK.initEffect(applicationContext)
if(!authSuccess){
runOnUiThread {
AlertDialog.Builder(this@ByteDanceActivity).apply {
setTitle("Auth Failed")
setMessage("Please check your license file")
setCancelable(false)
setPositiveButton( "OK") { dialog, _ ->
dialog.dismiss()
}
show()
}
}
}
Log.d(TAG, "onEffectInitialized")
},
onEffectDestroyed = {
Expand All @@ -250,6 +263,7 @@ class ByteDanceActivity : ComponentActivity() {
)
)
)
ByteDanceBeautySDK.setBeautyAPI(mByteDanceApi)

if (isCustomCaptureMode) {
mRtcEngine.registerVideoFrameObserver(object : IVideoFrameObserver {
Expand Down Expand Up @@ -394,6 +408,7 @@ class ByteDanceActivity : ComponentActivity() {
if (isCustomCaptureMode) {
mRtcEngine.registerVideoFrameObserver(null)
}
ByteDanceBeautySDK.setBeautyAPI(null)
mByteDanceApi.release()
RtcEngine.destroy()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object ByteDanceBeautySDK {

private const val TAG = "ByteDanceBeautySDK"

private val LICENSE_NAME = "Agora_test_20240111_20240411_io.agora.test.entfull_4.5.0_1111.licbag"
private val LICENSE_NAME = "Agora_test_20240412_20240712_io.agora.test.entfull_4.5.0_1443.licbag"
private var storagePath = ""
private var assetsPath = ""
private var licensePath = ""
Expand Down Expand Up @@ -82,13 +82,13 @@ object ByteDanceBeautySDK {
}

// GL Thread
fun initEffect(context: Context) {
fun initEffect(context: Context) : Boolean{
val ret = renderManager.init(
context,
modelsPath, licensePath, false, false, 0
)
if (!checkResult("RenderManager init ", ret)) {
return
return false
}
renderManager.useBuiltinSensor(true)
renderManager.set3Buffer(false)
Expand All @@ -98,6 +98,7 @@ object ByteDanceBeautySDK {
)
renderManager.loadResourceWithTimeout(-1)
beautyConfig.resume()
return true
}

// GL Thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ class ByteDanceControllerView : BeautyControllerView {
}
),
ItemInfo(
R.string.beauty_item_sticker_huahua,
R.mipmap.ic_beauty_sticker_huahua,
isSelected = beautyConfig.sticker == "huahua",
R.string.beauty_item_sticker_zhaocaimao,
R.mipmap.ic_beauty_sticker_zhaocaimao,
isSelected = beautyConfig.sticker == "zhaocaimao",
onValueChanged = { _ ->
beautyConfig.sticker = "huahua"
beautyConfig.sticker = "zhaocaimao"
}
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import android.view.SurfaceView
import android.view.View
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.widget.ConstraintLayout
import io.agora.base.VideoFrame
import io.agora.beautyapi.cosmos.BeautyPreset
import io.agora.beautyapi.cosmos.CameraConfig
import io.agora.beautyapi.cosmos.CaptureMode
import io.agora.beautyapi.cosmos.Config
Expand Down Expand Up @@ -234,6 +234,18 @@ class CosmosActivity : ComponentActivity() {
//requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
window.decorView.keepScreenOn = true

if (!CosmosBeautyWrapSDK.isAuthSuccess()) {
AlertDialog.Builder(this).apply {
setTitle("Auth Failed")
setMessage("Please check your license file")
setCancelable(false)
setPositiveButton( "OK") { dialog, _ ->
dialog.dismiss()
}
show()
}
}

initRtcEngine()
initBeautyApi()
initView()
Expand All @@ -255,6 +267,7 @@ class CosmosActivity : ComponentActivity() {
)
)
)
CosmosBeautyWrapSDK.setBeautyAPI(mCosmosApi)
mCosmosApi.enable(beautyEnable)
// render local video
mCosmosApi.setupLocalVideo(mBinding.localVideoView, Constants.RENDER_MODE_HIDDEN)
Expand Down Expand Up @@ -403,6 +416,7 @@ class CosmosActivity : ComponentActivity() {
if (isCustomCaptureMode) {
mRtcEngine.registerVideoFrameObserver(null)
}
CosmosBeautyWrapSDK.setBeautyAPI(null)
mCosmosApi.release()
CosmosBeautyWrapSDK.reset()
RtcEngine.destroy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ object CosmosBeautyWrapSDK {
}
}

fun isAuthSuccess(): Boolean {
return authSuccess
}

private fun initRenderManager() {
initLoader?.get()
renderModuleManager = CosmosBeautySDK.createRenderModuleManager()
renderModuleManager?.prepare(true)
initModules()
beautyConfig.resume()
}

private fun initModules(){
Expand All @@ -145,6 +150,7 @@ object CosmosBeautyWrapSDK {

internal fun setBeautyAPI(beautyAPI: CosmosBeautyAPI?) {
this.beautyAPI = beautyAPI
beautyConfig.resume()
}

private fun runOnBeautyThread(run: () -> Unit) {
Expand All @@ -154,6 +160,7 @@ object CosmosBeautyWrapSDK {
fun reset() {
renderModuleManager?.release()
renderModuleManager = null
beautyConfig.reset()
beautyModule = null
makeupModule = null
lookupModule = null
Expand Down Expand Up @@ -401,6 +408,26 @@ object CosmosBeautyWrapSDK {
makeUp = null
sticker = null
}

internal fun resume(){
smooth = smooth
whiten = whiten
thinFace = thinFace
enlargeEye = enlargeEye
redden = redden
shrinkCheekbone = shrinkCheekbone
shrinkJawbone = shrinkJawbone
whiteTeeth = whiteTeeth
hairlineHeight = hairlineHeight
narrowNose = narrowNose
mouthSize = mouthSize
chinLength = chinLength
brightEye = brightEye
nasolabialFolds = nasolabialFolds

makeUp = makeUp
sticker = sticker
}
}

data class MakeUpItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import android.view.SurfaceView
import android.view.View
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.widget.ConstraintLayout
import com.faceunity.core.faceunity.FURenderKit
import io.agora.base.VideoFrame
Expand All @@ -44,7 +45,6 @@ import io.agora.beautyapi.demo.databinding.BeautyActivityBinding
import io.agora.beautyapi.demo.utils.ReflectUtils
import io.agora.beautyapi.demo.widget.BottomAlertDialog
import io.agora.beautyapi.demo.widget.SettingsDialog
import io.agora.beautyapi.faceunity.BeautyPreset
import io.agora.beautyapi.faceunity.BeautyStats
import io.agora.beautyapi.faceunity.CameraConfig
import io.agora.beautyapi.faceunity.CaptureMode
Expand Down Expand Up @@ -185,6 +185,14 @@ class FaceUnityActivity : ComponentActivity() {
mFaceUnityApi.setParameters("beauty_mode", "0")
}
}
setTextureAsyncChecked(false)
setOnTextureAsyncChangeListener { enable ->
if (enable) {
mFaceUnityApi.setParameters("enableTextureAsync", "true")
} else {
mFaceUnityApi.setParameters("enableTextureAsync", "false")
}
}
setResolutionSelect(intent.getStringExtra(EXTRA_RESOLUTION) ?: "")
setOnResolutionChangeListener {resolution ->
mVideoEncoderConfiguration.dimensions = ReflectUtils.getStaticFiledValue(
Expand Down Expand Up @@ -222,6 +230,19 @@ class FaceUnityActivity : ComponentActivity() {
setContentView(mBinding.root)
window.decorView.keepScreenOn = true

if (!FaceUnityBeautySDK.isAuthSuccess()) {
AlertDialog.Builder(this).apply {
setTitle("Auth Failed")
setMessage("Please check your license file")
setCancelable(false)
setPositiveButton("OK") { dialog, _ ->
dialog.dismiss()
}
show()
}
}


initRtcEngine()
initBeautyApi()
initView()
Expand Down Expand Up @@ -286,6 +307,7 @@ class FaceUnityActivity : ComponentActivity() {
}

private fun initBeautyApi() {
FaceUnityBeautySDK.beautyConfig.reset()
mFaceUnityApi.initialize(
Config(
applicationContext,
Expand All @@ -301,6 +323,7 @@ class FaceUnityActivity : ComponentActivity() {
}
)
)
FaceUnityBeautySDK.setBeautyAPI(mFaceUnityApi)
when (intent.getStringExtra(EXTRA_PROCESS_MODE)) {
getString(R.string.beauty_process_auto) -> mFaceUnityApi.setParameters(
"beauty_mode",
Expand Down Expand Up @@ -384,6 +407,7 @@ class FaceUnityActivity : ComponentActivity() {
if (isCustomCaptureMode) {
mRtcEngine.registerVideoFrameObserver(null)
}
FaceUnityBeautySDK.setBeautyAPI(null)
mFaceUnityApi.release()
RtcEngine.destroy()
}
Expand Down
Loading

0 comments on commit 277a77d

Please sign in to comment.