@ray-js/ipc-player-integration 0.0.13-beta-1 → 0.0.13-beta-2

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/ctx/ctx.js CHANGED
@@ -225,7 +225,12 @@ export const createUseCtx = _ref => {
225
225
  setPtzControlTipDisabled,
226
226
  setBrandColor,
227
227
  setVerticalMic,
228
- setIntercom: async target => {
228
+ setIntercom: async function (target) {
229
+ let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
230
+ if (onlyUpdateAtom) {
231
+ updateAtom(intercom, target);
232
+ return false;
233
+ }
229
234
  const store = getDefaultStore();
230
235
  const _intercom = store.get(intercom);
231
236
  if (target && target === _intercom) {
@@ -319,7 +324,12 @@ export const createUseCtx = _ref => {
319
324
  setMute: _setMute,
320
325
  setResolution: _setResolution,
321
326
  setResolutionList,
322
- setRecording: async target => {
327
+ setRecording: async function (target) {
328
+ let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
329
+ if (onlyUpdateAtom) {
330
+ updateAtom(recording, target);
331
+ return false;
332
+ }
323
333
  const store = getDefaultStore();
324
334
  const _recording = store.get(recording);
325
335
  if (target && target === _recording) {
@@ -73,8 +73,8 @@ export type UseCtx = (options: {
73
73
  setRecordingDisabled: (type: boolean) => void;
74
74
  setResolution: (type: string) => void;
75
75
  setResolutionList: (type: string[]) => void;
76
- setRecording: (value: boolean) => Promise<RecordInfoData>;
77
- setIntercom: (value: boolean) => Promise<boolean>;
76
+ setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<RecordInfoData>;
77
+ setIntercom: (value: boolean, onlyUpdateAtom?: boolean) => Promise<boolean>;
78
78
  setMute: (value: boolean) => Promise<boolean>;
79
79
  changeStreamStatus: (value: PlayerStreamStatus) => void;
80
80
  getStreamStatus: () => PlayerStreamStatus;
package/lib/ui/ui.js CHANGED
@@ -6,6 +6,7 @@ import React, { useContext, useState, useRef, useMemo, useEffect, useImperativeH
6
6
  import { View, CoverView, getSystemInfoSync, usePageEvent, setNavigationBarBack, setPageOrientation } from '@ray-js/ray';
7
7
  import clsx from 'clsx';
8
8
  import IPCPlayer from '@ray-js/ray-ipc-player';
9
+ import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
9
10
  import { PlayState, PlayerStreamStatus } from '../interface';
10
11
  import { useCtx } from '../ctx/ctx.composition';
11
12
  import { useStore } from '../ctx/store';
@@ -19,8 +20,8 @@ import { useMemoizedFn } from '../hooks';
19
20
  import './ui.less';
20
21
  function getCtxInstance(instance, devId) {
21
22
  if (instance) return instance;
23
+ // eslint-disable-next-line react-hooks/rules-of-hooks
22
24
  return useCtx({
23
- // eslint-disable-line
24
25
  devId
25
26
  });
26
27
  }
@@ -67,7 +68,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
67
68
  setPlayState,
68
69
  setScreenType,
69
70
  setBrandColor,
70
- setVerticalMic
71
+ setVerticalMic,
72
+ setIntercom
71
73
  } = instance;
72
74
  const prevTriggerEvent = useRef();
73
75
  /*
@@ -166,6 +168,34 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
166
168
  console.log(err, 'err');
167
169
  }
168
170
  }));
171
+
172
+ /**
173
+ * 监听退出此player
174
+ */
175
+ usePageEvent('onHide', () => {
176
+ console.log(instance === null || instance === void 0 ? void 0 : instance.IPCPlayerInstance, 'instance?.IPCPlayerInstance ===');
177
+ ipcTTTOperatorLog('hide: 调用停止录制方法');
178
+ setRecording(false, true);
179
+ setIntercom(false, true);
180
+ instance === null || instance === void 0 || instance.IPCPlayerInstance.stopRecord({
181
+ saveToAlbum: 1,
182
+ success: () => {
183
+ ipcTTTOperatorLog('hide: 调用停止录制方法成功');
184
+ },
185
+ fail: () => {
186
+ ipcTTTOperatorLog('hide: 调用停止录制方法失败');
187
+ }
188
+ });
189
+ ipcTTTOperatorLog('hide: 调用停止对讲方法');
190
+ instance === null || instance === void 0 || instance.IPCPlayerInstance.stopTalk({
191
+ success: () => {
192
+ ipcTTTOperatorLog('hide: 调用停止对讲成功');
193
+ },
194
+ fail: () => {
195
+ ipcTTTOperatorLog('hide: 调用停止对讲失败');
196
+ }
197
+ });
198
+ });
169
199
  const systemInfo = useRef(null);
170
200
  if (!systemInfo.current) {
171
201
  systemInfo.current = getSystemInfoSync();
@@ -30,8 +30,8 @@ export declare const Battery: import("react").FunctionComponent<{
30
30
  setRecordingDisabled: (type: boolean) => void;
31
31
  setResolution: (type: string) => void;
32
32
  setResolutionList: (type: string[]) => void;
33
- setRecording: (value: boolean) => Promise<import("../..").RecordInfoData>;
34
- setIntercom: (value: boolean) => Promise<boolean>;
33
+ setRecording: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<import("../..").RecordInfoData>;
34
+ setIntercom: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<boolean>;
35
35
  setMute: (value: boolean) => Promise<boolean>;
36
36
  changeStreamStatus: (value: import("../..").PlayerStreamStatus) => void;
37
37
  getStreamStatus: () => import("../..").PlayerStreamStatus;
@@ -77,8 +77,8 @@ export declare const BatteryFull: import("react").FunctionComponent<{
77
77
  setRecordingDisabled: (type: boolean) => void;
78
78
  setResolution: (type: string) => void;
79
79
  setResolutionList: (type: string[]) => void;
80
- setRecording: (value: boolean) => Promise<import("../..").RecordInfoData>;
81
- setIntercom: (value: boolean) => Promise<boolean>;
80
+ setRecording: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<import("../..").RecordInfoData>;
81
+ setIntercom: (value: boolean, onlyUpdateAtom?: boolean | undefined) => Promise<boolean>;
82
82
  setMute: (value: boolean) => Promise<boolean>;
83
83
  changeStreamStatus: (value: import("../..").PlayerStreamStatus) => void;
84
84
  getStreamStatus: () => import("../..").PlayerStreamStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.13-beta-1",
3
+ "version": "0.0.13-beta-2",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -39,7 +39,7 @@
39
39
  "@ray-js/panel-sdk": "^1.13.1",
40
40
  "@ray-js/direction-control": "^0.0.8",
41
41
  "@ray-js/ray-ipc-player": "2.0.23",
42
- "@ray-js/ray-ipc-utils": "1.1.8",
42
+ "@ray-js/ray-ipc-utils": "^1.1.10",
43
43
  "@ray-js/svg": "0.2.0",
44
44
  "clsx": "^1.2.1",
45
45
  "jotai": "^2.10.2"