Skip to content

Commit

Permalink
Merge pull request #150 from chrisn/chrisn/fix-example
Browse files Browse the repository at this point in the history
Impove encodingInfo() example
  • Loading branch information
chcunningham authored Mar 13, 2020
2 parents 0c65f07 + 9d98241 commit 6605cb2
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,26 +1220,29 @@ spec: secure-contexts; urlPrefix: https://www.w3.org/TR/secure-contexts/
<div class="example" highlight="javascript">
<pre>
&lt;script>
const contentType = 'video/webm;codecs=vp8';

const configuration = {
type : 'record',
video : {
contentType : 'video/webm;codecs=vp8',
width : 640,
height : 480,
bitrate : 10000,
framerate : 29.97
type: 'record',
video: {
contentType: contentType,
width: 640,
height: 480,
bitrate: 10000,
framerate: 29.97
}
};

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

0 comments on commit 6605cb2

Please sign in to comment.