Skip to content

remove a part that said the API can be called from sub frames. #1019

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions SetPreferredSinkId/explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ We’d like to propose a new API to set the default audio output device for the

- Developers can modify the default audio output for the top-level frame page.
- Developers can modify the default audio output for the sub frame pages.
- Developers can modify the default audio output for the top-level frame and all other sub frames from any same-origin sub frame.
- Any media element or audio context can continue to override this default setting using the existing setSinkId API (cross-origin iframes continue to need 'speaker_selection' permission to call setSinkId).

## Non Goals
- A change notification for default audio output is not in scope of this project.
- Requiring a permission policy for calling the API. Since permission is gated on the speaker_selection permission, access to the API is already reasonably constrained.
- A change of the sinkId property for the default device ID. It will continue to return the existing default device ID (an empty string).
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we delete this part about the default sink id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the feedback, it will continue to return an empty string (""), as that represents the default audio output device from the developer's perspective.

If we intended to return a preferred sink ID here, we would also need to provide an event to notify the developer when the sink ID is updated — which is not the behavior we want.


## Use Cases

Expand Down Expand Up @@ -73,7 +71,7 @@ Return:

Exceptions:
NotAllowedError DOMException
Returned if a cross-origin sub frame tries to call the API.
Returned if a sub frame tries to call the API.

NotFoundError DOMException
Returned if the deviceId does not match any audio output device.
Expand All @@ -82,9 +80,9 @@ Exceptions:
Returned if switching the audio output device to the new audio device failed.
```

This API is accessible from the top-level frame and the same-origin sub frames and allows modification of the default audio output for both
the top-level frame and all sub frames, regardless of their origins. However, it’s important to note that this change does not affect custom
audio outputs specified using the setSinkId method in media element or audio context.
This API is accessible from the top-level frame and allows modification of the default audio output for both the top-level frame and all sub frames,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also mention what happens when setPreferredSinkId is called from a sub frame? I assume it throws an exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the above error message 'Returned if a sub frame tries to call the API.'.

regardless of their origins. However, it’s important to note that this change does not affect custom audio outputs specified using the setSinkId
method in media element or audio context.

Remember to call this API within a secure context (using HTTPS).

Expand Down Expand Up @@ -178,6 +176,3 @@ Here are the key points of this approach:
* Drawback: The frame itself must explicitly call setSinkId for any specific audio outputs it requires in the current frame.

In summary, the pros of this alternative include muting capabilities while maintaining the responsibility for individual frame audio settings.

## Open Questions
* Do we have to provide permission policy (e.g. speaker-selection) for the top-level frame to allow cross-origin sub frame to be able to call the API?