@ray-js/ipc-player-integration 0.0.1-beta-62 → 0.0.1-beta-63

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.
@@ -1,8 +1,11 @@
1
+ /// <reference types="react" />
1
2
  import { UseCtx } from '../../interface';
3
+ import { FullScreen } from '../../widgets/fullScreen';
2
4
  type Ctx = ReturnType<UseCtx>;
3
5
  export declare function initPlayerWidgets(ctx: Ctx, options: {
4
6
  verticalResolutionCustomClick?: boolean;
5
7
  hideHorizontalMenu?: boolean;
6
8
  throttleTime?: number;
9
+ directionControlProps?: Partial<React.ComponentProps<typeof FullScreen>['directionControlProps']>;
7
10
  }): Promise<void>;
8
11
  export {};
@@ -21,7 +21,8 @@ export async function initPlayerWidgets(ctx, options) {
21
21
  // @ts-ignore
22
22
  newDefaultBottomRightContent[fullScreenIndex].initProps = {
23
23
  hideHorizontalMenu: options.hideHorizontalMenu,
24
- throttleTime: options.throttleTime
24
+ throttleTime: options.throttleTime,
25
+ directionControlProps: options.directionControlProps
25
26
  };
26
27
  }
27
28
  ctx.addContent('bottomRight', newDefaultBottomRightContent);
@@ -5,6 +5,6 @@ import type { ComponentConfigProps } from '../../interface';
5
5
  type Props = ComponentConfigProps & {
6
6
  className?: string;
7
7
  hideHorizontalMenu?: boolean;
8
- } & Pick<FullTravelRouteControlProps, 'throttleTime'>;
8
+ } & Pick<FullTravelRouteControlProps, 'throttleTime' | 'directionControlProps'>;
9
9
  export declare function FullScreen(props: Props): React.JSX.Element | null;
10
10
  export {};
@@ -2,8 +2,12 @@
2
2
  * 全屏状态下要添加的摄像机行进路线控件
3
3
  */
4
4
  import React from 'react';
5
+ import RectDirectionControl from '@ray-js/direction-control';
5
6
  import type { ComponentConfigProps } from '../../interface';
7
+ type RectDirectionControlProps = React.ComponentProps<typeof RectDirectionControl>;
6
8
  export type FullTravelRouteControlProps = ComponentConfigProps & {
7
9
  throttleTime?: number;
10
+ directionControlProps?: Partial<RectDirectionControlProps>;
8
11
  };
9
12
  export declare function FullTravelRouteControl(props: FullTravelRouteControlProps): React.JSX.Element;
13
+ export {};
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  /**
2
3
  * 全屏状态下要添加的摄像机行进路线控件
3
4
  */
@@ -15,7 +16,8 @@ import { DIRECTION_CONTROL_DP_CODE } from './constant';
15
16
  import { useStore } from '../../ctx/store';
16
17
  export function FullTravelRouteControl(props) {
17
18
  const {
18
- throttleTime = 300
19
+ throttleTime = 300,
20
+ directionControlProps
19
21
  } = props;
20
22
  const [shouldHide] = useComponentHideState();
21
23
  const [isPtzActive, setIsPtzActive] = useState(false);
@@ -74,7 +76,7 @@ export function FullTravelRouteControl(props) {
74
76
  className: clsx('ipc-player-plugin-full-screen-voice', {
75
77
  'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive
76
78
  })
77
- }, /*#__PURE__*/React.createElement(RectDirectionControl, {
79
+ }, /*#__PURE__*/React.createElement(RectDirectionControl, _extends({
78
80
  className: "ipc-plugin-full-travel-route-control",
79
81
  value: 0,
80
82
  onTouchStart: value => {
@@ -98,5 +100,5 @@ export function FullTravelRouteControl(props) {
98
100
  showArcOnTouchInEdgeProximity: true,
99
101
  arcEdgeProximityColor: brandColor,
100
102
  touchDistanceThreshold: 50
101
- }));
103
+ }, directionControlProps)));
102
104
  }
@@ -1,5 +1,5 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { View } from '@ray-js/ray';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import { View, usePageEvent } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import { getVideoBitrateKbps } from '@ray-js/ray-ipc-utils';
5
5
  import { PlayState } from '../../interface';
@@ -15,20 +15,23 @@ export const VideoBitKBP = props => {
15
15
  const store = useStore({
16
16
  playState
17
17
  });
18
+ const timerRef = useRef();
18
19
  useEffect(() => {
19
- let timer;
20
20
  if (store.playState === PlayState.PLAYING) {
21
21
  init();
22
- timer = setInterval(() => {
22
+ timerRef.current = setInterval(() => {
23
23
  init();
24
24
  }, 3000);
25
25
  } else {
26
- clearInterval(timer);
26
+ clearInterval(timerRef.current);
27
27
  }
28
28
  return () => {
29
- clearInterval(timer);
29
+ clearInterval(timerRef.current);
30
30
  };
31
31
  }, [store.playState]);
32
+ usePageEvent('onUnload', () => {
33
+ clearInterval(timerRef.current);
34
+ });
32
35
  const init = async () => {
33
36
  const res = await getVideoBitrateKbps(devId);
34
37
  if (res.code !== -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-62",
3
+ "version": "0.0.1-beta-63",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -32,7 +32,7 @@
32
32
  "test": "yarn jest"
33
33
  },
34
34
  "peerDependencies": {
35
- "@ray-js/direction-control": "0.0.7-beta-3",
35
+ "@ray-js/direction-control": "0.0.7-beta-7",
36
36
  "ahooks": "^3.1.6"
37
37
  },
38
38
  "dependencies": {
@@ -48,7 +48,7 @@
48
48
  "@commitlint/cli": "^7.2.1",
49
49
  "@commitlint/config-conventional": "^9.0.1",
50
50
  "@ray-js/cli": "^1.4.9",
51
- "@ray-js/direction-control": "0.0.7-beta-5",
51
+ "@ray-js/direction-control": "0.0.7-beta-7",
52
52
  "@ray-js/ray": "^1.4.9",
53
53
  "@testing-library/react-hooks": "^8.0.1",
54
54
  "@types/jest": "^29.5.14",