diff --git a/index.bs b/index.bs index 469078d..01542c3 100644 --- a/index.bs +++ b/index.bs @@ -13,6 +13,7 @@ Former Editor: Becca Hughes, w3cid 103353, Google Inc., beccahughes@google.com Former Editor: Zhiqiang Zhang, Google Inc., zqzhang@google.com Former Editor: Rich Tibbett, Opera, richt@opera.com +Markup Shorthands: markdown yes Group: mediawg Logo: https://resources.whatwg.org/logo-mediasession.svg Abstract: This specification enables web developers to show customized media @@ -90,10 +91,10 @@ urlPrefix: https://html.spec.whatwg.org/multipage/dom.html; spec: dom Media is used extensively today, and the Web is one of the primary means of consuming media content. Many platforms can display media metadata, such as -title, artist, album and album art on various UI elements such as notification, -media control center, device lockscreen and wearable devices. This specification +title, artist, album and album art on various UI elements such as notifications, +media control center, device lockscreen, and wearable devices. This specification aims to enable web pages to specify the media metadata to be displayed in -platform UI, and respond to media controls which may come from platform UI or +platform UI, and respond to media controls that may come from platform UI or media keys, thereby improving the user experience.
- In order to make play and - pause actions work properly, + In order to make {{MediaSessionAction/play}} and + {{MediaSessionAction/pause}} actions work properly, the user agent SHOULD be able to determine if a browsing context of the active media session is playing media or not, which is called the guessed playback state. The RECOMMENDED way for determining @@ -237,17 +238,16 @@ conforming IDL fragments, as described in the Web IDL specification. [[!WEBIDL]] state is combined with the guessed playback state to compute the actual playback state, which is a finalized state and will be used for - play and - pause actions. + {{MediaSessionAction/play}} and + {{MediaSessionAction/pause}} actions.
The actual playback state is computed in the following way:
The {{MediaSession/playbackState}} attribute could be useful when the page wants to do some preparation steps when the media is paused but it allows - the preparation steps to be interrupted by pause action. See Setting playbackState for example.
@@ -302,8 +301,7 @@ conforming IDL fragments, as described in the Web IDL specification. [[!WEBIDL]] The media metadata for the active media session MAY be displayed in the platform UI depending on platform conventions. Whenever the active - media session changes or settingmetadata
of the active media
+ media session changes or setting {{MediaSession/metadata}} of the active media
session, the user agent MUST run the update metadata
algorithm. The steps are as follows:
@@ -313,13 +311,13 @@ conforming IDL fragments, as described in the Web IDL specification. [[!WEBIDL]]
presented to the platform, and terminate these steps.
metadata
of the
+ If the {{MediaSession/metadata}} of the
active media session is an empty metadata, unset the media
metadata presented to the platform, and terminate these steps.
metadata
for the
+ Update the media metadata presented to the platform to match the
+ {{MediaSession/metadata}} for the
active media session.
artwork
of the active media
+ If metadata's {{MediaMetadata/artwork}} of the active media
session is empty, then terminate these steps.
artwork
of the active
+ preferred artwork image from metadata's
+ {{MediaMetadata/artwork}} of the active
media session.
null
,
+ target is `null`,
the active media session is the recipient of all
media session action source's actions.
@@ -484,7 +481,7 @@ conforming IDL fragments, as described in the Web IDL specification. [[!WEBIDL]]
is invoked, the user agent MUST run the following steps:
null
, remove action
+ If handler is `null`, remove action
from the supported media session actions for {{MediaSession}}
and abort these steps.
null
, set session to
+ If session is `null`, set session to
the active media session.
null
, abort these steps.
+ If session is `null`, abort these steps.
null
, abort these
+ If the active media session is `null`, abort these
steps.
A {{MediaSession}} has an associated metadata
- object represented by a {{MediaMetadata}}. It is initially null
.
+ object represented by a {{MediaMetadata}}. It is initially `null`.
@@ -801,23 +798,23 @@ interface MediaSession {
The metadata
attribute
- reflects the {{MediaSession}}'s metadata. On getting,
- it MUST return the {{MediaSession}}'s metadata. On
+ reflects the {{MediaSession}}'s {{MediaSession/metadata}}. On getting,
+ it MUST return the {{MediaSession}}'s {{MediaSession/metadata}}. On
setting, it MUST run the following steps with value being the new
value being set:
null
, set its media session to
- null
.
+ If the {{MediaSession}}'s {{MediaSession/metadata}} is not
+ `null`, set its [=MediaMetadata/media session=] to
+ `null`.
null
, set its media session to the
+ If the {{MediaSession}}'s {{MediaSession/metadata}} is not
+ `null`, set its [=MediaMetadata/media session=] to the
current {{MediaSession}}.
A {{MediaMetadata}} is said to be an empty metadata if it is equal
- to null
or all the following conditions are true:
+ to `null` or all the following conditions are true:
The MediaMetadata(init)
+ for="MediaMetadata">MediaMetadata(init)
constructor, when invoked, MUST run the following steps:
- The title
attribute
+ The title attribute
reflects the {{MediaMetadata}}'s title. On getting,
it MUST return the {{MediaMetadata}}'s title. On
setting, it MUST set the {{MediaMetadata}}'s title to
@@ -1065,7 +1062,7 @@ invoked, the user agent MUST run the following steps:
- The artist
attribute
+ The artist attribute
reflects the {{MediaMetadata}}'s artist. On getting,
it MUST return the {{MediaMetadata}}'s artist. On
setting, it MUST set the {{MediaMetadata}}'s artist
@@ -1073,7 +1070,7 @@ invoked, the user agent MUST run the following steps:
- The album
attribute
+ The album attribute
reflects the {{MediaMetadata}}'s album. On getting,
it MUST return the {{MediaMetadata}}'s album. On
setting, it MUST set the {{MediaMetadata}}'s album to
@@ -1081,7 +1078,7 @@ invoked, the user agent MUST run the following steps:
- The artwork
+ The artwork
attribute reflects the {{MediaMetadata}}'s artwork
images. On getting, it MUST return the result of the following steps:
"podcast.jpg"
or "podcast.png"
for a
- low-pixel-density screen, and "podcast_hd.jpg"
- or "podcast_hd.png"
for a high-pixel-density screen. If the user
+ `"podcast.jpg"` or `"podcast.png"` for a
+ low-pixel-density screen, and `"podcast_hd.jpg"`
+ or `"podcast_hd.png"` for a high-pixel-density screen. If the user
agent wants to use an image for lockscreen background,
- "podcast_xhd.jpg"
will be preferred.
+ `"podcast_xhd.jpg"` will be preferred.