Giter Site home page Giter Site logo

hyb1234hi / futxliteavdemo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from faceunity/futxliteavdemo

0.0 0.0 0.0 212.9 MB

FUTXLiteAVDemo 是 腾讯直播全功能专业版 集成了 Faceunity 美颜、虚拟道具功能 的 Demo。

Objective-C 96.18% Ruby 0.06% C 2.75% GLSL 0.01% Metal 0.46% Objective-C++ 0.29% C++ 0.25%

futxliteavdemo's Introduction

FUTXLiteAVDemo 快速集成文档

FUTXLiteAVDemo 是集成了 Faceunity 面部跟踪和虚拟道具功能 和 腾讯移动直播 功能的 Demo。

本文是 FaceUnity SDK 快速对接融云 腾讯移动直播 的快速导读说明,关于 FaceUnity SDK 的详细说明,请参看 FULiveDemo

由于腾讯TXLiteAVSDK_Professional.framework库的大小过大,无法上传github,请参照工程配置下载库并拷贝到相应位置。

注意:本例是示例 Demo , 只在 首页 --> 直播 --> 美女直播 --> 新建直播间 --> 开始直播 内 接入了 FaceUnity 效果,如需更多接入,请用户参照本例自行定义。

主要文件说明

FUManager 对 FaceUnity SDK 接口和数据的简单封装。 FUAPIDemoBar.framework 展示 FaceUnity 效果的UI。

快速集成方法

一、获取视频数据回调

1、在 LiveRoom.m 内修改 - (void)initLivePusher 方法如下:

- (void)initLivePusher {
    if (_livePusher == nil) {
        TXLivePushConfig *config = [[TXLivePushConfig alloc] init];
        config.pauseImg = [UIImage imageNamed:@"pause_publish.jpg"];
        config.pauseFps = 15;
        config.pauseTime = 300;
       
        _videoQuality = VIDEO_QUALITY_HIGH_DEFINITION;
        _livePusher = [[TXLivePush alloc] initWithConfig:config];
        _livePusher.delegate = self;
        
        // 增加此代理,拿到视频数据回调
        _livePusher.videoProcessDelegate = self ;
        
        [_livePusher setVideoQuality:_videoQuality adjustBitrate:NO adjustResolution:NO];
        [_livePusher setLogViewMargin:UIEdgeInsetsMake(120, 10, 60, 10)];
        config.videoEncodeGop = 5;
        [_livePusher setConfig:config];
    }
}

2、在 LiveRoom.m 内遵循代理 TXVideoCustomProcessDelegate

3、实现 TXVideoCustomProcessDelegate 中的代理方法如下:

- (GLuint)onPreProcessTexture:(GLuint)texture width:(CGFloat)width height:(CGFloat)height {
    
    if ([FUManager shareManager].showFaceUnityEffect) {
        texture = [[FUManager shareManager] renderItemWithTexture:texture Width:width Height:height];
    }
    
    return texture ;
}

二、接入 Faceunity SDK

将 FaceUnity 文件夹全部拖入工程中,并且添加依赖库 OpenGLES.framework、Accelerate.framework、CoreMedia.framework、AVFoundation.framework、stdc++.tbd

1、快速加载道具

LiveRoomPusherViewController.m- (void)viewWillAppear:(BOOL)animated 方法中 调用 [[FUManager shareManager] loadItems] 加载贴纸道具及美颜道具如下:

[[FUManager shareManager] loadItems];
[self.view addSubview:self.demoBar];
[FUManager shareManager].showFaceUnityEffect = YES ;

2、道具切换

调用 [[FUManager shareManager] loadItem: itemName]; 切换道具

3、更新美颜参数

- (void)demoBarDidSelectedItem:(NSString *)itemName {
    
    [[FUManager shareManager] loadItem:itemName];
}


- (void)demoBarBeautyParamChanged {
    
    [FUManager shareManager].skinDetectEnable = _demoBar.skinDetectEnable;
    [FUManager shareManager].blurShape = _demoBar.blurShape;
    [FUManager shareManager].blurLevel = _demoBar.blurLevel ;
    [FUManager shareManager].whiteLevel = _demoBar.whiteLevel;
    [FUManager shareManager].redLevel = _demoBar.redLevel;
    [FUManager shareManager].eyelightingLevel = _demoBar.eyelightingLevel;
    [FUManager shareManager].beautyToothLevel = _demoBar.beautyToothLevel;
    [FUManager shareManager].faceShape = _demoBar.faceShape;
    [FUManager shareManager].enlargingLevel = _demoBar.enlargingLevel;
    [FUManager shareManager].thinningLevel = _demoBar.thinningLevel;
    [FUManager shareManager].enlargingLevel_new = _demoBar.enlargingLevel_new;
    [FUManager shareManager].thinningLevel_new = _demoBar.thinningLevel_new;
    [FUManager shareManager].jewLevel = _demoBar.jewLevel;
    [FUManager shareManager].foreheadLevel = _demoBar.foreheadLevel;
    [FUManager shareManager].noseLevel = _demoBar.noseLevel;
    [FUManager shareManager].mouthLevel = _demoBar.mouthLevel;
    
    [FUManager shareManager].selectedFilter = _demoBar.selectedFilter ;
    [FUManager shareManager].selectedFilterLevel = _demoBar.selectedFilterLevel;
}

4、道具销毁

调用 [[FUManager shareManager] destoryItems]; 销毁贴纸及美颜道具。

注:关于 FaceUnity SDK 的详细说明,请参看 FULiveDemo

futxliteavdemo's People

Contributors

jdbbjd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.