@ray-js/ray-ipc-player 2.0.20-beta-3 → 2.0.20-beta-5

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.
Files changed (2) hide show
  1. package/lib/index.js +7 -29
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -130,7 +130,7 @@ const Player = props => {
130
130
  });
131
131
  // 先停流
132
132
  stopPreview();
133
- await getCurMute();
133
+ // await getCurMute();
134
134
  });
135
135
  useEffect(() => {
136
136
  onlineStatus && createIpcCtx();
@@ -220,7 +220,6 @@ const Player = props => {
220
220
  // 创建ipc实例
221
221
  const createIpcCtx = () => {
222
222
  console.log('创建ipc实例');
223
- console.log(onCtx, 'onCtx');
224
223
  onCtx && onCtx({
225
224
  ctx: ipcCtx.current,
226
225
  retry
@@ -273,6 +272,7 @@ const Player = props => {
273
272
  d.errorState = false;
274
273
  d.errorMsg = '';
275
274
  });
275
+ setMuted(muteRef.current);
276
276
  params && onInitPreview && onInitPreview(devId);
277
277
  onChangeStreamStatus && onChangeStreamStatus(1002);
278
278
  },
@@ -288,6 +288,7 @@ const Player = props => {
288
288
  d.errorState = false;
289
289
  d.errorMsg = '';
290
290
  });
291
+ setMuted(muteRef.current);
291
292
  onChangeStreamStatus && onChangeStreamStatus(1002);
292
293
  return;
293
294
  }
@@ -297,10 +298,6 @@ const Player = props => {
297
298
  d.errorMsg = Strings.getLang('ipc_player_preview_fail');
298
299
  });
299
300
  onChangeStreamStatus && onChangeStreamStatus(-1002);
300
- },
301
- complete: () => {
302
- // console.log('startPreview:', muteRef.current);
303
- setMuted(muteRef.current);
304
301
  }
305
302
  });
306
303
  };
@@ -311,14 +308,15 @@ const Player = props => {
311
308
  const stopPreview = () => {
312
309
  var _ipcCtx$current3;
313
310
  ipcTTTOperatorLog("VID: begin_to_stop_preview");
311
+ ipcTTTOperatorLog("VID: set_mute_is_true");
312
+ setMuted(true);
314
313
  (_ipcCtx$current3 = ipcCtx.current) === null || _ipcCtx$current3 === void 0 || _ipcCtx$current3.stopPreview({
315
314
  success: () => {
316
315
  ipcTTTOperatorLog("VID: stop_preview_success");
317
316
  },
318
317
  fail: e => {
319
318
  ipcTTTOperatorLog("VID: stop_preview_failure: ".concat(JSON.stringify(e)));
320
- },
321
- complete: () => setMuted(true)
319
+ }
322
320
  });
323
321
  };
324
322
 
@@ -342,25 +340,6 @@ const Player = props => {
342
340
  /**
343
341
  * 获取当前是否静音
344
342
  */
345
- const getCurMute = () => {
346
- ipcTTTOperatorLog("VID: begin_to_get_cur_mute");
347
- return new Promise((resolve, reject) => {
348
- var _ipcCtx$current5;
349
- (_ipcCtx$current5 = ipcCtx.current) === null || _ipcCtx$current5 === void 0 || _ipcCtx$current5.isMuted({
350
- success: res => {
351
- ipcTTTOperatorLog("VID: get_cur_mute_success: ".concat(res));
352
- muteRef.current = res;
353
- },
354
- fail: e => {
355
- ipcTTTOperatorLog("VID: get_cur_mute_failure: ".concat(JSON.stringify(e)));
356
- reject(e);
357
- },
358
- complete: d => {
359
- resolve(d);
360
- }
361
- });
362
- });
363
- };
364
343
 
365
344
  // 异常事件
366
345
  const onError = useCallback(e => {
@@ -475,7 +454,6 @@ const Player = props => {
475
454
  * 根据自定义类型获取错误码展示内容
476
455
  */
477
456
  const getErrorContentByType = useCallback((errCode, type) => {
478
- console.log('___dashdjhasjhdjsahdjshajhdjsa');
479
457
  const errContent = getErrCodeDetailDataByCode(String(errCode));
480
458
  const contentEmpty = _isEmpty(errContent);
481
459
  switch (type) {
@@ -605,7 +583,7 @@ const Player = props => {
605
583
  } = data === null || data === void 0 ? void 0 : data.detail;
606
584
  if (deviceId === devId) {
607
585
  setVideoErrCode(errCode);
608
- props.onCameraPreviewFailure && props.onCameraPreviewFailure(errCode);
586
+ props.onCameraPreviewFailure && onCameraPreviewFailure(errCode);
609
587
  }
610
588
  }
611
589
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-player",
3
- "version": "2.0.20-beta-3",
3
+ "version": "2.0.20-beta-5",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",