@ray-js/ray-ipc-player 2.0.20-beta-12 → 2.0.20-beta-14

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
@@ -19,6 +19,7 @@ const Player = props => {
19
19
  const {
20
20
  updateLayout = '',
21
21
  devId = '',
22
+ objectFit = 'contain',
22
23
  onChangeStreamStatus,
23
24
  onPlayerTap,
24
25
  onZoomChange,
@@ -43,12 +44,12 @@ const Player = props => {
43
44
  borderWidth: 0
44
45
  },
45
46
  privateState = false,
46
- objectFit = 'contain',
47
47
  extend = {},
48
48
  brandColor = '#FF592A',
49
49
  renderErrIcon,
50
50
  isShare = false,
51
- onPlayerContainerTap
51
+ onPlayerContainerTap,
52
+ reConnect = false
52
53
  } = props;
53
54
  const {
54
55
  borderRadius,
@@ -147,6 +148,11 @@ const Player = props => {
147
148
  ipcCtx.current = null;
148
149
  };
149
150
  }, [devId, onlineStatus]);
151
+ useEffect(() => {
152
+ if (reConnect && devId && onlineStatus) {
153
+ _reConnect();
154
+ }
155
+ }, [reConnect]);
150
156
  useEffect(() => {
151
157
  muteRef.current = defaultMute;
152
158
  }, [defaultMute]);
@@ -196,6 +202,21 @@ const Player = props => {
196
202
  ipcCtx.current && createConnect();
197
203
  };
198
204
 
205
+ // 无需关心连接状态直接发起重新连接
206
+ const _reConnect = () => {
207
+ setPlayState(d => {
208
+ d.connectState = true;
209
+ d.errorMsg = '';
210
+ d.errorState = false;
211
+ d.loadingState = true;
212
+ });
213
+ setVideoErrCode('');
214
+ // !prePlayRef.current && connectState && (await disconnect());
215
+ // console.log(connectState, isOnPreview, '当前链接状态和预览状态');
216
+ ipcTTTOperatorLog("VID: start_create_p2p_connect");
217
+ ipcCtx.current && createConnect();
218
+ };
219
+
199
220
  /**
200
221
  * 关闭隐私模式,重新拉流
201
222
  */
@@ -573,7 +594,6 @@ const Player = props => {
573
594
  * 跳转反馈小程序
574
595
  */
575
596
 
576
- console.log(borderRadius, 'borderRadius=====');
577
597
  return /*#__PURE__*/React.createElement(View, {
578
598
  className: Styles.ipc_player,
579
599
  onClick: () => {
@@ -581,6 +601,7 @@ const Player = props => {
581
601
  }
582
602
  }, /*#__PURE__*/React.createElement(IpcPlayer, _extends({
583
603
  className: "".concat(Styles.player, " ").concat(playState.updateLy),
604
+ objectFit: objectFit,
584
605
  onVideoTap: handleVideoTap,
585
606
  onZoomChange: onZoomChange,
586
607
  onCameraPreviewFailure: data => {
@@ -633,7 +654,6 @@ const Player = props => {
633
654
  autoPauseIfNavigate: false,
634
655
  autoPauseIfOpenNative: false,
635
656
  muted: defaultMute,
636
- objectFit: objectFit,
637
657
  clarity: clarity,
638
658
  rotateZ: rotateZ,
639
659
  scalable: scalable,
@@ -66,6 +66,12 @@ export type IProps = {
66
66
  * @default (devId) => void
67
67
  */
68
68
  onPlayerTap?: (data) => void;
69
+ /**
70
+ * @description.en objectFit
71
+ * @description.zh 填充模式
72
+ * @default true
73
+ */
74
+ objectFit?: 'contain' | 'fillCrop';
69
75
  /**
70
76
  * @description.en scalable
71
77
  * @description.zh 是否可缩放
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-player",
3
- "version": "2.0.20-beta-12",
3
+ "version": "2.0.20-beta-14",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",