@ray-js/ipc-player-integration 0.0.18-beta-6 → 0.0.18-beta-8
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 +20 -2
- package/package.json +1 -1
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, setNavigationBarBack, setPageOrientation } from '@ray-js/ray';
|
|
6
|
+
import { View, CoverView, getSystemInfoSync, usePageEvent, setNavigationBarBack, setPageOrientation, getCurrentPages } from '@ray-js/ray';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import IPCPlayer from '@ray-js/ray-ipc-player';
|
|
9
9
|
import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
|
|
@@ -74,6 +74,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
74
74
|
} = instance;
|
|
75
75
|
const prevTriggerEvent = useRef();
|
|
76
76
|
const hasPlayedRef = useRef(false);
|
|
77
|
+
|
|
77
78
|
/*
|
|
78
79
|
player 的UI效果期望有一些控件在初始化的时候都展示,在点击 Player 之后隐藏:
|
|
79
80
|
在控件显示时,点击播放器期望隐藏控件
|
|
@@ -96,6 +97,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
96
97
|
// const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
|
|
97
98
|
// const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
98
99
|
|
|
100
|
+
const getPlayerRoute = () => {
|
|
101
|
+
const pages = getCurrentPages(); // 获取当前页面栈
|
|
102
|
+
const currentPage = pages[pages.length - 1]; // 获取当前页面实例
|
|
103
|
+
return currentPage.route;
|
|
104
|
+
};
|
|
99
105
|
const {
|
|
100
106
|
topLeftContent,
|
|
101
107
|
topRightContent,
|
|
@@ -205,11 +211,18 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
205
211
|
|
|
206
212
|
const handleOrientationChange = useMemoizedFn(data => {
|
|
207
213
|
console.log(data, 'data=====');
|
|
214
|
+
console.log(getPlayerRoute(), 'getPlayerRoute()');
|
|
215
|
+
if (getPlayerRoute() !== 'pages/home/index') {
|
|
216
|
+
// 不是首页的话,禁止以下行为
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
208
219
|
const {
|
|
209
220
|
orientation
|
|
210
221
|
} = data;
|
|
211
222
|
if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'].includes(orientation)) {
|
|
212
|
-
setScreenType(
|
|
223
|
+
// setScreenType(
|
|
224
|
+
// orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical'
|
|
225
|
+
// );
|
|
213
226
|
const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait';
|
|
214
227
|
|
|
215
228
|
// const { deviceType } = systemInfo.current;
|
|
@@ -253,6 +266,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
253
266
|
// if (typeof ty?.onOrientationChange === 'function') {
|
|
254
267
|
// return;
|
|
255
268
|
// }
|
|
269
|
+
console.log(getPlayerRoute(), 'getPlayerRoute()');
|
|
270
|
+
if (getPlayerRoute() !== 'pages/home/index') {
|
|
271
|
+
// 不是Player首页的话,禁止以下行为
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
256
274
|
try {
|
|
257
275
|
const {
|
|
258
276
|
type
|