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

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/ui/ui.js CHANGED
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import "core-js/modules/esnext.iterator.constructor.js";
4
4
  import "core-js/modules/esnext.iterator.map.js";
5
5
  import React, { useContext, useState, useRef, useMemo, useEffect, useImperativeHandle } from 'react';
6
- import { View, CoverView, getSystemInfoSync, usePageEvent } from '@ray-js/ray';
6
+ import { View, CoverView, getSystemInfoSync, usePageEvent, setNavigationBarBack, setPageOrientation } from '@ray-js/ray';
7
7
  import clsx from 'clsx';
8
8
  import IPCPlayer from '@ray-js/ray-ipc-player';
9
9
  import { PlayState, PlayerStreamStatus } from '../interface';
@@ -74,7 +74,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
74
74
  这里用一个统一的状态标志期望控件是否展示
75
75
  */
76
76
  const [componentHideState, setComponentHideState] = useState(false);
77
- const [showRightContent, setShowRightContent] = useState(true);
78
77
  prevTriggerEvent.current = componentHideState ? hideAllComponent : showAllComponent;
79
78
  const eventRef = useRef(instance.event);
80
79
  if (eventRef.current !== instance.event) {
@@ -88,11 +87,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
88
87
  setBrandColor(brandColor);
89
88
  setVerticalMic(verticalMic);
90
89
  }, []);
91
- const refreshBottomLeft = value => {
90
+ const refreshBottomLeft = () => {
92
91
  event.current.emit(startTimeToHideAllComponent);
93
92
  event.current.emit(showAllComponent);
94
93
  event.current.emit(playerTap);
95
- setShowRightContent(value);
96
94
  };
97
95
 
98
96
  /**
@@ -154,6 +152,43 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
154
152
  mute: instance.mute
155
153
  });
156
154
 
155
+ // 监听物理返回按键
156
+ const hackHandle = () => {
157
+ setPageOrientation({
158
+ pageOrientation: 'portrait',
159
+ success: () => {
160
+ console.log('set success');
161
+ }
162
+ });
163
+ setScreenType('vertical');
164
+ };
165
+ useEffect(() => {
166
+ // 针对安卓使用系统按键导航
167
+ if (screenType === 'full') {
168
+ const {
169
+ platform
170
+ } = getSystemInfoSync();
171
+ if (platform !== 'ios') {
172
+ setNavigationBarBack({
173
+ type: 'custom'
174
+ });
175
+ }
176
+ } else {
177
+ setNavigationBarBack({
178
+ type: 'system'
179
+ });
180
+ }
181
+ }, [screenType]);
182
+ useEffect(() => {
183
+ ty.onNavigationBarBack(hackHandle);
184
+ return () => {
185
+ ty.offNavigationBarBack(hackHandle);
186
+ setNavigationBarBack({
187
+ type: 'system'
188
+ });
189
+ };
190
+ }, []);
191
+
157
192
  /**
158
193
  * 渲染随机定位播放器内容
159
194
  */
@@ -29,13 +29,11 @@ export function FullTravelRouteControl(props) {
29
29
  brandColor: props.brandColor
30
30
  });
31
31
  const timerRef = useRef();
32
- const [touching, setTouching] = useState(false);
33
32
  const [state, _, sendDp] = useDpState({
34
33
  devId: props.devId,
35
34
  dpCodes: [DIRECTION_CONTROL_DP_CODE],
36
35
  listenDpChange: true
37
36
  });
38
- console.log('touching', touching);
39
37
  const onPtzControlShow = useMemoizedFn(() => {
40
38
  setIsPtzActive(true);
41
39
  });
@@ -75,28 +73,24 @@ export function FullTravelRouteControl(props) {
75
73
  return /*#__PURE__*/React.createElement(View, {
76
74
  className: clsx('ipc-player-plugin-full-screen-voice', {
77
75
  'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive
78
- }),
79
- style: {
80
- width: touching ? '100vw' : 'auto',
81
- height: touching ? '100vh' : 'auto',
82
- backgroundColor: 'transparent'
83
- }
76
+ })
84
77
  }, /*#__PURE__*/React.createElement(RectDirectionControl, {
85
78
  className: "ipc-plugin-full-travel-route-control",
86
79
  value: 0,
87
80
  onTouchStart: value => {
88
- setTouching(true);
81
+ pauseTimeToHideAllComponentFn();
89
82
  sendDpValue(String(value));
83
+ ty.nativeDisabled(true);
90
84
  },
91
85
  onTouchMove: value => {
92
- setTouching(true);
93
86
  pauseTimeToHideAllComponentFn();
94
87
  sendDpValue(String(value));
88
+ ty.nativeDisabled(true);
95
89
  },
96
90
  onTouchEnd: () => {
97
91
  event.emit(startTimeToHideAllComponent);
98
- setTouching(false);
99
92
  sendDpValue('-1');
93
+ ty.nativeDisabled(false);
100
94
  },
101
95
  onMoveNonIntersection: () => {
102
96
  sendDpValue('-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-61",
3
+ "version": "0.0.1-beta-62",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [