Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
polyv-rn
/
PolyvRNCloudClassDemo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5f7dc5cc
authored
Sep 09, 2019
by
polyv easefun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
9f836316
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
11 deletions
+89
-11
README.md
+89
-11
No files found.
README.md
View file @
5f7dc5cc
...
...
@@ -93,9 +93,9 @@ $ npm install
"react-native"
:
"0.57.8"
,
//polyv/demo里需要的依赖(如不需要可删除)
"react-native-gesture-handler"
:
"^1.4.1"
,
"react-native-gesture-handler"
:
"1.1.0"
,
"react-navigation"
:
"3.3.2"
,
"react-native-reanimated"
:
"^1.2.0"
,
"react-navigation"
:
"^3.12.1"
,
"axios"
:
"^0.18.0"
},
"devDependencies"
:
{
...
...
@@ -127,21 +127,99 @@ $ npm install
| 返回码(整型) | 返回码描述 |
| -------------- | ----------------------- |
| 0 | 成功 |
| -1 | 加密串 vodKey 为空 |
| -2 | 加密密钥 decodeKey 为空 |
| -3 | 加密向量 decodeIv 为空 |
| -4 | appId 为空 |
| -5 | appSecret 为空 |
| -6 | userId 为空 |
| -7 | channelId 为空 |
| -8 | vodId 为空 |
| -9 | 登录失败 |
| -1 | appId 为空 |
| -2 | appSecret 为空 |
| -3 | ViewId 为空 |
| -4 | userId 为空 |
| -5 | channelId 为空 |
| -6 | vodId 为空 |
| -7 | 加密串 vodKey 为空 |
| -8 | 加密密钥 decodeKey 为空 |
| -9 | 加密向量 decodeIv 为空 |
| -10 | 登录失败 |
### 2.2 Android 端集成
#### 2.2.1 端工程说明
Android 端工程的原生插件代码分为两个部分:
-
定制的 rn 模块,就是工程的主模块app,路径是PolyvRNCloudclassDemo/android/app。
-
polyv sdk 模块,主要是 polyv 相关组件的代码文件,路径是PolyvVodRnDemo/android/polyvsdk。
-
- commui 模块,polyvsdky依赖的公共模块,不用添加相关配置,会自动依赖
主模块app涉及的 java 文件有:
-
PolyvCloudClassRNPackage:rn 插件开发的管理类,用来注册相关的 rn 定制组件。
-
PolyvCloudClassRNModule:初始化及登录组件模块,用来初始化 android 端需要的一些全局用户信息,例如 iv,secreate,userid。提供直播与回放登录接口
#### 2.2.2 集成步骤
1、相关依赖配置
用户集成工程需要进行模块项目依赖:setting.gradle
```
java
rootProject
.
name
=
'
PolyvRNCloudClassDemo
'
include
'
:
app
','
:
commonui
'
,
'
:
polyvsdk
'
##
如果有集成导航栏相关控件
include
'
:
react
-
native
-
gesture
-
handler
'
project
(
'
:
react
-
native
-
gesture
-
handler
'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'
../
node_modules
/
react
-
native
-
gesture
-
handler
/
android
'
)
include
'
:
react
-
native
-
reanimated
'
project
(
'
:
react
-
native
-
reanimated
'
).
projectDir
=
new
File
(
rootProject
.
projectDir
,
'
../
node_modules
/
react
-
native
-
reanimated
/
android
'
)
```
工程的相关依赖配置:build.gradle
```
java
dependencies
{
api
project
(
path:
'
:
polyvsdk
'
)
#如果集成导航栏相关配置
api
project
(
'
:
react
-
native
-
gesture
-
handler
'
)
api
project
(
'
:
react
-
native
-
reanimated
'
)
}
//由于用到java8相关特性
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
```
2、原生代码集成
1.
在目标工程中的 android/app/src/main/java 目录下,增加 com 目录,形成 android/app/src/main/java/com 的目录结构(如果已有com目录,可跳过本步骤);
2.
把 android/app/src/main/java/com/polyv文件夹 拷贝到 上面创建的 com目录 下;
3.
配置目标项目的 Application文件;
```java
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
, new PolyvCloudClassRNPackage(), // 新增加的一行!
//如果添加导航栏组件 添加下面
new RNGestureHandlerPackage(),
new ReanimatedPackage(),
);
}
```
4.MainActivity配置
```java
//如果添加导航栏控件需要重写以下方法
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
```
### 2.3 iOS 端集成
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment