@ray-js/ipc-player-integration 0.0.22 → 0.0.23

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
@@ -251,8 +251,7 @@ export const createUseCtx = _ref => {
251
251
  ty.authorizeStatus({
252
252
  // 麦克风权限
253
253
  scope: 'scope.record',
254
- success: success => {
255
- console.log(success, 'success');
254
+ success: () => {
256
255
  eventRef.current.emit(changeIgnoreHideStopPreview, false);
257
256
  IPCPlayerInstance.current.startTalk({
258
257
  success: () => {
@@ -271,20 +270,18 @@ export const createUseCtx = _ref => {
271
270
  });
272
271
  },
273
272
  fail: () => {
274
- console.log('失败回调');
273
+ console.log('authorizeStatus失败回调');
275
274
  ty.authorize({
276
275
  // 麦克风权限
277
276
  scope: 'scope.record',
278
277
  success: () => {
279
- console.log('我不知道你是个什么玩意');
278
+ console.log('authorize成功回调');
280
279
  IPCPlayerInstance.current.startTalk({
281
280
  success: () => {
282
- // eventRef.current.emit(changeIgnoreHideStopPreview, false);
283
281
  updateAtom(intercom, true);
284
282
  resolve(true);
285
283
  },
286
284
  fail: err => {
287
- // eventRef.current.emit(changeIgnoreHideStopPreview, false);
288
285
  const errObj = err.innerError || err || {};
289
286
  const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_intercom');
290
287
  toast({
@@ -295,8 +292,6 @@ export const createUseCtx = _ref => {
295
292
  });
296
293
  },
297
294
  fail: err => {
298
- console.log('我不知道你是说什么');
299
- // eventRef.current.emit(changeIgnoreHideStopPreview, false);
300
295
  showModal({
301
296
  title: '',
302
297
  content: Strings.getLang('ipc_player_no_record_permission'),
@@ -352,6 +347,7 @@ export const createUseCtx = _ref => {
352
347
  toast({
353
348
  title: Strings.getLang('ipc_player_recording_now_tip')
354
349
  });
350
+ eventRef.current.emit(changeIgnoreHideStopPreview, false);
355
351
  return false;
356
352
  }
357
353
  return new Promise((resolve, reject) => {
@@ -360,6 +356,7 @@ export const createUseCtx = _ref => {
360
356
  ty.authorizeStatus({
361
357
  scope: 'scope.writePhotosAlbum',
362
358
  success: () => {
359
+ eventRef.current.emit(changeIgnoreHideStopPreview, false);
363
360
  IPCPlayerInstance.current.startRecord({
364
361
  saveToAlbum,
365
362
  success: () => {
@@ -367,6 +364,7 @@ export const createUseCtx = _ref => {
367
364
  resolve(true);
368
365
  },
369
366
  fail: err => {
367
+ eventRef.current.emit(changeIgnoreHideStopPreview, false);
370
368
  reject(err);
371
369
  }
372
370
  });
@@ -1,12 +1,12 @@
1
1
  import React, { useState, useEffect, useRef, useContext } from 'react';
2
- import { View, Text, Image } from '@ray-js/ray';
2
+ import { View, Text, Image, getSystemInfoSync } from '@ray-js/ray';
3
3
  import { useSetState, useUpdateEffect } from 'ahooks';
4
4
  import clsx from 'clsx';
5
5
  import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
6
6
  import Strings from '../../i18n';
7
7
  import { PlayState } from '../../interface';
8
8
  import { UIEventContext } from '../../ui/context';
9
- import { pauseTimeToHideAllComponent } from '../../ui/constant';
9
+ import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview } from '../../ui/constant';
10
10
  import { useStore, getDefaultStore } from '../../ctx/store';
11
11
  import './recordVideo.less';
12
12
  const CLOSE_TIME = 5000;
@@ -242,6 +242,13 @@ export function RecordVideo(props) {
242
242
  showShot: false
243
243
  });
244
244
  }
245
+ // 发送忽略进入后台停止预览的标记
246
+ const {
247
+ platform
248
+ } = getSystemInfoSync();
249
+ if (platform === 'ios') {
250
+ props.event ? props === null || props === void 0 ? void 0 : props.event.emit(changeIgnoreHideStopPreview, true) : event === null || event === void 0 ? void 0 : event.emit(changeIgnoreHideStopPreview, true);
251
+ }
245
252
  try {
246
253
  const recordInfo = await setRecording(target);
247
254
  if (target) {
@@ -1,12 +1,12 @@
1
1
  import React, { useContext, useRef } from 'react';
2
- import { View, Image, Text, showModal, openAppSystemSettingPage } from '@ray-js/ray';
2
+ import { View, Image, Text, showModal, openAppSystemSettingPage, getSystemInfoSync } from '@ray-js/ray';
3
3
  import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
4
4
  import clsx from 'clsx';
5
5
  import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
6
6
  import Strings from '../../i18n';
7
7
  import { useStore } from '../../ctx/store';
8
8
  import { UIEventContext } from '../../ui/context';
9
- import { pauseTimeToHideAllComponent } from '../../ui/constant';
9
+ import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview } from '../../ui/constant';
10
10
  import './screenshot.less';
11
11
  const CLOSE_TIME = 5000;
12
12
  export function Screenshot(props) {
@@ -106,11 +106,18 @@ export function Screenshot(props) {
106
106
  setState({
107
107
  showShot: false
108
108
  });
109
+ const {
110
+ platform
111
+ } = getSystemInfoSync();
112
+ if (platform === 'ios') {
113
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
114
+ }
109
115
  event.emit(pauseTimeToHideAllComponent);
110
116
  ty.authorizeStatus({
111
117
  // 相册写入权限
112
118
  scope: 'scope.writePhotosAlbum',
113
119
  success: () => {
120
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, false);
114
121
  IPCPlayerContext.snapshot({
115
122
  saveToAlbum,
116
123
  // 保存到 IPC 相册
@@ -122,6 +129,7 @@ export function Screenshot(props) {
122
129
  });
123
130
  },
124
131
  fail: err => {
132
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, false);
125
133
  console.log(err, 'err');
126
134
  const errObj = err.innerError || err || {};
127
135
  const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
@@ -64,7 +64,7 @@ export const VoiceIntercom = props => {
64
64
  platform
65
65
  } = getSystemInfoSync();
66
66
  if (platform === 'ios') {
67
- event.emit(changeIgnoreHideStopPreview, true);
67
+ props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
68
68
  }
69
69
  console.log('==== 开始对讲 =====');
70
70
  originMuteStatusBeforeVoice.current = _mute;
@@ -72,9 +72,6 @@ export const VoiceIntercom = props => {
72
72
  await setIntercom(true);
73
73
  } catch (e) {
74
74
  console.error('setIntercom failed:', e);
75
- } finally {
76
- // 无论对讲成功与否,都取消忽略进入后台停止预览的标记, 但是会
77
- // event.emit(changeIgnoreHideStopPreview, false);
78
75
  }
79
76
  // 确定对讲有成功回调后,单向对讲判断开始对讲前需要静音
80
77
  // 确定对讲有成功回调后, 双路对讲开始对讲前需要打开拾音器
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [