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 decodingInfo() example #151

Merged
merged 3 commits into from
Mar 13, 2020
Merged
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
39 changes: 39 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,45 @@ spec: secure-contexts; urlPrefix: https://www.w3.org/TR/secure-contexts/
<section>
<h2 id='examples'>Examples</h2>

<section>
<h3 id='example1'>Query playback capabilities with {{decodingInfo()}}</h3>
Copy link
Contributor

Choose a reason for hiding this comment

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

shucks, I missed another warning.
WARNING: Multiple elements have the same ID 'example1'.
Deduping, but this ID may not be stable across revisions.
https://api.csswg.org/bikeshed/

Can you change the id for the encoding example (l.1251 - gh won't let me comment there) to be 'example2'.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry about this, I really should get bikeshed set up locally. Now fixed.

<p>
The following example shows how to use {{decodingInfo}} to query
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add parens to end of {{decodingInfo}} to establish the dfn link.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks Chris.

media playback capabilities when using Media Source Extensions
[[media-source]].
</p>

<div class="example" highlight="javascript">
<pre>
&lt;script>
const contentType = 'video/mp4;codecs=avc1.640028';

const configuration = {
type: 'media-source',
video: {
contentType: contentType,
width: 640,
height: 360,
bitrate: 2000,
framerate: 29.97
}
};

navigator.mediaCapabilities.decodingInfo(configuration)
.then((result) => {
console.log('Decoding of ' + contentType + ' is'
+ (result.supported ? '' : ' NOT') + ' supported,'
+ (result.smooth ? '' : ' NOT') + ' smooth and'
+ (result.powerEfficient ? '' : ' NOT') + ' power efficient');
})
.catch((err) => {
console.error(err, ' caused decodingInfo to reject');
});
&lt;/script>
</pre>
</div>
</section>

<section>
<h3 id='example1'>Query recording capabilities with {{encodingInfo()}}</h3>

Expand Down