导航菜单

页面标题

页面副标题

新暖心缘 v8.1.1 - SetBeautyActivity.java 源代码

正在查看: 新暖心缘 v8.1.1 应用的 SetBeautyActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.luanxingyuan.app.activity;

import android.os.Bundle;
import android.view.TextureView;
import android.view.View;
import butterknife.BindView;
import com.faceunity.wrappe.FURenderer;
import com.faceunity.wrappe.data.FaceBeautyDataFactory;
import com.faceunity.wrappe.data.FaceUnityDataFactory;
import com.faceunity.wrappe.repo.FUDiskFaceBeautyData;
import com.faceunity.wrappe.repo.FaceBeautySource;
import com.faceunity.wrappe.ui.FaceUnityView;
import com.luanxingyuan.app.base.AppManager;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.rtc.PreprocessorFaceUnity2;
import com.luanxingyuan.app.rtc.RtcEngineEventHandler;
import com.luanxingyuan.app.rtc.RtcManager;
import io.agora.rtc2.video.VideoCanvas;
import io.agora.rtc2.video.VideoEncoderConfiguration;

public class SetBeautyActivity extends BaseActivity {

    @BindView
    TextureView localVideoView;
    RtcEngineEventHandler rtcEngineEventHandler = new a();
    protected RtcManager rtcManager;

    class a implements RtcEngineEventHandler {
        a() {
        }

        @Override
        public void onJoinChannelSuccess(String str, int i8, int i9) {
            StringBuilder sb = new StringBuilder();
            sb.append("onJoinChannelSuccess: ");
            sb.append(str);
        }

        @Override
        public void onRemoteVideoStateChanged(int i8, int i9, int i10, int i11) {
            StringBuilder sb = new StringBuilder();
            sb.append(i9);
            sb.append("onRemoteVideoStateChanged: ");
            sb.append(i10);
        }

        @Override
        public void onUserJoined(int i8, int i9) {
        }

        @Override
        public void onUserMuteVideo(int i8, boolean z7) {
        }

        @Override
        public void onUserOffline(int i8, int i9) {
        }
    }

    @Override
    protected View getContentView() {
        return inflate(2131492961);
    }

    protected void initVideo() {
        VideoEncoderConfiguration videoEncoderConfiguration = new VideoEncoderConfiguration(VideoEncoderConfiguration.VD_960x540, VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_15, 0, VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT);
        RtcManager rtcManager = RtcManager.get();
        this.rtcManager = rtcManager;
        rtcManager.addRtcHandler(this.rtcEngineEventHandler);
        this.rtcManager.rtcEngine().setVideoEncoderConfiguration(videoEncoderConfiguration);
        this.rtcManager.rtcEngine().setupLocalVideo(new VideoCanvas(this.localVideoView, 1, AppManager.f().k().t_id));
        this.rtcManager.rtcEngine().enableVideo();
        this.rtcManager.rtcEngine().registerVideoFrameObserver(PreprocessorFaceUnity2.getInstance());
        this.rtcManager.rtcEngine().startPreview();
        this.rtcManager.rtcEngine().enableLocalAudio(true);
        this.rtcManager.rtcEngine().enableLocalVideo(true);
        this.rtcManager.rtcEngine().setChannelProfile(1);
        this.rtcManager.rtcEngine().setClientRole(1);
    }

    @Override
    protected void onContentAdded() {
        FaceBeautyDataFactory.setDefaultFaceBeauty();
        FaceUnityView faceUnityView = (FaceUnityView) findViewById(2131296703);
        FaceUnityDataFactory faceUnityDataFactory = new FaceUnityDataFactory(0);
        faceUnityView.bindDataFactory(faceUnityDataFactory);
        faceUnityDataFactory.bindCurrentRenderer();
        initVideo();
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

    @Override
    protected void onDestroy() {
        FURenderer.getInstance().release();
        FaceBeautySource.saveFaceBeautyData2File(new FUDiskFaceBeautyData(), FaceBeautyDataFactory.defaultFaceBeauty, FaceBeautySource.buildFilters());
        super.onDestroy();
    }

    @Override
    protected void onPause() {
        PreprocessorFaceUnity2.getInstance().setRenderEnable(false);
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        PreprocessorFaceUnity2.getInstance().setRenderEnable(true);
    }
}