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 HTMLMediaElement.preservesPitch #3881

Closed
wants to merge 2 commits into from
Closed
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
44 changes: 32 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -32296,6 +32296,7 @@ interface <dfn>HTMLMediaElement</dfn> : <span>HTMLElement</span> {
readonly attribute boolean <span data-x="dom-media-paused">paused</span>;
attribute double <span data-x="dom-media-defaultPlaybackRate">defaultPlaybackRate</span>;
attribute double <span data-x="dom-media-playbackRate">playbackRate</span>;
attribute boolean <span data-x="dom-media-preservesPitch">preservesPitch</span>;
readonly attribute <span>TimeRanges</span> <span data-x="dom-media-played">played</span>;
readonly attribute <span>TimeRanges</span> <span data-x="dom-media-seekable">seekable</span>;
readonly attribute boolean <span data-x="dom-media-ended">ended</span>;
Expand Down Expand Up @@ -32354,10 +32355,6 @@ interface <dfn>HTMLMediaElement</dfn> : <span>HTMLElement</span> {
so that the author's controls can get away of the UA's
-->

<!-- v2 features that already have experimental implementations:
* webkitPreservesPitch (for when playbackRate != 1.0)
-->

<p><span data-x="media element">Media elements</span> are used to present audio data, or video and
audio data, to the user. This is referred to as <dfn>media data</dfn> in this section, since this
section applies equally to <span data-x="media element">media elements</span> for audio or for
Expand Down Expand Up @@ -34594,6 +34591,19 @@ interface <dfn>MediaError</dfn> {

</dd>

<dt><var>media</var> . <code subdfn data-x="dom-media-preservesPitch">preservesPitch</code></dt>

<dd>

<p>Returns true if pitch-preserving algorithms are used when the <code
data-x="dom-media-playbackRate">playbackRate</code> is not 1.0. The default value is true.</p>

<p>Can be set to false to have the <span>media resource</span>'s audio pitch change up or down
correspondingly to the <code data-x="dom-media-playbackRate">playbackRate</code>. This is useful
Copy link
Member

Choose a reason for hiding this comment

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

Note that this is the definition for web developers, the green box that you see here:
https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource

Here, I suggest following the structure of the ended/playbackRate attributes, with one "Returns true if ... The default value is true." statement and a separate "Can be set, to change ...".

for aesthetic and performance reasons.</p>

</dd>

<dt><var>media</var> . <code subdfn data-x="dom-media-played">played</code></dt>

<dd>
Expand Down Expand Up @@ -34837,12 +34847,19 @@ interface <dfn>MediaError</dfn> {
element is <span>potentially playing</span>, change the playback speed.</p></li>
</ol>

<p id="rateUpdate">When the <code data-x="dom-media-defaultPlaybackRate">defaultPlaybackRate</code>
or <code data-x="dom-media-playbackRate">playbackRate</code> attributes change value (either by
being set by script or by being changed directly by the user agent, e.g. in response to user
control) the user agent must <span>queue a task</span> to <span data-x="concept-event-fire">fire
an event</span> named <code data-x="event-media-ratechange">ratechange</code> at the <span>media
element</span>.</p>
<p id="rateUpdate">When the <code
data-x="dom-media-defaultPlaybackRate">defaultPlaybackRate</code> or <code
data-x="dom-media-playbackRate">playbackRate</code> attributes change value (either by being set
by script or by being changed directly by the user agent, e.g. in response to user control) the
user agent must <span>queue a task</span> to <span data-x="concept-event-fire">fire an
event</span> named <code data-x="event-media-ratechange">ratechange</code> at the <span>media
element</span>. The user agent must process attribute changes smoothly and must not introduce any
perceivable gaps or muting of playback in response.</p>

<p>The <dfn><code data-x="dom-media-preservesPitch">preservesPitch</code></dfn> attribute, on
getting, must return true if a pitch-preserving algorithm is in effect during playback. On
setting, the user agent must correspondingly switch the pitch-preserving algorithm on or off
without any perceivable gaps or muting of playback.</p>

<hr>

Expand Down Expand Up @@ -35104,8 +35121,10 @@ interface <dfn>MediaError</dfn> {
data-x="dom-media-playbackRate">playbackRate</code> is so low or so high that the user agent
cannot play audio usefully, the corresponding audio must also be <span
data-x="concept-media-muted">muted</span>. If the element's <code
data-x="dom-media-playbackRate">playbackRate</code> is not 1.0, the user agent may apply pitch
adjustments to the audio as necessary to render it faithfully.</p>
data-x="dom-media-playbackRate">playbackRate</code> is not 1.0 and <code
data-x="dom-media-preservesPitch">preservesPitch</code> is true, the user agent must apply pitch
adjustment to preserve the original pitch of the audio. Otherwise, the user agent must speed up
or slow down the audio without any pitch adjustment.</p>

<p>When a <span>media element</span> is <span>potentially playing</span>, its audio data played
must be synchronized with the <span>current playback position</span>, at the element's
Expand Down Expand Up @@ -120807,6 +120826,7 @@ INSERT INTERFACES HERE
Ashley Gullen,
Ashley Sheridan,
Atsushi Takayama,
Attila Haraszti,
Aurelien Levy,
Ave Wrigley,
Avi Drissman,
Expand Down