@ray-js/ray-ipc-player 2.0.15 → 2.0.17-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
@@ -43,6 +43,7 @@ var Player = function (props) {
43
43
  ptzControllable = _props$ptzControllabl === void 0 ? true : _props$ptzControllabl,
44
44
  _props$clarity = props.clarity,
45
45
  clarity = _props$clarity === void 0 ? 'normal' : _props$clarity,
46
+ ipcPlayerContext = props.ipcPlayerContext,
46
47
  onCtx = props.onCtx,
47
48
  _props$playerStyle = props.playerStyle,
48
49
  playerStyle = _props$playerStyle === void 0 ? {
@@ -83,6 +84,13 @@ var Player = function (props) {
83
84
 
84
85
  var ipcCtx = useRef(null); // ipc实例
85
86
 
87
+ if (!ipcCtx.current) {
88
+ var _ty;
89
+
90
+ // @ts-ignore
91
+ ipcCtx.current = ipcPlayerContext || ((_ty = ty) === null || _ty === void 0 ? void 0 : _ty.createIpcPlayerContext(devId));
92
+ }
93
+
86
94
  var retryCount = useRef(0); // 重试次数
87
95
 
88
96
  var muteRef = useRef(defaultMute); // 静音
@@ -125,7 +133,7 @@ var Player = function (props) {
125
133
  }, _callee2);
126
134
  })));
127
135
  useEffect(function () {
128
- onlineStatus && createIpcCtx(devId);
136
+ onlineStatus && createIpcCtx();
129
137
  return function () {
130
138
  disconnect();
131
139
  ipcCtx.current = null;
@@ -201,12 +209,7 @@ var Player = function (props) {
201
209
  !privateState && _retry();
202
210
  }, [playState.connectState, privateState]); // 创建ipc实例
203
211
 
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
-
212
+ var createIpcCtx = function () {
210
213
  onCtx && onCtx({
211
214
  ctx: ipcCtx.current,
212
215
  retry: retry
@@ -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 通知视频流状态发生变化
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.17-beta-beta-1",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",
@@ -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"