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

Add enterpictureinpicture action #295

Merged
merged 6 commits into from
Oct 11, 2023
Merged

Add enterpictureinpicture action #295

merged 6 commits into from
Oct 11, 2023

Conversation

steimelchrome
Copy link
Contributor

@steimelchrome steimelchrome commented May 8, 2023

This PR adds a new 'enterpictureinpicture' MediaSessionAction as proposed in issue #294.

Notably, this has an 'automatic' boolean in the given MediaSessionActionDetails. This would allow websites to distinguish between 'enterpictureinpicture' actions coming from an explicit user action (e.g. clicking a picture-in-picture button in the user agent UI) vs the user agent automatically sending the action (e.g. because the website became hidden). This would not require a user agent to ever send such an action.

I'm interested in feedback on this approach, and here are two other approaches I considered for allowing a website to distinguish between the two:

  1. Having two separate actions for each type ('enterpictureinpicture' and 'enterautopictureinpicture'/'autoenterpictureinpicture')
  2. Adding some sort of 'source' enum that could potentially be useful for other MediaSessionActions and/or other sources of actions (I couldn't think of any other cases, but it's worth considering)

Preview | Diff

@chrisn
Copy link
Member

chrisn commented May 17, 2023

Discussed in Media WG meeting 16 May 2023. Agreement that the feature is useful. Preference expressed towards having a single action rather than two separate actions (for user-initiated vs UA-initiated PiP), and to investigate defining an enum that indicates why the PiP window is being opened. Do sites need to be able to distinguish those cases, e.g., to prevent PiP in one scenario but allow in another?

@youennf
Copy link
Contributor

youennf commented Sep 12, 2023

Discussed at TPAC, plan is to move forward with a reduced version of the PR (no automatic field in the initial version)

index.bs Outdated Show resolved Hide resolved
@@ -749,7 +753,8 @@ enum MediaSessionAction {
"togglecamera",
"hangup",
"previousslide",
"nextslide"
"nextslide",
"enterpictureinpicture"
Copy link
Contributor

Choose a reason for hiding this comment

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

would we sort them lexicographically (not necessarily in this PR)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not actually sure what the standard practice is for enums. I'm not opposed to sorting them lexographically but the way it is now does tend to keep related values (e.g. previousslide and nextslide) together, which is a plus.

index.bs Outdated Show resolved Hide resolved
@steimelchrome steimelchrome merged commit 5d4054a into main Oct 11, 2023
2 checks passed
github-actions bot added a commit that referenced this pull request Oct 11, 2023
SHA: 5d4054a
Reason: push, by steimelchrome

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants