Skip to content

Commit

Permalink
DE-6820: Re-enable basic interactivity
Browse files Browse the repository at this point in the history
Basic interactivity via hover and keys was
likely disabled by mistake. Re-enable it.
  • Loading branch information
fingerartur committed Dec 12, 2023
1 parent 977055d commit 60e2af5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 32 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
63 changes: 31 additions & 32 deletions src/components/PlayerSurface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -250,11 +249,11 @@ export const PlayerSurface = (props: PlayerProps) => {

return (
<div ref={handleContainerRef}
data-testid="pp-ui-surface"
data-testid="pp-ui-surface"
className={`pp-ui pp-ui-surface ${isIpadOS() ? 'pp-ui-ipad' : ''} ${props.className || ''}`}
style={props.style}
onClick={mouseClick}
// onMouseMove={mouseMove}
onMouseMove={mouseMove}
onKeyDown={onKeyDown}
tabIndex={0}
>
Expand All @@ -263,7 +262,7 @@ export const PlayerSurface = (props: PlayerProps) => {
tabIndex={-1}
playsInline={props.playsInline}>
</video>
{context &&
{context &&
<PrestoContext.Provider value={context}>
<div className={`pp-ui pp-ui-overlay ${isIpadOS() ? 'pp-ui-ipad' : ''}`}>
{props.children}
Expand Down

0 comments on commit 60e2af5

Please sign in to comment.