@ray-js/ray-ipc-player 2.0.15 → 2.0.18-beta-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/lib/index.js CHANGED
@@ -26,6 +26,10 @@ var Player = function (props) {
26
26
  devId = _props$devId === void 0 ? '' : _props$devId,
27
27
  onChangeStreamStatus = props.onChangeStreamStatus,
28
28
  onPlayerTap = props.onPlayerTap,
29
+ onZoomChange = props.onZoomChange,
30
+ onSessionDidDisconnected = props.onSessionDidDisconnected,
31
+ onCameraPreviewFailure = props.onCameraPreviewFailure,
32
+ onCameraNotifyWeakNetwork = props.onCameraNotifyWeakNetwork,
29
33
  onInitPreview = props.onInitPreview,
30
34
  _props$defaultMute = props.defaultMute,
31
35
  defaultMute = _props$defaultMute === void 0 ? true : _props$defaultMute,
@@ -43,6 +47,7 @@ var Player = function (props) {
43
47
  ptzControllable = _props$ptzControllabl === void 0 ? true : _props$ptzControllabl,
44
48
  _props$clarity = props.clarity,
45
49
  clarity = _props$clarity === void 0 ? 'normal' : _props$clarity,
50
+ ipcPlayerContext = props.ipcPlayerContext,
46
51
  onCtx = props.onCtx,
47
52
  _props$playerStyle = props.playerStyle,
48
53
  playerStyle = _props$playerStyle === void 0 ? {
@@ -83,6 +88,13 @@ var Player = function (props) {
83
88
 
84
89
  var ipcCtx = useRef(null); // ipc实例
85
90
 
91
+ if (!ipcCtx.current) {
92
+ var _ty;
93
+
94
+ // @ts-ignore
95
+ ipcCtx.current = ipcPlayerContext || ((_ty = ty) === null || _ty === void 0 ? void 0 : _ty.createIpcPlayerContext(devId));
96
+ }
97
+
86
98
  var retryCount = useRef(0); // 重试次数
87
99
 
88
100
  var muteRef = useRef(defaultMute); // 静音
@@ -125,7 +137,7 @@ var Player = function (props) {
125
137
  }, _callee2);
126
138
  })));
127
139
  useEffect(function () {
128
- onlineStatus && createIpcCtx(devId);
140
+ onlineStatus && createIpcCtx();
129
141
  return function () {
130
142
  disconnect();
131
143
  ipcCtx.current = null;
@@ -201,12 +213,7 @@ var Player = function (props) {
201
213
  !privateState && _retry();
202
214
  }, [playState.connectState, privateState]); // 创建ipc实例
203
215
 
204
- var createIpcCtx = function (id) {
205
- var _ty;
206
-
207
- // @ts-ignore
208
- ipcCtx.current = (_ty = ty) === null || _ty === void 0 ? void 0 : _ty.createIpcPlayerContext(id); // console.log('创建实例:', devId);
209
-
216
+ var createIpcCtx = function () {
210
217
  onCtx && onCtx({
211
218
  ctx: ipcCtx.current,
212
219
  retry: retry
@@ -464,6 +471,11 @@ var Player = function (props) {
464
471
  , _extends({
465
472
  className: "".concat(Styles.player, " ").concat(playState.updateLy),
466
473
  onVideotap: handlePlayerClick,
474
+ onVideoTap: handlePlayerClick,
475
+ onZoomChange: onZoomChange,
476
+ onSessionDidDisconnected: onSessionDidDisconnected,
477
+ onCameraPreviewFailure: onCameraPreviewFailure,
478
+ onCameraNotifyWeakNetwork: onCameraNotifyWeakNetwork,
467
479
  onInitdone: function initdone() {
468
480
  // console.log('视图层准备就绪:', devId);
469
481
  setPlayState(function (d) {
@@ -13,10 +13,10 @@ export type IProps = {
13
13
  */
14
14
  devId: string;
15
15
  /**
16
- * @description.en onlineStatus
17
- * @description.zh 设备是否在线
18
- * @default true
19
- */
16
+ * @description.en onlineStatus
17
+ * @description.zh 设备是否在线
18
+ * @default true
19
+ */
20
20
  onlineStatus: boolean;
21
21
  /**
22
22
  * @description.en privateState
@@ -31,10 +31,10 @@ export type IProps = {
31
31
  */
32
32
  defaultMute?: boolean;
33
33
  /**
34
- * @description.en clarity
35
- * @description.zh 清晰度 normal:标清,hd:高清
36
- * @default "normal"
37
- */
34
+ * @description.en clarity
35
+ * @description.zh 清晰度 normal:标清,hd:高清
36
+ * @default "normal"
37
+ */
38
38
  clarity?: 'normal' | 'hd';
39
39
  /**
40
40
  * @description.en updateLayout
@@ -42,6 +42,12 @@ export type IProps = {
42
42
  * @default ""
43
43
  */
44
44
  updateLayout?: any;
45
+ /**
46
+ * @description.en IPC Player instance. If not passed, an instance will be generated inside the component.
47
+ * @description.zh IPC Player实例,如果不传组件内部会生成实例
48
+ * @default ""
49
+ */
50
+ ipcPlayerContext?: IpcContext;
45
51
  /**
46
52
  * @description.en onChangeStreamStatus
47
53
  * @description.zh 通知视频流状态发生变化
@@ -49,10 +55,10 @@ export type IProps = {
49
55
  */
50
56
  onChangeStreamStatus?: (data) => void;
51
57
  /**
52
- * @description.en onCtx
53
- * @description.zh 获取ipcPlayer实例ctx以及重试方法retry
54
- * @default (playerRef) => void
55
- */
58
+ * @description.en onCtx
59
+ * @description.zh 获取ipcPlayer实例ctx以及重试方法retry
60
+ * @default (playerRef) => void
61
+ */
56
62
  onCtx?: (playerRef) => void;
57
63
  /**
58
64
  * @description.en onInitPreview
@@ -66,6 +72,26 @@ export type IProps = {
66
72
  * @default (devId) => void
67
73
  */
68
74
  onPlayerTap?: (data) => void;
75
+ /**
76
+ * @description.en onZoomchange
77
+ * @description.zh 视频缩放比例及当前倍数变化,detail = { zoomLevel }, zoomLevel 为缩放比例
78
+ */
79
+ onZoomChange?: (data) => void;
80
+ /**
81
+ * @description.en onSessionDidDisconnected
82
+ * @description.zh 事件:session断开事件
83
+ */
84
+ onSessionDidDisconnected?: (data) => void;
85
+ /**
86
+ * @description.en onCameraPreviewFailure
87
+ * @description.zh 事件:预览失败,错误码监听事件
88
+ */
89
+ onCameraPreviewFailure?: (data) => void;
90
+ /**
91
+ * @description.en onCameraNotifyWeakNetwork
92
+ * @description.zh 事件:画面网速监听状态值事件
93
+ */
94
+ onCameraNotifyWeakNetwork?: (data) => void;
69
95
  /**
70
96
  * @description.en scalable
71
97
  * @description.zh 是否可缩放
@@ -73,10 +99,10 @@ export type IProps = {
73
99
  */
74
100
  scalable?: boolean;
75
101
  /**
76
- * @description.en scaleMultiple
77
- * @description.zh 缩放比例
78
- * @default 0
79
- */
102
+ * @description.en scaleMultiple
103
+ * @description.zh 缩放比例
104
+ * @default 0
105
+ */
80
106
  scaleMultiple?: number;
81
107
  /**
82
108
  * @description.en rotateZ
@@ -113,7 +139,7 @@ export type IProps = {
113
139
  * @description.zh 填充模式设置:contain: 图像长边填满屏幕,短边区域会被填充⿊⾊, fillCrop: 图像铺满屏幕
114
140
  * @default "contain"
115
141
  */
116
- objectFit?: string;
142
+ objectFit?: string;
117
143
  /**
118
144
  * @description.en extend
119
145
  * @description.zh 扩展属性
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-player",
3
- "version": "2.0.15",
3
+ "version": "2.0.18-beta-beta-1",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",
@@ -26,16 +26,16 @@
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
28
  "@ray-js/panel-sdk": "latest",
29
+ "classnames": "^2.3.1",
29
30
  "immer": "^9.0.15",
30
- "use-immer": "^0.5.1",
31
- "classnames": "^2.3.1"
31
+ "use-immer": "^0.5.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@ray-js/ray": "latest",
35
34
  "@commitlint/cli": "^7.2.1",
36
35
  "@commitlint/config-conventional": "^9.0.1",
37
36
  "@ray-js/babel-preset-standard": "latest",
38
37
  "@ray-js/cli": "latest",
38
+ "@ray-js/ray": "1.5.44-beta.0",
39
39
  "@ray-js/rn-transformer-helper": "latest",
40
40
  "@ray-js/types": "latest",
41
41
  "@types/node": "^17.0.43",
@@ -45,6 +45,12 @@
45
45
  "lint-staged": "^10.2.11",
46
46
  "standard-version": "9.3.2"
47
47
  },
48
+ "resolutions": {
49
+ "follow-redirects": "1.15.6",
50
+ "shell-quote": "1.7.3",
51
+ "@babel/traverse": "7.23.2",
52
+ "decode-uri-component": "0.2.1"
53
+ },
48
54
  "husky": {
49
55
  "hooks": {
50
56
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS --config commitlint.config.js"