Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

秀场直播二期新增文档 #3328

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

秀场直播二期新增文档 #3328

wants to merge 61 commits into from

Conversation

kelzr
Copy link
Collaborator

@kelzr kelzr commented Sep 12, 2023

Comment on lines +7 to +8
- [Android Studio](https://developer.android.com/studio/) 3.5 及以上
- Android 手机,版本 Android 5.0(API Level 21)及以上
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"及以上“是不是统一改成”或以上“,因为只要是其中任意一个版本就可以


| SDK 文件 | 项目路径 |
|-----|-----|
| 美妆资源:例如 `naicha.bundle` | app/src/main/assets/beauty_faceunity/makeup |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照 SG 路径需要用 code font,像下文的「打开 BeautyAPI/Android 文件夹」就用了

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS 同

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是不符合的 style 的,因为老站上表格如果有比较长的 code font,那么表格的宽度会很奇怪

| 贴纸资源:例如 `fashi.bundle` | app/src/main/assets/beauty_faceunity/sticker |
| 证书:`authpack.java` | app/src/main/java/io/agora/beauty/demo/authpack.java |

3. 在 `app/build.gradle` 文件中,将 `applicationId` 修改为你的包名,例如 `com.example.app`。包名用于在设备上唯一标识应用程序。在开发应用时,你需要设置包名。在此处设置的包名需要与你申请美颜 SDK 时提供的包名一致。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那么步骤 1 是不是也可以提一下,联系相芯的时候还要提供包名

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS 的 bundleid 同


## 配置示例项目

运行美颜项目前,你需要在 `local.properties` 文件中添加并设置如下参数:
Copy link
Contributor

@dengyaxi dengyaxi Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

仓库里没搜到这个文件,应该类似于本地的用户设置文件?是否稍加说明


|文件 | 项目路径 |
|-----|-----|
| FaceUnity/Lib/Resources | iOS/FULib |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| FaceUnity/Lib/Resources | iOS/FULib |
| 资源文件:FaceUnity/Lib/Resources | iOS/FULib |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

保持统一?


![](https://web-cdn.agora.io/docs-files/1690276905446)

1. 连接上 iOS 设备后,点击 `BeautyAPi.xcodeproj` 文件以通过 Xcode 打开项目,并在 **iOS Device** 选项中勾选上你的 iOS 设备。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一般 pod 完都是打开 .xcworkspace 文件,可能要再确认下

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个跟项目有关,不是固定的


3. 点击 <img src="https://web-cdn.agora.io/docs-files/1639710560035" width="25"/> 开始编译。

4. 编译成功后,你的 iOS 设备上会出现美颜应用。在 iOS 系统设置中将该应用设为信任开发者后你才能打开应用。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
4. 编译成功后,你的 iOS 设备上会出现美颜应用。在 iOS 系统设置中将该应用设为信任开发者后你才能打开应用
4. 编译成功后,你的 iOS 设备上会出现美颜应用。在 iOS 系统设置中将该应用设为信任开发者,即可打开应用

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xxx后你才能xxx,觉得有一点点口语化


#### 自定义视频采集

自定义视频采集时,你需要通过 `AgoraRtcEngineKit` 类的 `setVideoFrameDelegate` 注册原始视频数据观测器并在其中实现 `onCaptureVideoFrame` 函数。
Copy link
Contributor

@dengyaxi dengyaxi Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下文代码里是不是没体现 onCaptureVideoFrame?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码块的第二段里

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我在这个文件里搜索 onCaptureVideoFrame 只有一处,没看到代码块里有(难道是本地和远端没同步?

| 文件 | 项目路径 |
|------------------|----------------|
| FaceUnity/Lib/Resources | iOS/FULib |
| 证书:authpack.h | iOS/BeautyAPi/FUBeauty/authpack.h |
Copy link
Contributor

@dengyaxi dengyaxi Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ios 通过证书文件鉴权在后面的实现代码中没有体现,是预期的嘛(android 有

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check了代码,这个文件只要集成,pod install就可以。

sourceType: Int,
videoFrame: VideoFrame?
) = when (mFaceUnityApi.onFrame(videoFrame!!)) {
// 当处理结果为 SKIPPED(忽略)时,代表你丢帧,即外部自采集的视频数据不传入声网 SDK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 当处理结果为 SKIPPED(忽略)时,代表你丢帧,即外部自采集的视频数据不传入声网 SDK
// 当处理结果为 SKIPPED(忽略)时代表丢帧,即外部自采集的视频数据不传入声网 SDK


自定义视频采集时,你需要先调用 `RtcEngine` 类的 `enableVideo` 开启声网 SDK 的视频模块,然后通过 `RtcEngine` 类的 `registerVideoFrameObserver` 注册原始视频数据观测器并在其中实现 `onCaptureVideoFrame` 函数。

通过 Beauty API 的 `onFrame` 函数,你可以将外部自采集的视频数据传入并进行处理。当处理结果不为 `SKIPPED`(忽略)时,用自采集的视频数据替代 `onCaptureVideoFrame` 函数中的 `VideoFrame`,并传入声网 SDK。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这部分描述比 ios 详细,可以 copy 过去

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「通过 Beauty API 的 onFrame 函数,你可以将外部自采集的视频数据传入并进行处理。当处理结果不为 SKIPPED(忽略)时,用自采集的视频数据替代 onCaptureVideoFrame 函数中的 VideoFrame,并传入声网 SDK。」这是逻辑是 Android 里的,iOS 的代码逻辑只做了「将外部自采集的视频数据传入并进行处理。」


### API 时序图

![](https://web-cdn.agora.io/docs-files/1693995863450)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现没有 参考信息/API参考 这一小节,是因为场景化 API 不需要写单独的 API文档吗

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android 同

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有时间写单独的 API 文档,这个集成文档对 API 的调用也都介绍了


### 3. 初始化 Beauty API

调用 `createSenseTimeBeautyAPI` 创建 Beauty API 对象。Beauty API 对象是声网基于 `STRenderKit` 对象封装。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个应该也算子步骤,应该要加一下有序编号

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的。但是因为这种步骤序号带来的缩进 UI 改进现在还在调整,新站还没有做出来。所以为了好读,暂时取消了这里该写的序好。序好会让本节的内容全部缩进,本节的内容又很多,读起来很窄。

mSTRenderKit.release()
```

调用 `RtcEngine` 的 `destroy` 销毁 `RtcEngine`。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能要斟酌一下是否需要 destroy RtcEngine,因为只要说完美颜 API 的调用流程就可以结束了,销毁 RtcEngine 不属于美颜 API 的调用流程。


4. 待同步成功后,点击 `Run 'app'`。片刻后,美颜应用便会安装到你的 Android 设备上。

5. 打开美颜应用,进行体验。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里给一个跑起来的界面图可能更好一些。

}
```

3. 将商汤美颜 SDK 集成到你的项目中。请联系商汤技术支持获取美颜 SDK、美颜资源、证书等文件。下载并解压文件,然后添加到美颜项目对应的文件路径下:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

集成 SDK 作为一个二级标题体现在右侧导航中可能会更好点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants