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 algorithms that describe how type/state are assigned/updated, and how they influence audio sessions and audio focus. #33

Merged
merged 7 commits into from
Nov 12, 2024

Conversation

youennf
Copy link
Contributor

@youennf youennf commented Oct 22, 2024

… how they influence audio sessions and audio focus.
@youennf
Copy link
Contributor Author

youennf commented Oct 22, 2024

This PR is a bit bigger and introduces the algorithms themselves. It requires careful review.

index.bs Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated
To <dfn>inactivate</dfn> an {{AudioSession}} named |audioSession|, the user agent MUST run the following steps:
1. If |audioSession|.[=AudioSession/[[state]]=] is {{AudioSessionState/inactive}}, abort these steps.
1. Run the following steps [=in parallel=]:
1. [=Change the state=] of |audioSession|'s [=audio session=] to {{AudioSessionState/inactive}}.
Copy link
Contributor

Choose a reason for hiding this comment

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

When I click Change the state, it directs me to 5.2. Update AudioSession’s state. If so, for the consistency, should we say Update the state instead?

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 am trying to distinguish two things:

  • web page does something and UA updates the audio session state based on it (inactivating or activating it).
  • the audio session stage changes outside of web page activity, and UA updates the AudioSession state.

I used update the state for AudioSession and change the state for audio session.
Any idea how to make that clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clicking on change the state should point to the change state definition.
It is true it is close to the update the state.

Copy link
Contributor

Choose a reason for hiding this comment

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

TBF simply reading the spec, it's hard to distinguish those two things.

When an audio session element is starting or stopping, the user agent will run steps that change the state of an audio session.

This paragraph doesn't even mention the state change is caused by outside of web page activity. If it's important to let readers understand the differences, maybe we could add your explanation into the spec as well?

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'll change to set the state and notify the state's change wording, hoping this is clearer.

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
1. Its [=audio session/type=] is an [=exclusive type=].
1. If |activeAudioSessions| is empty, abort these steps.
1. If there is only one [=audio session=] in |activeAudioSessions|, set the [=selected audio session=] to this [=audio session=] and abort these steps.
1. Assert that for any {{AudioSession}} object [=tied to=] an [=audio session=] in |activeAudioSessions|'s named |audioSession|, |audioSession|.[=AudioSession/[[type]]=] is {{AudioSessionType/auto}}.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why we need to assert the type being auto? Why can't those audio sessions be other types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is that there can be at most only one active audio session with a type that is explicitly set to an exclusive type, since they interrupt each other.
But auto audio sessions do not interrupt each other (that would not be web compatible).
So, if we have more than one session in |activeAudioSessions|, it means that they should all be auto.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's worth to add your explanation as a note section in the spec. (<div class="note">)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

nits : it would be great to add NOTE explicitly, like what other specs are doing. Eg. EME, MSE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tidoust, do you know how to fix this?
The goal would be to render <div class=note> with a big green NOTE.

Copy link
Member

Choose a reason for hiding this comment

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

What should happen if the assertion fails?

@youennf
Copy link
Contributor Author

youennf commented Oct 28, 2024

@alastor0325, thanks for the review, I addressed some points and will do a change in the other PR.
Let me know your thoughts on the updates and questions.

@alastor0325
Copy link
Contributor

@youennf I apologize for the late reply. I’ve added a few comments, mostly minor suggestions, but overall it looks great to me. Thank you!

@youennf
Copy link
Contributor Author

youennf commented Nov 4, 2024

Thanks @alastor0325, I updated the PR according your comments. PTAL.

@youennf
Copy link
Contributor Author

youennf commented Nov 12, 2024

Gentle ping

Copy link
Contributor

@alastor0325 alastor0325 left a comment

Choose a reason for hiding this comment

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

Apologies for the delay on this review, and thank you so much for your help!

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
1. Its [=audio session/type=] is an [=exclusive type=].
1. If |activeAudioSessions| is empty, abort these steps.
1. If there is only one [=audio session=] in |activeAudioSessions|, set the [=selected audio session=] to this [=audio session=] and abort these steps.
1. Assert that for any {{AudioSession}} object [=tied to=] an [=audio session=] in |activeAudioSessions|'s named |audioSession|, |audioSession|.[=AudioSession/[[type]]=] is {{AudioSessionType/auto}}.
Copy link
Member

Choose a reason for hiding this comment

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

What should happen if the assertion fails?

1. The user agent MAY apply specific heuristics to reorder |activeAudioSessions|.
1. Set the [=selected audio session=] to the first [=audio session=] in |activeAudioSessions|.

## Other algorithms ## {#audio-session-other-algorithms}
Copy link
Member

Choose a reason for hiding this comment

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

A minor suggestion, we could have a section per algorithm, rather than grouping them under "other"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The assertion failure means that the UA implementation (or the spec) is wrong and should be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As of splitting the other section, let's do that in a follow-up.

youennf and others added 2 commits November 12, 2024 22:17
Co-authored-by: Chris Needham <[email protected]>
Co-authored-by: Chris Needham <[email protected]>
@youennf youennf merged commit 0b93b78 into w3c:main Nov 12, 2024
1 check passed
github-actions bot added a commit that referenced this pull request Nov 12, 2024
… how they influence audio sessions and audio focus. (#33)

SHA: 0b93b78
Reason: push, by youennf

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.

3 participants