@ray-js/ipc-player-integration 0.0.18-beta-6 → 0.0.18-beta-7
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 +17 -1
- 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,6 +211,11 @@ 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;
|
|
@@ -253,6 +264,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
253
264
|
// if (typeof ty?.onOrientationChange === 'function') {
|
|
254
265
|
// return;
|
|
255
266
|
// }
|
|
267
|
+
console.log(getPlayerRoute(), 'getPlayerRoute()');
|
|
268
|
+
if (getPlayerRoute() !== 'pages/home/index') {
|
|
269
|
+
// 不是Player首页的话,禁止以下行为
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
256
272
|
try {
|
|
257
273
|
const {
|
|
258
274
|
type
|