**1.申請產品密鑰(Applying for a Product key)**
**MHSDK** 首先需要向商務申請精簡版、基礎或者高級版的產品密鑰,然后將密鑰集成到項目中方可使用。
**MHSDK** first needs to apply for the product key of lite, basic or advanced version from the business, and then integrate the key into the project side for use.
*****
**2.類庫導入(The class library to import)**
將MHUI的文件夾拷貝到Android工程根目錄,
MHSDK目前支持、armv7,armv8版本,defaultConfig配置節點中添加(根據自身項目需求來設置):
Copy the MHUI folder to the Android project root directory,
MHSDK currently supports, armV7, ARMV8 version, defaultConfig config node added (according to their own project needs to set) :
```
ndk {
abiFilters "armeabi-v7a","arm64-v8a"
}
```
引入mhui模塊
Introduce the mhui module
```
implementation project(':mhui')
```
*****
**3.初始化SDK(To initialize the SDK )**
~~~
MHSDK.init(this,"您的授權密鑰");//建議在Application子類的onCreate方法中初始化SDK
~~~
~~~
MHSDK.init(this,"Your authorization key"); // It is recommended to initialize the SDK in the onCreate method of the Application subclass
~~~
*****
**4.添加美狐UI組件(Add the MHSDK UI component)**
在布局文件中添加美狐的UI組件
Add the UI component of the MHSDK to the layout file
```
<com.meihu.beauty.views.MeiHuBeautyControl
android:layout_width="match_parent"
android:layout_height="match_parent"/>
```
*****
**5.在集成了美狐UI組件的Activity中初始化(Class in an Activity that integrates the MHSDK UI component)**
~~~
//初始化(initialize)
MhDataManager.getInstance().create(this.getApplicationContext());
~~~
**6.在直播SDK的渲染方法 調用美狐SDK的渲染方法 返回新生成的紋理ID(The render method in the live SDK calls the render method in the MHSDK to return the newly generated texture ID )**
~~~
int textureId = MhDataManager.getInstance().render(texture, width, height);
return textureId;
//修改MhDataManager#render
public?int?render(int?texture,?int?width,?int?height)?{
????????if?(mMhManager?!=?null)?{
????????????try?{
????????????????texture?=?mMhManager.renderxxx(...);
????????????}?catch?(Exception?e)?{
????????????????e.printStackTrace();
????????????}
????????}else{
???????????Log.e(TAG,?"render:?error");
????????}
????????return?texture;
????}
// 阿里云:render18(...)
// 慕色短視頻,七牛短視頻:render3(...)
// 網易,render4(...)
// 聲網:render16(...)
// 七牛直播,融云:render5(...)
// 即構:render6(...)
// 金山:render7(...)
// 聲網視頻通話(前置攝像頭):render10(...)
// 聲網視頻通話(后置攝像頭):render11(...)
// 騰訊直播:render12(...)
// 三體:render14(...)
~~~
~~~
int textureId = MhDataManager.getInstance().render(texture, width, height);
return textureId;
//modification MhDataManager#render
public?int?render(int?texture,?int?width,?int?height)?{
????????if?(mMhManager?!=?null)?{
????????????try?{
????????????????texture?=?mMhManager.renderxxx(...);
????????????}?catch?(Exception?e)?{
????????????????e.printStackTrace();
????????????}
????????}else{
???????????Log.e(TAG,?"render:?error");
????????}
????????return?texture;
????}
// Alibaba Cloub:render18(...)
// Qiniu Cloud:render3(...)
// Netease,render4(...)
// Agora:render16(...)
// Qiniu Cloud,RongCloud:render5(...)
// ZEGO:render6(...)
// Kingsoft:render7(...)
// Agora(front-facing camera ):render10(...)
// Agora(rear camera):render11(...)
// Tencent live:render12(...)
// santiyun:render14(...)
~~~
*****
**7.如何您使用了MhDataManager結束時銷毀防止內存泄漏(How do you use MhDataManager at the end of destruction to prevent memory leaks )**
~~~
MhDataManager.getInstance().release();
~~~
*****
**8.切換SDK的語言**
MHSDK目前支持中文和英語兩種語言
MHSDK currently supports both Chinese and English
可以通過在Application和Activity中修改context中的語言配置來切換語言,由于Appliction和Activity中獲取的context是不同對象 所以都需要修改
You can switch languages by changing the language configuration of the context in Application and Activity, which need to be changed because the context obtained in Application and Activity are different objects
示例例代碼如下:
Example code is as follows:
~~~
Resources resources = getResources();
Configuration config = resources.getConfiguration();
DisplayMetrics dm = resources.getDisplayMetrics();
config.locale = Locale.ENGLISH;
resources.updateConfiguration(config, dm);
~~~
- 一、產品簡介(Product introduction)
- 1.功能說明(Functional Specification)
- 2.平臺支持(Platform support)
- 3.官方鏈接(The official link)
- 二、集成指引(Integrated guidance)
- Android集成指引(Android Integration Guide)
- 1.概述(Overview)
- 2.接入說明(Access instructions)
- 3.詳細步驟(detailed steps)
- 4.具體直播平臺接入(Specific live broadcast platform access)
- 1.騰訊云直播(Tencent Cloud Live)
- 2.阿里云(Alibaba Cloud)
- 三、MHSDK美顏相關接口部分(MHSDK Interface related to beauty)
- Android相關接口文檔說明(Android MHSDK Interface related to beauty)
- 美顏相關接口文檔說明(Description of interfaces related to beauty)
- 四、常見問題(FAQ)
- Android常見問題(Android FAQ)
- 1.認證失敗原因(Cause of authentication failure)
- 2.調用美型、貼紙、特效、調用美型、貼紙、特效、哈哈鏡沒有效果(Call beauty stickers special effects funhouse mirror have no effect)
- 3.MHBeautyManager的特別聲明(Special statement from MHBeautyManager)
- 4.使用MHUI的注意事項(Considerations for using MHUI)
- 5.卡頓問題(Caton problem)
- 6.閃退問題(flash back problem)
- 7.貼紙無法下載(Stickers cannot be downloaded)
- 8.AndroidX騰訊云環境集成問題(AndroidX Tencent cloud environment integration problems)
- 9.導入新的sdk出現亂碼(Garbled characters appear when importing a new SDK)
- 10.彈出的UI有陰影效果(The UI that pops up has a shadow effect)
- 11.Android10出現網絡資源失敗請檢查網絡(Android10 network resource failure please check the network)
- 12.美狐可以記錄設置的各種參數嗎(Can us fox record various parameters set)
- 13.七牛云替換sdk畫面上下顛倒(Seven niuyun replacement SDK screen upside down)
- 14.貼紙可以自定義嗎(Can stickers be customized)
- 15.您這邊可以錄制視頻嗎(Can you record a video)
- 16.MHSDK必須本地依賴嗎(Does MHSDK have to be locally dependent)
- 17.找不到某個方法(I can't find a way)
- 18.環信不顯示自己的頭像框(Ring letter does not show your avatar box)
- 19.如何取消特效(How to Cancel special effects)
- 20.水印沒有找到(Watermark not found)
- 21.聲網視頻通話大小屏切換問題(The size screen switchover of sonnet video calls is abnormal)
- 22.如何切換sdk的語言