Skip to content

Conversation

@maverickmishra
Copy link
Member

Fetch data about devices and constraints when mediaDevices is created.

Description

This change pre-fetches the data provided by the mediaDevices.enumerateDevices() and mediaDevices.getSupportedConstraints when the mediaDevices object is created

Related Issue

Issue #9

Motivation and Context

This change pre-fetches the data provided by the mediaDevices.enumerateDevices() and mediaDevices.getSupportedConstraints when the mediaDevices object is created. This ends the delay in fetching this data later on when a user requests for it.

How Has This Been Tested?

Tested with pre existing tests.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

if (!flagConstraints) {
return this._supportedConstraints;
} else {
exec(successConstraints, null, 'Stream', 'getSupportedConstraints', []);
Copy link
Member

Choose a reason for hiding this comment

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

@maverickmishra they only thing that needs to be changes is after the exec call we'll need to:

return this._supportedConstraints;

This will return the default constraints as per the spec. Without a return statement here the function will return an undefined.

Copy link
Member Author

Choose a reason for hiding this comment

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

Had missed it for mediaDevices.enumerateDevices() as well. Fixed it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants