MHUI 是開源的。英文界面和中文界面所用的文件名稱不同,功能是一樣的.菜單使用默認美顏方法如下(MHUI is open source. The English interface and the Chinese interface use different file names and have the same functions The default beauty method used in the menu is as follows:):
1) 在直播或者視頻頁面中添加美顏功能(Add beauty function in live broadcast or video page)
```
#import <MHBeautySDK/MHBeautyManager.h>
#import "MHBeautyParams.h"
#import "MHMeiyanMenusView.h"
(EnglishVersion is #import "BeautyFoxMenusView.h")
```
2) 聲明屬性
```
@property(nonatomic, strong)MHMeiyanMenusView *menusV
iew; (@property (nonatomic, strong) BeautyFoxMenusView *menusView;)
@property(nonatomic, strong)MHBeautyManager *beautyMana
ger;
```
3) 初始化美顏管理器(Initialize Beauty Manager)
\- (MHBeautyManager \*)beautyManager {
if (!\_beautyManager) {
\_beautyManager = \[\[MHBeautyManager alloc\] init\];
\_beautyManager.maxFace = 3;
}
return \_beautyManager;
}
4) 初始化美顏菜單(Initialize beauty menu)
/// 初始化美顏菜單(推薦使用)
/// @param frame frame
/// @param superView 所要添加到的視圖
/// @param manager 美顏管理器,完成初始化后傳入
/// 該方法默認使用美狐相關功能,不需要實現MHMeiyanMenusViewDelegate中的美顏方法
\- (instancetype)initWithFrame:(CGRect)frame superView:(UIView \*)superView beautyManager:(MHBeautyManager \*)manager;
EnhlisjVersion:
///(Initialize beauty menu,Recommand to use)
/// @param frame frame
/// @param superView
/// @param manager Pass in after initialization
/// This method uses the relevant functions of Meihu by default
\- (instancetype)initWithFrame:(CGRect)frame superView:(UIView \*)superView beautyManager:(MHBeautyManager \*)manager;
5) 初始化美顏菜單頁實例(Initialize beauty menu page instance)
\- (MHMeiyanMenusView \*)menusView {
if (!\_menusView) {
\_menusView = \[\[MHMeiyanMenusView alloc\] initWithFrame:CGRectMake(0, window\_height - MHMeiyanMenuHeight - BottomIndicatorHeight, window\_width, MHMeiyanMenuHeight) superView:self.view beautyManager:self.beautyManager\];
}
return \_menusView;
}
6) 如果需要實現代理方法,則遵循協議MHMeiyanMenusViewDelegate , (BeautyFoxMenusViewDelegate)
7) 展示美顏頁面,(Show beauty page):
\[self.menusView showMenuView:YES\];
8) 美顏菜單的隱藏,則可以在控制器的 touchesBegan
方法中調用上面的方法。示例代碼(the beauty menu can be hidden in the touchesbegan of the controller
The above method is invoked in the method. Sample code):
\- (void)touchesBegan:(NSSet<UITouch \*> \*)touches
withEvent:(UIEvent \*)event{
if (self.menusView.isShow) {
\[self.menusView showMenuView:NO\];
if (!\[self.menusView isDescendantOfView:self.view\]) {
//頁面上其他控件顯示,根據自己的項目完善
}
}
}
9) 如果不想隱藏美顏菜單,可以在 touchesBegan 方法中調用 (If you don't want to hide the beauty menu, you can call it in the touchesBegan method.)
\[self.menusView showMenuView:YES\];
如果項目中有需求是調用保存的美顏效果,調用下面的方法。詳情請看 MHMeiyanMenusView.m(If the demand in the project is to call the saved beauty effect, call the following method. For details, please see MHMeiyanMenusView.m)
-(void)setupDefaultBeautyAndFaceValue;
在渲染方法中調用,要設置標志符保證該方法只走一次,不
然耗內存,(In the rendering method, we need to set the identifier to ensure that the method will go only once.
Ran out of memory):
\- (GLuint)onPreProcessTexture:(GLuint)texture
width:(CGFloat)width height:(CGFloat)height
{
\[self.beautyManager processWithTexture:texture
width:width height:height\];
if (!self.isSetDefaultValue) {
\[self.menusView
setupDefaultBeautyAndFaceValue\];
self.isSetDefaultValue = YES;
}
return texture;
}
10) 渲染結束,要釋放渲染資源,否則會造成內存泄漏(At the end of rendering, the rendering resources should be released, otherwise it will cause memory leakage)
\- (void)dealloc {
if (\_beautyManager) {
\[\_beautyManager destroy\];
\_beautyManager = nil;
}
}
以下是不同廠商的直播/短視頻 SDK 的調用渲染方法(The following is the call rendering method of live / short video SDKs from different manufacturers):
- 美狐SDK接入文檔
- Meihu SDK Access Document
- (Untitled)
- 一、基礎描述(Basic description)
- 1. 最新特性 (Latest features)
- 2. 支持平臺 (Support platform)
- 二、集成步驟 (Integration steps)
- 3. 配置工程(Configuration Engineering)
- 4. 使用 MHUI (Use MHUI)
- 5. 騰訊直播 SDK/短視頻SDK (Tencent live SDK / short video SDK)
- 6. 金山直播SDK (Jinshan)
- 7. 七牛直播SDK (Qiniu Live)
- 8. 七牛短視頻SDK (Qiniu ShortVideo)
- 9. Movieous短視頻 (Movieous short Video)
- 10. 即構直播SDK (Zego live)
- 11. 即構實時音視頻SDK(Zego Real time audio and video)
- 12. 新版Zego(即構)實時音視頻(New Zego Real time audio and video)
- 13. 網易直播 (NetEase live)
- 14. 騰訊互動直播 (Tencent interactive live broadcast)
- 15. 騰訊實時音視頻(Tencent real-time audio and video)
- 16. 融云實時音視頻 (SealRTC)
- 17. 聲網視頻通話 (Agora video call)
- 18. 聲網直播 (Agora Live)
- 19. 阿里直播 (Ali Live)
- 20. 阿里音視頻 SDK美顏
- 三、對接說明 (Docking instructions)
- 四、常見問題(common problem)
- 2. 美顏無效果(Beauty has no effect)
- 3. 貼紙下載失敗(Sticker download failed)
- 4. 點擊無法出現美顏菜單頁(The beauty menu page cannot appear after clicking)
- 5. 英文版顯示中文(The beauty menu page cannot appear after clicking)
- 6. 語言切換功能(Language switching function)