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

Fix MIME type handling #559

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
53 changes: 25 additions & 28 deletions encrypted-media-respec.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
},

xref: ["dom", "html", "infra", "webaudio"]
xref: ["dom", "html", "infra", "mimesniff", "webaudio"]
};
</script>
<link rel="stylesheet" href="eme.css">
Expand Down Expand Up @@ -1021,22 +1021,6 @@ <h2>
multiple independent profiles for a single account.
</p>
</dd>
<dt>
<dfn>Valid Media MIME Type</dfn>
</dt>
<dd>
<p>
A valid media MIME type is a media <a data-cite="html#mime-types">MIME type</a> that is
also a [=valid MIME type string=] [[mimesniff]]. When a MIME type includes parameters,
such as `"codecs"` [[RFC6381]], such parameters MUST also be valid per the relevant
specification.
</p>
<p>
When used with the features defined in this specification, MIME type strings SHOULD
explicitly specify codecs and codec constraints (e.g., per [[RFC6381]]) unless these
are normatively implied by the container.
</p>
</dd>
</dl>
</section>
<section>
Expand Down Expand Up @@ -1928,14 +1912,20 @@ <h5>
</li><!-- Invalid input. -->
<li>
<p>
If <var>content type</var> is not a [=valid media MIME type=] or is
unrecognized, continue to the next iteration.
Let <var>mimeType</var> be the result of running <a>parse a MIME type</a>
with <var>content type</var>.
</p>
</li>
<li>
<p>
Let <var>container</var> be the container type specified by <var>content
type</var>.
If <var>mimeType</var> is <code>failure</code> or is unrecognized,
Copy link
Member Author

Choose a reason for hiding this comment

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

What does "unrecognized" mean here?

Copy link
Member

Choose a reason for hiding this comment

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

I was not the author of that phrase, but I think the distinction between "invalid"/"failure" and "unrecognized" is that you could have a valid MIME type that is not recognized as supported for media playback by the UA, e.g. "image/png".

If this is indeed the intent, I think the term "unrecognized" is not the best we could come up with.

How about If <var>mimeType</var> is <code>failure</code> or is not a supported type for media playback? Is that clear?

Copy link
Member

Choose a reason for hiding this comment

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

Joey's suggestion is better, but ideally we actually list the MIME types. See also https://mimesniff.spec.whatwg.org/#supported-by-the-user-agent and references.

Copy link
Member

Choose a reason for hiding this comment

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

I not convinced that an explicit list of supported media types is practical, given the variability in what is supported across the entire ecosystem of media streaming devices.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's a related PR for Media Capabilities, see "Check MIME Type Support" in https://github.com/w3c/media-capabilities/pull/222/files. We may be able to reuse this, or maybe even just reference it. But in that PR we reference https://mimesniff.spec.whatwg.org/#supported-by-the-user-agent rather than list MIME types.

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 "supported by the user agent" plus limiting it to media in some way is reasonable. It will at least give us a central place to work on improving this longer term.

continue to the next iteration.
Copy link
Member

Choose a reason for hiding this comment

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

At some point you might want to adopt https://infra.spec.whatwg.org/#iteration-continue and other Infra conventions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, let's do this in a separate PR.

</p>
</li>
<li>
<p>
Let <var>container</var> be the container type specified by
<var>mimeType</var>.
</p>
</li>
<li>
Expand All @@ -1951,13 +1941,14 @@ <h5>
</li>
<li>
<p>
Let <var>parameters</var> be the RFC 6381 [[RFC6381]] parameters, if any,
specified by <var>content type</var>.
Let <var>parameters</var> be the "codecs" and "profiles" RFC 6381 [[RFC6381]]
parameters, if any, of <var>mimeType</var>.
</p>
</li>
<li>
<p>
If the user agent does not recognize one or more <var>parameters</var>,
or if any parameters are not valid per the relevant specification,
continue to the next iteration.
</p>
</li>
Expand Down Expand Up @@ -1998,11 +1989,12 @@ <h5>
</li>
<li>
<p>
If <var>content type</var> is not strictly a <var>audio/video type</var>,
If <var>mimeType</var> is not strictly an <var>audio/video type</var>,
continue to the next iteration.
</p>
<p class="note">
For example, if <var>audio/video type</var> is Video and the top-level type
For example, if <var>audio/video type</var> is Video and <var>mimeType</var>'s
<var>type</var>
chrisn marked this conversation as resolved.
Show resolved Hide resolved
is not "video" or <var>media types</var> contains non-video codecs.
</p>
</li>
Expand Down Expand Up @@ -2483,8 +2475,13 @@ <h2>
</dt>
<dd>
<p>
The type of the <a data-cite="html#media-resource">media resource</a>. Its value
must be a [=valid media MIME type=]. The empty string is invalid.
The <a data-cite="html#mime-types">MIME type</a> of the
<a data-cite="html#media-resource">media resource</a>.
</p>
<p class="note">
Applications SHOULD ensure that the MIME type explicitly specifies codecs
and codec constraints (e.g., per [[RFC6381]]) unless these are normatively
implied by the container.
</p>
</dd>
<dt>
Expand Down Expand Up @@ -2619,7 +2616,7 @@ <h2>
The returned object is a non-strict subset (plus any implied defaults) of the first
satisfiable {{MediaKeySystemConfiguration}} configuration passed to the
{{Navigator/requestMediaKeySystemAccess()}} call that returned the promise that was
resolved with this object. It does not contain values capabilities not specified in
resolved with this object. It does not contain values for capabilities not specified in
that single configuration (other than implied defaults) and thus may not reflect all
capabilities of the [=Key System=] implementation. All values in the configuration
may be used in any combination. Members of type {{MediaKeysRequirement}} reflect
Expand Down