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

fix: refactor fullscreen-api and state mediator to make fewer assumpt… #946

Merged

Conversation

cjpillsbury
Copy link
Collaborator

…ions on env-specific divergences. Fixes bug in modern Safari iOS fullscreen.

…ions on env-specific divergences. Fixes bug in modern Safari iOS fullscreen.
@cjpillsbury cjpillsbury requested review from heff and a team as code owners July 25, 2024 16:19
Copy link

vercel bot commented Jul 25, 2024

@cjpillsbury is attempting to deploy a commit to the Mux Team on Vercel.

A member of the Team first needs to authorize it.

}
};

const exitFullscreenKey =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Per out of band convo, should these "prefer" browser prefix versions or standard versions?

Copy link
Contributor

Choose a reason for hiding this comment

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

like this seems good to me, prefer prefix-less

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cool would love to get @heff's and/or @mmcc's gut on this as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, can't say I'm thinking too deeply on this one, but I also prefer prefixless, in the hopes we can just delete code later without changing much more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah for me I just wasn't sure if there was an expectation that, if both are around, which would be more reliable. That said, I think the status quo wins by vote, so I'm gonna mash that merge.

@cjpillsbury cjpillsbury force-pushed the fix/update-fullscreen-ios-reliability branch from d38e3ab to 9444718 Compare July 25, 2024 18:20
Copy link

vercel bot commented Jul 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
media-chrome ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 6:23pm
media-chrome-demo-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 6:23pm
media-chrome-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 6:23pm

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 68.98396% with 58 lines in your changes missing coverage. Please review.

Please upload report for BASE (3.x@3301719). Learn more about missing BASE report.

Files Patch % Lines
src/js/utils/fullscreen-api.js 66.85% 58 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             3.x     #946   +/-   ##
======================================
  Coverage       ?   72.35%           
======================================
  Files          ?       79           
  Lines          ?    16213           
  Branches       ?        0           
======================================
  Hits           ?    11731           
  Misses         ?     4482           
  Partials       ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cjpillsbury
Copy link
Collaborator Author

Did basic enter/exit smoke testing on:

  • Firefox Desktop (macOS)
  • Chrome Desktop (macOS)
  • Safari Desktop (macOS)
  • Safari Mobile (iOS, latest)

Not sure if we have a way to validate the Safari Mobile (iOS) < 16.4 specific logic. Should be roughly equivalent, but maybe spend a few extra ticks on code review reasoning through that if we can't validate via tests. Also please do your own smoke testing (even if on the PR deploy apps) just for more eyes.

Copy link
Contributor

@luwes luwes left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@heff heff left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

*/

/** @type {(stateOwners: StateOwners) => Promise<undefined> | undefined} */
export const enterFullscreen = (stateOwners) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is definitely a nit pick, so take it or leave it, but if we're keeping these as Utils it'd feel better if they weren't tied to the concept of stateOwners and media + fullscreenEl were specific arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I def get that intuition. Here was my reasoning:

  • If you squint, this is just a common convention for passing in multiple optional arguments in JS (an object with optional key + value pairs).
  • The "shape" of that argument object happens to use the same names as StateOwners, in large part out of convenience (since, aside from one case in platform checks, it's only used by the Media Store architecture)
  • Even there, it isn't identical to StateOwners, because it only expects/requires a small subset of what has to be defined on them

I'm gonna leave for now but we can certainly revisit in next week's MCOH (feels like it would fit in the "best practices" category if we wanna define something either way here)

@cjpillsbury cjpillsbury merged commit 904e6cb into muxinc:3.x Jul 25, 2024
8 checks passed
cjpillsbury added a commit to muxinc/elements that referenced this pull request Jul 26, 2024
…screen. (#958)

Blocked by muxinc/media-chrome#946
Fixes #863

Smoke tested 👍 on both iOS Safari and iOS Chrome, plus desktop browsers
for regression testing.
luwes pushed a commit that referenced this pull request Aug 12, 2024
#946)

…ions on env-specific divergences. Fixes bug in modern Safari iOS
fullscreen.
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