-
Notifications
You must be signed in to change notification settings - Fork 32
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
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
<p> | ||
The following example shows how to use {{decodingInfo}} to query | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Add parens to end of {{decodingInfo}} to establish the dfn link. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
<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'); | ||
}); | ||
</script> | ||
</pre> | ||
</div> | ||
</section> | ||
|
||
<section> | ||
<h3 id='example1'>Query recording capabilities with {{encodingInfo()}}</h3> | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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'.
There was a problem hiding this comment.
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.