Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Video] add scrubber to the web player #4943

Merged
merged 16 commits into from
Aug 26, 2024
Merged

[Video] add scrubber to the web player #4943

merged 16 commits into from
Aug 26, 2024

Conversation

mozzius
Copy link
Member

@mozzius mozzius commented Aug 15, 2024

Screen.Recording.2024-08-15.at.20.28.46.mov
  • Mouse behaviour
  • aria attributes
  • Keyboard controls

Test plan

  • Test with mouse
  • Test with keyboard (focus with tab, move left/right with arrow keys)
  • Test different browsers - Firefox in particular

Known issue

If you mouseUp while the mouse is over a post (but not over the video), it'll navigate to the post. evt.preventDefault() doesn't prevent it

Solved! We make everything unclickable while scrubbing 😅

Copy link

render bot commented Aug 15, 2024

Copy link

github-actions bot commented Aug 15, 2024

Old size New size Diff
7.12 MB 7.13 MB 2.32 KB (0.03%)

@mozzius mozzius marked this pull request as ready for review August 23, 2024 21:56
Comment on lines 474 to 486
useEffect(() => {
// HACK: there's divergent browser behaviour about what to do when
// a pointerUp event is fired outside the element that captured the
// pointer. Firefox clicks on the element the mouse is over, so we have
// to make everything unclickable while seeking -sfn
if (isFirefox && scrubbing) {
document.body.classList.add('force-no-clicks')

return () => {
document.body.classList.remove('force-no-clicks')
}
}
}, [scrubbing])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the least worst solution I could come up with for the firefox click issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually able to break this if i take my cursor outside of the window while still pressing down. Can we prevent that from breaking?

Copy link
Contributor

@haileyok haileyok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work!

Left a little note in slack re: what pointers we should use (grabby hand? pointer? regular cursor?) We can tweak all of that in a different iteration.

Comment on lines +474 to +484
const abortController = new AbortController()
const {signal} = abortController
document.documentElement.addEventListener(
'mouseleave',
() => {
isSeekingRef.current = false
onSeekEnd()
setScrubberActive(false)
},
{signal},
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haileyok is the mouse leaving the window a firefox-only issue or should I apply this fix on all browsers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume it is just firefox yea. i couldn't get it to repro in chrome or safari.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok cool, this fix should be good then

@mozzius mozzius merged commit 9b534b9 into main Aug 26, 2024
6 checks passed
@mozzius mozzius deleted the samuel/scrubber branch August 26, 2024 21:28
estrattonbailey added a commit that referenced this pull request Aug 29, 2024
* origin/main: (520 commits)
  Fix language filtering for feeds (#5026)
  Enable show_follow_back_label_v2 (#5022)
  Remove logging of following prefs (#5021)
  Remove new_user_guided_tour and tour code (#5023)
  [Video] Remove old env var (#5018)
  Profile screen performance tweak - Adjust initial num to render based on header height (#5005)
  [Video] Make compress/upload cancelable (#4996)
  [Video] Add uploaded video to post (#4884)
  [Video] Add `timeRemainingChange` event to `player` in `expo-video` (#5013)
  [Video] Lexicon implementation (#4881)
  Hide quote counts for quotegated posts (#5011)
  Ensure captcha verification code gets submitted in signup request (#5010)
  clean up languages (#5007)
  [Video] 🫧 Move logic around by platform (#5003)
  bump 1.91.0 (#5002)
  add indicator of time remaining (#5000)
  [Video] add scrubber to the web player (#4943)
  Release 1.90 prep (#4988)
  Use moderatePost_wrapped for post embeds (#4981)
  Update Indonesian translation (#4875)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants