核心common 概述
About Polyv Multi-Scene Common Layer
- 6.1.1 Introduction
- 6.1.2 Detailed Explanation
- 6.1.3 How to Use the Common Layer
- 6.1.4 Common Layer Folder Directory Structure
6.1.1 Introduction
The Common Layer (i.e., all files under the PLVLiveCommonModule folder), translated as "Universal Layer," is fully open-source. Essentially, it is a wrapper around the Polyv Multi-Scene SDK.
Purpose of the Common Layer:
- Provide more user-friendly and unified APIs
- Implement more complete business functionalities
- Use a more standardized encapsulation form.
For enterprise clients, the Common Layer fulfills most common functional requirements of enterprises, while not depending on or focusing on specific business UI.
6.1.2 Detailed Explanation
Regarding
“Common层 有什么作用?”
“Common层 是否影响我司现在或未来的自定义UI需求?”
“Common层 如何使用?”
and other questions, the following provides a detailed explanation:
In the Polyv Multi-Scene architecture, we divide UI代码 into two categories:
- First Category: UI with enterprise element characteristics, strong interactive features, and customization tendencies. Called "Enterprise Characteristic UI"
- Second Category: UI that provides more complete capabilities for SDK modules, without enterprise element characteristics, and with minimal customization possibilities. Called "Universal UI"
The above two categories of UI代码 are located respectively (please download the Demo source code in advance):
- First Category (Enterprise Characteristic UI): Located in the upper "Scene Layer" folder (i.e.,
云课堂场景PLVLiveCloudClassScene,直播带货场景PLVLiveEcommerceScene) - Second Category (Universal UI): Located in the "Common Universal Layer" folder (i.e.,
PLVLiveCommonModule)
Thanks to the above design, the Common Layer does not depend on or focus on "Enterprise Characteristic UI," making it purer and more loosely coupled. Practical features are as follows:
- The Common Layer can be directly dragged into your own project without causing conflicts;
- It does not involve "Enterprise Characteristic UI" or UI element characteristics, thus imposing no burden on enterprise-customized UI needs and offering good compatibility with various scene UI requirements.
- At the same time, the Common Layer has already implemented most common functional requirements of enterprises, possessing Polyv's powerful and complete product capabilities.
The Polyv Multi-Scene Common Layer code has complete capabilities and good scene compatibility.
It is highly recommended to directly drag the PLVLiveCommonModule folder for integration and develop directly facing the classes of the Common Layer, rather than facing the SDK Layer.
体积方面,Common层全部文件总和体积,约为 950 KB,负担极小。若企业有更极致的体积需求,可进一步与我们联系
6.1.3 How to Use the Common Layer
Required integration steps — Under the premise of having already integrated the Polyv Multi-Scene SDK, simply drag the PLVLiveCommonModule folder from the Demo source code into your own project. In the Xcode popup options, select Copy items if needed for Destination, and select Create gourps for Added folders.
If the enterprise chooses to use Polyv's scene UI source code to quickly implement live streaming capabilities and maintain visual consistency across platforms, then in the Demo source code, drag
云课堂场景PLVLiveCloudClassSceneand直播带货场景PLVLiveEcommerceSceneinto your own project in the same way as the above step.If the enterprise chooses not to use Polyv's scene UI source code and plans to implement the UI layer code on its own, refer to the following:
以 “创建一个播放器,进行直播观看” 为例:
(1)面向Common层开发,找到 PLVLiveCommonModule - Modules - Player 文件夹下的 PLVPlayerPresenter.h 类文件
(2)简单阅读 PLVPlayerPresenter.h 的注释说明、使用演示
(3)在自家控制器中,引入 #import "PLVPlayerPresenter.h"
(4)在自家控制器中,创建 PLVPlayerPresenter` 作为一个播放器对象 (注:大部分Presenter 内部均依赖于 PLVRoomData 房间配置数据,请提前参 PLVRoomLoginClient.h 了解如何配置房间数据)
(5)根据自家业务需求,面向 PLVPlayerPresenter.h 使用对外暴露的方法 和 Delegate回调。
按以上步骤,即可快速集成拥有完整能力的 保利威播放器,进行直播观看。
其他 连麦功能、聊天功能、PPT功能、互动功能等,均可按此步骤进行快速集成。
(注:不建议直接修改 Presenter.m 内部代码,否则将可能影响后续升级的便捷性。有特殊需求的,需要修改的,可直接与我们技术支持联系,我们将针对性提供解决方案)
6.1.4 Common Layer Folder Directory Structure
The directory structure of the PLVLiveCommonModule folder is as follows:
.
└── PLVLiveCommonModule
└── GeneralUI 提供了一些多场景通用的 UI 控件,Modules 文件夹提供了各个功能的基础模块:
├── PLVAdvView
├── LogoView
├── PLVAlbum
├── PLVEmoticons
├── PLVKeyboard
├── PLVMarquee
├── PLVPageController
├── PLVPhotoBrowser
├── PLVProgressSlider
└── ZJZDanMu
└── Modules
├── Room 提供直播间的登录辅助类 PLVRoomLoginClient 和直播间数据管理器类 PLVRoomDataManager
├── PPT 提供通用的 PPT 视图 PLVPPTView
├── Chatroom 提供了聊天室模块的 presenter 类 PLVChatroomPresenter
├── Interact 提供各个互动功能的封装类和支持各种互动类型的互动视图 PLVInteractView
├── LinkMic 提供了连麦模块的 presenter 类 PLVLinkMicPresenter
└── Player 提供了播放器模块的 presenter 类 PLVPlayerPresenter
