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 playbackState attribute and remove playpause action #152

Merged
merged 1 commit into from
Dec 15, 2016

Conversation

xxyzzzq
Copy link
Contributor

@xxyzzzq xxyzzzq commented Dec 14, 2016

Changes:

  • Added playback state
  • Removed playpause action
  • Some structural change in "Processing model" section

The temporary spec after the change can be found at:
http://xxyzzzq.github.io/mediasession/

Copy link
Member

@mounirlamouri mounirlamouri left a comment

Choose a reason for hiding this comment

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

First comments after a quick look.

playback state. If it's currently playing, the user agent will send pause events
to the page and if it's currently paused, the user agent will send play events
to the page. The default `playbackState` is `none`, the UA should use its best
guess to decide the current playback state.
Copy link
Member

Choose a reason for hiding this comment

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

What about "stop"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed "stop" for now per offline discussion

interface MediaSession : EventTarget {
attribute MediaMetadata? metadata;

attribute MediaSessionPlaybackState playbackState = "none";
Copy link
Member

Choose a reason for hiding this comment

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

nit: I would do // defaults no "none" instead of the non-allowed IDL syntax.

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.

</tr>
<tr>
<td>
<code>none</code>
Copy link
Member

Choose a reason for hiding this comment

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

You should link this with the declaration. I think <dfn for='MediaSessionPlaybackState' enum>none</dfn>

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 (actually it should be "enum-value").

user experience.
user experience. An exception is that if the <a>actual playback state</a> is
<code>"stopped"</code>, then it MUST not become a <a>tab-level active media
session</a>.
Copy link
Member

Choose a reason for hiding this comment

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

I would say that "stopped" should be used to express that the page is no longer playing and the UA should not attempt to resume it. Saying that it should not become the active tab seems too much because if it starts playing for some reasons, it will, right? I would recommend "stopped" to be used when a playlist is finished instead of switching to "paused".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto (removed stop for now)

@xxyzzzq xxyzzzq force-pushed the playback_state branch 2 times, most recently from c04ef68 to 669a822 Compare December 14, 2016 17:58
@xxyzzzq xxyzzzq changed the title Add playbackState attribute and remove playpause action (#141) Add playbackState attribute and remove playpause action Dec 15, 2016
For action `play` and `pause`, in many situations, `play` and `pause` share the
same media button. When the button is pressed, the user agent should fire
`pause` action when the page is playing and fire `play` when the page is paused.
The page can use attribute `playbackState` to tell the UA about the current
Copy link
Member

Choose a reason for hiding this comment

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

'can use the playbackState attribute" (inverse attribute and playbackstate)

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.

**Note** It is still an open question if we want a `stopped` value for
`playbackState`. The state could be useful when a playlist has finished.
However, it is a bit confusing with `paused`, and we should added it if
there's good justification. See https://github.com/WICG/mediasession/issues/xxx
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we shouldn't have this in the explainer in addition of an issue. I think it's better to open an issue.

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. Removed and filed an issue.

The page can use attribute `playbackState` to tell the UA about the current
playback state. If it's currently playing, the user agent will send pause events
to the page and if it's currently paused, the user agent will send play events
to the page. The default `playbackState` is `none`, the UA should use its best
Copy link
Member

Choose a reason for hiding this comment

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

Instead of making the UA guess specific to none, what about:
"""
The default playbackState is none, representing no active media session. The playbackState attribute is a hint to the UA which could ignore it in case of, for example, a page appears to be playing but has a playbackState sets to paused.
"""

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.

[Exposed=Window]
interface MediaSession : EventHandler {
attribute MediaMetadata? metadata;

attribute MediaSessionPlaybackState playbackState; // defaults to "none"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the comment is needed here.

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.

metadata">metadata</a>.
The <dfn attribute for="MediaSession"><code>playbackState</code></dfn> attribute
represents the <dfn lt="playback state">playback state</dfn> of the <a>media
session</a>. The attribute MUST take one value of the
Copy link
Member

Choose a reason for hiding this comment

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

No need to say which values it must take. It is implicit with the IDL.

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.

{{MediaSessionPlaybackState}} enum. The default value is <a enum-value
for="MediaSessionPlaybackState">none</a>. On setting, the user agent MUST update
the <a>most meaningful media session</a> and run the <a>media control actions
update algorithm</a> if needed.
Copy link
Member

Choose a reason for hiding this comment

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

On getting, the user agent MUST return the last valid value that was set. If none, it MUST
<a enum-value for="MediaSessionPlaybackState">none</a>.

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.

override is called <dfn>actual playback state</dfn> and could be either <a
enum-value for="MediaSessionPlaybackState">playing</a> or <a enum-value
for="MediaSessionPlaybackState">paused</a>. The rules for determining the
<a>actual playback state</a> is as follows:
Copy link
Member

Choose a reason for hiding this comment

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

I think we can simplify this. In my opinion, tables make things harder to read :) What about something similar to:

The <dfn>actual playback state</dfn> SHOULD return the last value that was set on <a attribute
for="MediaSession">playbackState</a>. If the user agent believes the actual playback state is <a enum-value
for="MediaSessionPlaybackState">playing</a> and the <a attribute for="MediaSession">playbackState</a> returns
a different value, it MAY return <a enum-value for="MediaSessionPlaybackState">playing</a> 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.

Done.

</tr>
<tr>
<td>
<dfn enum-value for="MediaSessionPlaybackState">none</dfn>
Copy link
Member

Choose a reason for hiding this comment

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

It would be great if you could define what the states mean next to the IDL definition 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.

Done, put it as a unordered list in the section for the IDL interfaces.

<a>event pause</a>.
</li>
<li>
If <a>actual playback state</a> is <a enum-value
Copy link
Member

Choose a reason for hiding this comment

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

s/If/Otherwise,/

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
Member

@mounirlamouri mounirlamouri left a comment

Choose a reason for hiding this comment

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

Thanks! 😃

</li>
<li>
Otherwise, show a button for
<a>event play</a>.
Copy link
Member

Choose a reason for hiding this comment

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

nit: no need for lign wrap, right?

@xxyzzzq xxyzzzq merged commit b354c48 into w3c:master Dec 15, 2016
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.

2 participants