-
Notifications
You must be signed in to change notification settings - Fork 29
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
Conversation
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about "stop"?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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>. |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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)
c04ef68
to
669a822
Compare
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 |
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
.
"""
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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>.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/If/Otherwise,/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
e607339
to
b462b29
Compare
There was a problem hiding this 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>. |
There was a problem hiding this comment.
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?
b462b29
to
d44cff6
Compare
Changes:
The temporary spec after the change can be found at:
http://xxyzzzq.github.io/mediasession/