@ray-js/ray-ipc-player 2.0.4-beta-1 → 2.0.6-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-zh_CN.md +104 -17
- package/README.md +23 -38
- package/package.json +2 -2
package/README-zh_CN.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[English](./README.md) | 简体中文
|
|
2
|
+
|
|
1
3
|
# ray-ipc-player
|
|
2
4
|
|
|
3
5
|
针对 ipc-player 基础能力进行封装,包含 loading、设备异常、离线等提示
|
|
@@ -6,30 +8,114 @@
|
|
|
6
8
|
|
|
7
9
|
```ts
|
|
8
10
|
export type IProps = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @description.en devId
|
|
13
|
+
* @description.zh 设备id
|
|
14
|
+
* @default ""
|
|
15
|
+
*/
|
|
16
|
+
devId: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description.en onlineStatus
|
|
19
|
+
* @description.zh 设备是否在线
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
onlineStatus: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @description.en privateState
|
|
25
|
+
* @description.zh 隐私模式
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
privateState?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @description.en defaultMute
|
|
31
|
+
* @description.zh 默认静音
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
defaultMute?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @description.en clarity
|
|
37
|
+
* @description.zh 清晰度 normal:标清,hd:高清
|
|
38
|
+
* @default "normal"
|
|
39
|
+
*/
|
|
40
|
+
clarity?: 'normal' | 'hd';
|
|
41
|
+
/**
|
|
42
|
+
* @description.en updateLayout
|
|
43
|
+
* @description.zh 外层父节点样式变化,播放器监听不到,需要主动触发播放器视图更新,每次需要设置不同的字符串值
|
|
44
|
+
* @default ""
|
|
45
|
+
*/
|
|
46
|
+
updateLayout?: any;
|
|
47
|
+
/**
|
|
48
|
+
* @description.en onChangeStreamStatus
|
|
49
|
+
* @description.zh 通知视频流状态发生变化
|
|
50
|
+
* @default (data) => void
|
|
51
|
+
*/
|
|
52
|
+
onChangeStreamStatus?: (data) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @description.en onCtx
|
|
55
|
+
* @description.zh 获取ipcPlayer实例ctx以及重试方法retry
|
|
56
|
+
* @default (playerRef) => void
|
|
57
|
+
*/
|
|
58
|
+
onCtx?: (playerRef) => void;
|
|
59
|
+
/**
|
|
60
|
+
* @description.en onInitPreview
|
|
61
|
+
* @description.zh 初始化预览成功通知
|
|
62
|
+
* @default (devId) => void
|
|
63
|
+
*/
|
|
64
|
+
onInitPreview?: (data) => void;
|
|
65
|
+
/**
|
|
66
|
+
* @description.en onPlayerTap
|
|
67
|
+
* @description.zh 播放器区域点击事件
|
|
68
|
+
* @default (devId) => void
|
|
69
|
+
*/
|
|
70
|
+
onPlayerTap?: (data) => void;
|
|
71
|
+
/**
|
|
72
|
+
* @description.en scalable
|
|
73
|
+
* @description.zh 是否可缩放
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
scalable?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* @description.en scaleMultiple
|
|
79
|
+
* @description.zh 缩放比例
|
|
80
|
+
* @default 0
|
|
81
|
+
*/
|
|
82
|
+
scaleMultiple?: number;
|
|
83
|
+
/**
|
|
84
|
+
* @description.en rotateZ
|
|
85
|
+
* @description.zh 摄像头旋转角度
|
|
86
|
+
* @default 0
|
|
87
|
+
*/
|
|
88
|
+
rotateZ?: number;
|
|
89
|
+
/**
|
|
90
|
+
* @description.en ptzControllable
|
|
91
|
+
* @description.zh 是否开启视频区云平台控制
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
ptzControllable?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* @description.en playerStyle
|
|
97
|
+
* @description.zh 播放器样式
|
|
98
|
+
* @default {}
|
|
99
|
+
*/
|
|
23
100
|
playerStyle?: {
|
|
24
|
-
// 播放器样式
|
|
25
101
|
bgColor?: string; // 背景底色
|
|
26
102
|
borderRadius?: number | string; // 边框圆角
|
|
27
103
|
borderStyle?: 'solid' | 'dashed'; // 边框样式
|
|
28
104
|
borderColor?: string; // 边框颜色
|
|
29
105
|
borderWidth?: string | number; // 边框宽度
|
|
30
106
|
};
|
|
31
|
-
|
|
32
|
-
|
|
107
|
+
/**
|
|
108
|
+
* @description.en loadText
|
|
109
|
+
* @description.zh 加载过程中的文案,可结合onChangeStreamStatus事件做文案配置
|
|
110
|
+
* @default "正在获取视频流..."
|
|
111
|
+
*/
|
|
112
|
+
loadText?: string;
|
|
113
|
+
/**
|
|
114
|
+
* @description.en extend
|
|
115
|
+
* @description.zh 扩展属性
|
|
116
|
+
* @default {}
|
|
117
|
+
*/
|
|
118
|
+
extend?: Record<string, any>;
|
|
33
119
|
};
|
|
34
120
|
```
|
|
35
121
|
|
|
@@ -99,6 +185,7 @@ const PlayerDemo = () => {
|
|
|
99
185
|
<View style={{ width: playerWidth }}>
|
|
100
186
|
<Player
|
|
101
187
|
devId={devId}
|
|
188
|
+
onlineStatus={true}
|
|
102
189
|
onCtx={onCtx}
|
|
103
190
|
updateLayout={updateLayout}
|
|
104
191
|
extend={{
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
English | [简体中文](./README-zh_CN.md)
|
|
2
|
+
|
|
1
3
|
# ray-ipc-player
|
|
2
4
|
|
|
3
5
|
Encapsulates basic ipc-player capabilities, including loading, device exception, and offline prompts
|
|
@@ -8,109 +10,92 @@ Encapsulates basic ipc-player capabilities, including loading, device exception,
|
|
|
8
10
|
export type IProps = {
|
|
9
11
|
/**
|
|
10
12
|
* @description.en devId
|
|
11
|
-
* @description.zh 设备id
|
|
12
13
|
* @default ""
|
|
13
14
|
*/
|
|
14
15
|
devId: string;
|
|
15
16
|
/**
|
|
16
|
-
* @description.en
|
|
17
|
-
* @description.zh 设备是否在线
|
|
17
|
+
* @description.en Whether the device is online
|
|
18
18
|
* @default true
|
|
19
19
|
*/
|
|
20
20
|
onlineStatus: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* @description.en
|
|
23
|
-
* @description.zh 隐私模式
|
|
22
|
+
* @description.en Privacy mode
|
|
24
23
|
* @default false
|
|
25
24
|
*/
|
|
26
25
|
privateState?: boolean;
|
|
27
26
|
/**
|
|
28
27
|
* @description.en defaultMute
|
|
29
|
-
* @description.zh 默认静音
|
|
30
28
|
* @default true
|
|
31
29
|
*/
|
|
32
30
|
defaultMute?: boolean;
|
|
33
31
|
/**
|
|
34
32
|
* @description.en clarity
|
|
35
|
-
* @description.zh 清晰度 normal:标清,hd:高清
|
|
36
33
|
* @default "normal"
|
|
37
34
|
*/
|
|
38
35
|
clarity?: 'normal' | 'hd';
|
|
39
36
|
/**
|
|
40
|
-
* @description.en
|
|
41
|
-
* @description.zh 外层父节点样式变化,播放器监听不到,需要主动触发播放器视图更新,每次需要设置不同的字符串值
|
|
37
|
+
* @description.en Notifying the view of updates, each time you need to set a different value
|
|
42
38
|
* @default ""
|
|
43
39
|
*/
|
|
44
40
|
updateLayout?: any;
|
|
45
41
|
/**
|
|
46
|
-
* @description.en
|
|
47
|
-
* @description.zh 通知视频流状态发生变化
|
|
42
|
+
* @description.en Notifies the video stream that the state has changed
|
|
48
43
|
* @default (data) => void
|
|
49
44
|
*/
|
|
50
45
|
onChangeStreamStatus?: (data) => void;
|
|
51
46
|
/**
|
|
52
|
-
* @description.en
|
|
53
|
-
* @description.zh 获取ipcPlayer实例ctx以及重试方法retry
|
|
47
|
+
* @description.en Obtain ipcPlayer instance ctx and retry method Retry
|
|
54
48
|
* @default (playerRef) => void
|
|
55
49
|
*/
|
|
56
50
|
onCtx?: (playerRef) => void;
|
|
57
51
|
/**
|
|
58
|
-
* @description.en
|
|
59
|
-
* @description.zh 初始化预览成功通知
|
|
52
|
+
* @description.en The initialization preview is successful
|
|
60
53
|
* @default (devId) => void
|
|
61
54
|
*/
|
|
62
55
|
onInitPreview?: (data) => void;
|
|
63
56
|
/**
|
|
64
|
-
* @description.en
|
|
65
|
-
* @description.zh 播放器区域点击事件
|
|
57
|
+
* @description.en Click events in the player area
|
|
66
58
|
* @default (devId) => void
|
|
67
59
|
*/
|
|
68
60
|
onPlayerTap?: (data) => void;
|
|
69
61
|
/**
|
|
70
|
-
* @description.en
|
|
71
|
-
* @description.zh 是否可缩放
|
|
62
|
+
* @description.en Scalable or not
|
|
72
63
|
* @default true
|
|
73
64
|
*/
|
|
74
65
|
scalable?: boolean;
|
|
75
66
|
/**
|
|
76
|
-
* @description.en
|
|
77
|
-
* @description.zh 缩放比例
|
|
67
|
+
* @description.en Scale of scale
|
|
78
68
|
* @default 0
|
|
79
69
|
*/
|
|
80
70
|
scaleMultiple?: number;
|
|
81
71
|
/**
|
|
82
|
-
* @description.en
|
|
83
|
-
* @description.zh 摄像头旋转角度
|
|
72
|
+
* @description.en Camera rotation Angle
|
|
84
73
|
* @default 0
|
|
85
74
|
*/
|
|
86
75
|
rotateZ?: number;
|
|
87
76
|
/**
|
|
88
|
-
* @description.en
|
|
89
|
-
* @description.zh 是否开启视频区云平台控制
|
|
77
|
+
* @description.en Whether to enable the video area cradle head control
|
|
90
78
|
* @default true
|
|
91
79
|
*/
|
|
92
80
|
ptzControllable?: boolean;
|
|
93
81
|
/**
|
|
94
82
|
* @description.en playerStyle
|
|
95
|
-
* @description.zh 播放器样式
|
|
96
83
|
* @default {}
|
|
97
84
|
*/
|
|
98
85
|
playerStyle?: {
|
|
99
|
-
bgColor?: string;
|
|
100
|
-
borderRadius?: number | string;
|
|
101
|
-
borderStyle?: 'solid' | 'dashed';
|
|
102
|
-
borderColor?: string;
|
|
103
|
-
borderWidth?: string | number;
|
|
86
|
+
bgColor?: string;
|
|
87
|
+
borderRadius?: number | string;
|
|
88
|
+
borderStyle?: 'solid' | 'dashed';
|
|
89
|
+
borderColor?: string;
|
|
90
|
+
borderWidth?: string | number;
|
|
104
91
|
};
|
|
105
92
|
/**
|
|
106
|
-
* @description.en
|
|
107
|
-
* @
|
|
108
|
-
* @default "正在获取视频流..."
|
|
93
|
+
* @description.en Loading copy
|
|
94
|
+
* @default "Getting a video stream..."
|
|
109
95
|
*/
|
|
110
96
|
loadText?: string;
|
|
111
97
|
/**
|
|
112
|
-
* @description.en
|
|
113
|
-
* @description.zh 扩展属性
|
|
98
|
+
* @description.en Extended Attributes
|
|
114
99
|
* @default {}
|
|
115
100
|
*/
|
|
116
101
|
extend?: Record<string, any>;
|
|
@@ -148,8 +133,8 @@ import { Button, View } from '@ray-js/components';
|
|
|
148
133
|
|
|
149
134
|
const PlayerDemo = () => {
|
|
150
135
|
const [updateLayout, setUpdateLayout] = useState('');
|
|
151
|
-
const [state, setState] = useState({});
|
|
152
|
-
const [playerWidth, setPlayerWidth] = useState('200px');
|
|
136
|
+
const [state, setState] = useState({});
|
|
137
|
+
const [playerWidth, setPlayerWidth] = useState('200px');
|
|
153
138
|
/** onCtx usage
|
|
154
139
|
* playerCtx.ctx: The instance of ipc-player,includes preview, definition, mute, video, screenshot and other methods
|
|
155
140
|
* playerCtx.retry: retry
|