@ray-js/ray-ipc-player 2.0.20-beta-13 → 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,
@@ -47,7 +48,8 @@ const Player = props => {
47
48
  brandColor = '#FF592A',
48
49
  renderErrIcon,
49
50
  isShare = false,
50
- onPlayerContainerTap
51
+ onPlayerContainerTap,
52
+ reConnect = false
51
53
  } = props;
52
54
  const {
53
55
  borderRadius,
@@ -146,6 +148,11 @@ const Player = props => {
146
148
  ipcCtx.current = null;
147
149
  };
148
150
  }, [devId, onlineStatus]);
151
+ useEffect(() => {
152
+ if (reConnect && devId && onlineStatus) {
153
+ _reConnect();
154
+ }
155
+ }, [reConnect]);
149
156
  useEffect(() => {
150
157
  muteRef.current = defaultMute;
151
158
  }, [defaultMute]);
@@ -195,6 +202,21 @@ const Player = props => {
195
202
  ipcCtx.current && createConnect();
196
203
  };
197
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
+
198
220
  /**
199
221
  * 关闭隐私模式,重新拉流
200
222
  */
@@ -572,7 +594,6 @@ const Player = props => {
572
594
  * 跳转反馈小程序
573
595
  */
574
596
 
575
- console.log(borderRadius, 'borderRadius=====');
576
597
  return /*#__PURE__*/React.createElement(View, {
577
598
  className: Styles.ipc_player,
578
599
  onClick: () => {
@@ -580,6 +601,7 @@ const Player = props => {
580
601
  }
581
602
  }, /*#__PURE__*/React.createElement(IpcPlayer, _extends({
582
603
  className: "".concat(Styles.player, " ").concat(playState.updateLy),
604
+ objectFit: objectFit,
583
605
  onVideoTap: handleVideoTap,
584
606
  onZoomChange: onZoomChange,
585
607
  onCameraPreviewFailure: data => {
@@ -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-13",
3
+ "version": "2.0.20-beta-14",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",