跳到主要内容

Uniapp 项目配置

提示

本篇用于说明在 Uniapp 开发框架下如何使用配置自定义组件 rc-liveplayerrc-livepusher,非 Uniapp 用户可略过。

安装依赖

bash
# 安装 IMLib
npm i @rongcloud/engine@latest @rongcloud/imlib-next@latest -S

# 安装 RTCLib
npm i @rongcloud/plugin-wechat-rtc@latest -S

安装 RTCLib 会在项目根目录下生成 rcComponents 目录,该目录下包含了 rc-liveplayerrc-livepusher 组件。

项目配置

  1. 修改 rcComponents 目录名,将目录重命名为 wxcomponents
  2. 修改 Uniapp 项目根目录下的 pages.json 配置文件,在需要引入组件的 page 页面中增加配置
JSON
{
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app",
"mp-weixin": {
"usingComponents": {
"rc-livepusher": "/wxcomponents/rc-livepusher",
"rc-liveplayer": "/wxcomponents/rc-liveplayer"
}
}
}
}
]
}