Skip to content

Commit 086e50d

Browse files
feat(player-react): let user modify onClick behavior
1 parent 8e1f558 commit 086e50d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/player-react/src/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ interface PlayerProps {
4444
onTimeUpdate?: (currentTime: number) => void;
4545
onPlayerReady?: (player: CorePlayer) => void;
4646
onPlayerResize?: (rect: DOMRectReadOnly) => void;
47+
onClick?: () => void;
4748
}
4849

4950
export function Player({
@@ -65,6 +66,7 @@ export function Player({
6566
onTimeUpdate = () => {},
6667
onPlayerReady = () => {},
6768
onPlayerResize = () => {},
69+
onClick,
6870
}: PlayerProps) {
6971
const [playingState, setPlaying] = useState(playing);
7072
const [isMouseOver, setIsMouseOver] = useState(false);
@@ -77,7 +79,7 @@ export function Player({
7779
const wrapperRef = useRef<HTMLDivElement | null>(null);
7880
const lastRect = useRef<DOMRectReadOnly | null>(null);
7981

80-
const onClickHandler = controls ? () => setPlaying(prev => !prev) : undefined;
82+
const onClickHandler = onClick || (controls ? () => setPlaying(prev => !prev) : undefined);
8183

8284
/**
8385
* Sync the playing prop with the player's own state when it changes.

0 commit comments

Comments
 (0)