diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d035be..447fd05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 0.7.3 (Beta) + +## Fixes + +* Show UI controls on mouse move. +* Add basic keyboard shortcuts (Fast-forward, Rewind, Pause/Play). + # 0.7.2 (Beta) ## Fixes diff --git a/src/components/PlayerSurface.tsx b/src/components/PlayerSurface.tsx index 3590b7f..6ce87e3 100644 --- a/src/components/PlayerSurface.tsx +++ b/src/components/PlayerSurface.tsx @@ -88,7 +88,7 @@ export const PlayerSurface = (props: PlayerProps) => { const createVideo = async (video: HTMLVideoElement|null) => { if (!video || context) {return} - + await props.player.init(video, props.baseConfig) const presto = await props.player.presto() @@ -137,11 +137,11 @@ export const PlayerSurface = (props: PlayerProps) => { } }, [], props.player) - // const mouseMove = () => { - // if (!props.player.controlsVisible && !props.player.slideInMenuVisible) { - // props.player.surfaceInteraction() - // } - // } + const mouseMove = () => { + if (!props.player.controlsVisible && !props.player.slideInMenuVisible) { + props.player.surfaceInteraction() + } + } const mouseClick = (e: React.MouseEvent) => { if (!e.defaultPrevented) { @@ -192,29 +192,28 @@ export const PlayerSurface = (props: PlayerProps) => { } } - // let player = props.player; - // switch (e.code) { - // case "ArrowRight": - // player.position += 10 - // break - // case "ArrowLeft": - // player.position -= 10 - // break - // case "Space": - // player.playing = !player.playing - // e.preventDefault() - // break - // case "Escape": - // if (props.player.slideInMenuVisible) { - // console.log('>>> ESCAPE, close menu and register interaction') - // props.player.slideInMenuVisible = false - // setTimeout(() => { - // props.player.surfaceInteraction() - // }, 100) - // e.preventDefault() - // } - // break - // } + const player = props.player + switch (e.code) { + case 'ArrowRight': + player.position += 10 + break + case 'ArrowLeft': + player.position -= 10 + break + case 'Space': + player.playing = !player.playing + e.preventDefault() + break + case 'Escape': + if (props.player.slideInMenuVisible) { + props.player.slideInMenuVisible = false + setTimeout(() => { + props.player.surfaceInteraction() + }, 100) + e.preventDefault() + } + break + } } useEffect(() => { @@ -250,11 +249,11 @@ export const PlayerSurface = (props: PlayerProps) => { return (
@@ -263,7 +262,7 @@ export const PlayerSurface = (props: PlayerProps) => { tabIndex={-1} playsInline={props.playsInline}> - {context && + {context &&
{props.children}