@ray-js/ipc-player-integration 0.0.1-beta-57 → 0.0.1-beta-58

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.
@@ -2,6 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { View, Text } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import React, { useEffect, useState, useContext } from 'react';
5
+ import { useMemoizedFn } from 'ahooks';
5
6
  import { UIEventContext } from '../../ui/context';
6
7
  import { usePtz } from '../../hooks';
7
8
  import { useStore } from '../../ctx/store';
@@ -14,6 +15,7 @@ export const Ptz = props => {
14
15
  screenType: screenTypeAtom,
15
16
  addContent,
16
17
  deleteContent,
18
+ hasContent,
17
19
  showContent,
18
20
  hideContent,
19
21
  className,
@@ -37,14 +39,12 @@ export const Ptz = props => {
37
39
  setIsPtzActive(false);
38
40
  }
39
41
  }, [screenType]);
40
- if (screenType === 'vertical' || !supportPtz) {
41
- return null;
42
- }
43
- return /*#__PURE__*/React.createElement(View, {
44
- className: clsx(className),
45
- onClick: () => {
46
- if (!isPtzActive) {
47
- showContent('bottomLeft', 'FullSmallIntercom');
42
+ const onPtz = useMemoizedFn(() => {
43
+ console.log(isPtzActive, 'isPtzActive');
44
+ console.log(hasContent('absolute', ptzControlId), 'hasContent');
45
+ if (!isPtzActive) {
46
+ showContent('bottomLeft', 'FullSmallIntercom');
47
+ if (!hasContent('absolute', ptzControlId)) {
48
48
  // 添加ptz空间
49
49
  addContent('absolute', {
50
50
  id: ptzControlId,
@@ -54,14 +54,23 @@ export const Ptz = props => {
54
54
  absoluteContentClassName: 'ipc-player-plugin-full-screen-ptz-control-wrap',
55
55
  initProps: _objectSpread({}, props)
56
56
  });
57
- event.emit('ptzControlShow');
58
57
  } else {
59
- // deleteContent('absolute', ptzControlId);
60
- hideContent('bottomLeft', 'FullSmallIntercom');
61
- event.emit('ptzControlHide');
58
+ console.log('ptzControlShow ===========');
59
+ event.emit('ptzControlShow');
62
60
  }
63
- setIsPtzActive(!isPtzActive);
61
+ } else {
62
+ // deleteContent('absolute', ptzControlId);
63
+ hideContent('bottomLeft', 'FullSmallIntercom');
64
+ event.emit('ptzControlHide');
64
65
  }
66
+ setIsPtzActive(!isPtzActive);
67
+ });
68
+ if (screenType === 'vertical' || !supportPtz) {
69
+ return null;
70
+ }
71
+ return /*#__PURE__*/React.createElement(View, {
72
+ className: clsx(className),
73
+ onClick: onPtz
65
74
  }, /*#__PURE__*/React.createElement(Text, {
66
75
  className: clsx('icon-panel', 'icon-panel-ptz', 'ipc-player-plugin-ptz-text-icon'),
67
76
  style: _objectSpread({}, isPtzActive && {
@@ -18,7 +18,7 @@
18
18
  bottom: 32px;
19
19
  // transform: translate(0, -20%);
20
20
  right: calc(32px * var(--ipc-player-size-scale, 1));;
21
- z-index: 200;
21
+ z-index: 348;
22
22
  }
23
23
 
24
24
 
@@ -56,10 +56,15 @@ export const PtzControl = props => {
56
56
  const onPtzControlHide = useMemoizedFn(() => {
57
57
  setIsPtzActive(false);
58
58
  });
59
+ const onPtzControlShow = useMemoizedFn(() => {
60
+ setIsPtzActive(true);
61
+ });
59
62
  useEffect(() => {
60
63
  event.on('ptzControlHide', onPtzControlHide);
64
+ event.on('ptzControlShow', onPtzControlShow);
61
65
  return () => {
62
66
  event.off('ptzControlHide', onPtzControlHide);
67
+ event.off('ptzControlShow', onPtzControlShow);
63
68
  };
64
69
  }, []);
65
70
  useEffect(() => {
@@ -72,7 +77,7 @@ export const PtzControl = props => {
72
77
  }, []);
73
78
  return /*#__PURE__*/React.createElement(CoverView, {
74
79
  className: clsx('ipc-player-plugin-full-screen-ptz-control', {
75
- 'ipc-player-plugin-full-screen-ptz-control-hide': shouldHide || !isPtzActive,
80
+ 'ipc-player-plugin-full-screen-ptz-control-hide': !isPtzActive || shouldHide,
76
81
  'ipc-player-plugin-full-screen-ptz-disappear': screenType === 'vertical'
77
82
  })
78
83
  }, /*#__PURE__*/React.createElement(IpcPtzZoom, {
@@ -48,7 +48,7 @@
48
48
  justify-content: center;
49
49
  align-items: center;
50
50
  background-color: transparent;
51
- z-index: 345;
51
+ z-index: 349;
52
52
  }
53
53
 
54
54
  @keyframes ipc-player-plugin-full-resolution-control-move-in {
@@ -21,7 +21,9 @@ export const VideoBitKBP = props => {
21
21
  init();
22
22
  timer = setInterval(() => {
23
23
  init();
24
- }, 5000);
24
+ }, 3000);
25
+ } else {
26
+ clearInterval(timer);
25
27
  }
26
28
  return () => {
27
29
  clearInterval(timer);
@@ -33,7 +35,7 @@ export const VideoBitKBP = props => {
33
35
  setBitKBP(`${res.data.kbps}KB/S`);
34
36
  }
35
37
  };
36
- if (bitKBP === '') {
38
+ if (bitKBP === '' || bitKBP === '0KB/S' || store.playState !== PlayState.PLAYING) {
37
39
  return null;
38
40
  }
39
41
  return /*#__PURE__*/React.createElement(View, {
@@ -77,7 +77,6 @@ export const VoiceIntercom = props => {
77
77
  */
78
78
  useEffect(() => {
79
79
  (async () => {
80
- console.log('=== 开始结束对讲 ====', intercom);
81
80
  if (playState !== PlayState.PLAYING) {
82
81
  if (intercom) {
83
82
  updateAtom(props.intercom, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-57",
3
+ "version": "0.0.1-beta-58",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [