更新记录
1.7(2023-12-18)
增加setBeautyCallback美颜菜单隐藏和显示回调事件。
1.6(2023-05-04)
更新Android和iOS端SDK版本8.6.0。
1.5(2022-12-16)
更新iOS端视频采集sdk版本。
查看更多平台兼容性
Android | Android CPU类型 | iOS |
---|---|---|
适用版本区间:5.0 - 14.0 | armeabi-v7a:未测试,arm64-v8a:未测试,x86:未测试 | 适用版本区间:9 - 17 |
原生插件通用使用流程:
- 购买插件,选择该插件绑定的项目。
- 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
- 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
- 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
- 开发完毕后正式云打包
付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios
注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择
声网美颜插件接口
1、插件对象
//美颜插件对象
var FUA = uni.requireNativePlugin("FaceUnity-Agora");
2、初始化美颜
//初始化美颜,初始化调用一次即可
var auth = "";//auth联系作者
FUA.initFaceUnity(auth);
3、美颜相机预览标签,嵌入标签的当前页面必需nvue
<Agora_Face_View ref="videoView" style="width: 100%;height:400px;"></Agora_Face_View>
4、获取美颜相机预览标签对象,必需在mounted()之后才能获取到对象
var videoView = this.$refs.videoView;
5、设置美颜开关
//设置美颜开关
var videoView = this.$refs.videoView;
videoView.setBeautyEnable(true);//true美颜开 false美颜关
6、开启预览
//开启预览
var videoView = this.$refs.videoView;
videoView.startCapture();
7、停止预览
//停止预览
var videoView = this.$refs.videoView;
videoView.stopCapture();
8、切换前后摄像头
//切换前后摄像头
var videoView = this.$refs.videoView;
videoView.switchCamera();
9、显示美颜配置菜单
//显示美颜配置菜单
FUA.showBeautyMenuView();
10、隐藏美颜配置菜单
//隐藏美颜配置菜单
FUA.hideBeautyMenuView();
11、隐藏美颜配置菜单
//设置美颜配置参数
FUA.setBeauty({
//设置美肤
blurIntensity:4.2,//精细磨皮,范围[0-6]
colorIntensity:0.3,//美白,范围 [0-2]
redIntensity:0.3,//红润,范围 [0-2]
sharpenIntensity:0.2,//锐化,范围 [0-1]
faceThreeIntensity:0,//五官立体,范围 [0-1]
eyeBrightIntensity:0,//亮眼,范围 [0-1]
toothIntensity:0,//美牙,范围 [0-1]
removePouchIntensity:0,//去黑眼圈,范围 [0-1]
removeLawPatternIntensity:0,//去法令纹,范围 [0-1]
//设置美型
cheekThinningIntensity:0,//瘦脸,范围[0-1]
cheekVIntensity:0.5,//V脸,范围 [0-1]
cheekNarrowIntensity:0,//窄脸,范围 [0-1]
cheekShortIntensity:0,//短脸,范围 [0-1]
cheekSmallIntensity:0,//小脸,范围 [0-1]
cheekBonesIntensity:0,// 瘦颧骨,范围 [0-1]
lowerJawIntensity:0,//瘦下颌骨,范围 [0-1]
eyeEnlargingIntensity:0.4,//大眼,范围 [0-1]
eyeCircleIntensity:0,//圆眼,范围 [0-1],0.0 到 1.0 变强
chinIntensity:0.3,//下巴,范围 [0-1],0-0.5是变小,0.5-1是变大
forHeadIntensity:0.3,//额头,范围[0-1],0-0.5 是变小,0.5-1 是变大
noseIntensity:0.5,//瘦鼻,范围 [0-1]
mouthIntensity:0.4,//嘴型,范围 [0-1],0-0.5是变小,0.5-1是变大
lipThickIntensity:0.5,//嘴巴厚度,范围 [0-1],默认0.5
eyeHeightIntensity:0.5,//眼睛高度,范围 [0-1],默认0.5
canthusIntensity:0,//开眼角,范围 [0-1],0.0 到 1.0 变强
eyeLidIntensity:0,//眼睑, 范围 [0-1],0.0 到 1.0 变强
eyeSpaceIntensity:0.5,//眼距,范围 [0-1],0.5-0.0 变长,0.5-1.0 变短
eyeRotateIntensity:0.5,//眼睛角度,范围 [0-1],0.5-0.0 逆时针旋转,0.5-1.0 顺时针旋转
longNoseIntensity:0.5,//长鼻,范围 [0-1],0.5-0.0 变短,0.5-1.0 变长
philtrumIntensity:0.5,//缩人中,范围 [0-1],0.5-1.0 变长,0.5-0.0 变短
smileIntensity:0,//微笑嘴角,范围 [0-1],0.0 到 1.0 变强
browHeightIntensity:0.5,//眉毛上下, 范围 [0-1],0.5 到 0.0 向上,0.5 到 1.0 向下, 默认0.5
browSpaceIntensity:0.5,//眉毛间距, 范围 [0-1],0.5 到 0.0 变小,0.5 到 1.0 变大, 默认0.5
browThickIntensity:0.5,//眉毛粗细, 范围 [0-1],默认0.5
//设置滤镜
filterName:"ziran1",//滤镜名称,origin=原图 ziran1=自然1 zhiganhui1=质感灰1 bailiang1=白亮1 fennen1=粉嫩1 lengsediao1=冷色调1
filterIntensity:0.8//设置滤镜强度,0-1
});
10、隐藏美颜配置菜单
//获取美颜配置参数
var beautyData = FUA.getBeauty();
console.log(beautyData);