diff --git a/src/ControllerTypes.ts b/src/ControllerTypes.ts index 4d808d8..ad765af 100644 --- a/src/ControllerTypes.ts +++ b/src/ControllerTypes.ts @@ -12,4 +12,12 @@ export type ControllerViewProps = { onFull?: () => void; title?: string; onBack?: () => void; + /** + * 是否隐藏返回按钮 + */ + isHiddenBack?: boolean; + /** + * 是否隐藏全屏返回按钮 + */ + isHiddenFullBack?: boolean; }; diff --git a/src/ControllerView.tsx b/src/ControllerView.tsx index 55299b0..c2a6a4f 100644 --- a/src/ControllerView.tsx +++ b/src/ControllerView.tsx @@ -40,6 +40,8 @@ const ControllerView = ({ onSliderValueChange, onBack, title, + isHiddenBack = false, + isHiddenFullBack = false, }: ControllerViewProps) => { const [hide, setHide] = useState(false); const [width, setWidth] = useState(0); @@ -138,10 +140,11 @@ const ControllerView = ({ setWidth(e.nativeEvent.layout.width); }; const renderContainer = () => { + const showBack = !isFull && !isHiddenBack; if (isLoading) { return ( <> - {!isFull && ( + {showBack && ( - {!isFull && ( + {showBack && ( )} - {isFull ? ( + {isFull && !isHiddenFullBack ? ( & { onBufferProgress?: (progress: number) => void; onPrepare?: (duration: number) => void; isLandscape?: boolean; + /** + * 是否隐藏返回按钮 + */ + isHiddenBack?: boolean; + /** + * 是否隐藏全屏返回按钮 + */ + isHiddenFullBack?: boolean; }; export type VideoPlayerHandler = { play: () => void; diff --git a/src/index.tsx b/src/index.tsx index dfe1949..cc53e53 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -40,6 +40,8 @@ const VideoPlayer = forwardRef( onAliError, onAliPrepared, onAliRenderingStart, + isHiddenBack, + isHiddenFullBack, ...rest }: VideoPlayerProps, ref: React.Ref @@ -241,6 +243,8 @@ const VideoPlayer = forwardRef( current={currentTime} isFull={isFull} onFull={onFull} + isHiddenBack={isHiddenBack} + isHiddenFullBack={isHiddenFullBack} buffer={buffer} isError={false} isLoading={loading}