Skip to content

Commit

Permalink
Merge branch 'main' into mimeSniff
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisn committed Feb 12, 2024
2 parents 40ca7ed + e9a0d9e commit f3404a7
Show file tree
Hide file tree
Showing 12 changed files with 1,321 additions and 533 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bs linguist-language=HTML
36 changes: 36 additions & 0 deletions .github/workflows/auto-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Workflow based on the main w3c/spec-prod action example:
# https://github.com/w3c/spec-prod/#basic-usage

name: Build, Validate, Deploy and Publish

on:
# Worflow runs on pull requests where it makes sure that the spec can still be
# generated, that markup is valid and that there are no broken links, as
# well as on pushes to the default branch where it also deploys the generated
# spec to the gh-pages branch and publishes the result to /TR.
# The "workflow_dispatch" hook allows admins to also trigger the workflow
# manually from GitHub's UI.
pull_request: {}
push:
branches: [main]
workflow_dispatch:

jobs:
main:
runs-on: ubuntu-20.04
steps:
# See doc at https://github.com/actions/checkout#checkout-v2
- name: Checkout repository
uses: actions/checkout@v2

# See doc at https://github.com/w3c/spec-prod/#spec-prod
# The action only deploys the generated spec to the gh-pages branch when
# the workflow was triggered by a push to the default branch.
- name: Build and validate index.html, push to gh-pages branch if needed
uses: w3c/spec-prod@v2
with:
GH_PAGES_BRANCH: gh-pages
W3C_ECHIDNA_TOKEN: ${{ secrets.ECHIDNA_TOKEN }}
W3C_WG_DECISION_URL: https://github.com/w3c/media-wg/issues/27
W3C_BUILD_OVERRIDE: |
status: WD
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributions to this repository are intended to become part of Recommendation-track documents
governed by the [W3C Patent Policy](http://www.w3.org/Consortium/Patent-Policy-20040205/) and
[Document License](http://www.w3.org/Consortium/Legal/copyright-documents). To contribute, you must
[Software and Document License](http://www.w3.org/Consortium/Legal/copyright-software). To contribute, you must
either participate in the relevant W3C Working Group or make a non-member patent licensing
commitment.

Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
All documents in this Repository are licensed by contributors under the [W3C Document
License](http://www.w3.org/Consortium/Legal/copyright-documents).
All documents in this Repository are licensed by contributors under the [W3C
Software and Document License](http://www.w3.org/Consortium/Legal/copyright-software).
59 changes: 0 additions & 59 deletions deploy.sh

This file was deleted.

Binary file removed deploy_key.enc
Binary file not shown.
191 changes: 140 additions & 51 deletions explainer.md

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions hdr_explainer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# HDR Capability Detection
HDR capabilities are detected with a combination of CSS and MediaCapabilities APIs. Both APIs should be called to determine if HDR can be correctly presented.

Please note that both of these APIs are fairly new and are not yet implemented by all user agents. See Implementations section below.

# CSS: is the display HDR capable?

Media Queries Level 5 defines a `dynamic-range` feature, with values `"standard"` and `"high"`.

https://www.w3.org/TR/mediaqueries-5/#descdef-media-dynamic-range

```
let isScreenHDR = window.matchMedia('(dynamic-range: high)').matches;
```

This indicates whether the current display is HDR capable.

# CSS: video-* prefixed MediaQueries
User agents on TVs tend to offer video capabilities at the native resolution and dynamic range (ex: 4k HDR) while offering much lower capabilities for the rest of the web page (maybe 1080p SDR). To surface these distinct capabilities, Media Queries Level 5 defines features prefixed by "video-".

https://www.w3.org/TR/mediaqueries-5/#video-prefixed-features

This includes `video-dynamic-range`. On televisions, this value may be `"high"` while the non-prefixed `dynamic-range` remains `"standard"`.

On desktop and mobile devices, values for video-* features will generally match their non-prefixed counterparts.

The sizing video-\* prefixed features are still under discussion, including `video-width`, `video-height`, and `video-resolution`. See https://github.com/w3c/csswg-drafts/issues/5044


# MediaCapabilities: does the UA support decoding/rendering my brand of HDR video?
Use MediaCapabilities to ask about HDR video decoding/rendering capabilities, **independent of the display capabilities**.
* Does it support the desired transfer function? https://www.w3.org/TR/media-capabilities/#transferfunction
* Does it support rendering in the desired color gamut? https://www.w3.org/TR/media-capabilities/#colorgamut
* Does it support the desired HDR metadata? https://www.w3.org/TR/media-capabilities/#hdrmetadatatype

Here's a code sample (note the last 3 fields in `hdrConfig`).
```
let hdrConfig = {
type: 'media-source',
video: {
contentType: 'video/webm; codecs="vp09.00.10.08"',
width: 1920,
height: 1080,
bitrate: 2646242,
framerate: '25',
transferFunction: 'pq',
colorGamut: 'p3',
hdrMetadataType: 'smpteSt2086',
}
};
navigator.mediaCapabilities.decodingInfo(hdrConfig).then(function(info) {
if (info.supported) {
// Playback is supported! See also, info.smooth and info.powerEfficient.
}
});
```

# Implementations

As of 2020/11, here's the unofficial status of user agent implementations for the above:
* CSS dynamic-range is implemented by Safari. Not yet started by Chrome (ETA early 2021), nor Firefox
* CSS video-* features are not yet implemented anywhere.
* MediaCapabilities HDR inputs are implemented by Safari. Chrome's implementation is work-in-progress. Not yet started in Firefox.
Loading

0 comments on commit f3404a7

Please sign in to comment.