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

FCE-457: Allow user to only initialise audio or video #245

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

MiloszFilimowski
Copy link
Contributor

Description

  • Added params to initializeDevices function.

Motivation and Context

  • Provide the ability for users to only ask for a single permission at a time.

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
    not work as expected)

Copy link

linear bot commented Jan 12, 2025

Copy link
Collaborator

@czerwiukk czerwiukk left a comment

Choose a reason for hiding this comment

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

some cosmetic changes, the api lgtm

Comment on lines 39 to 42
const constraints = {
video: enableVideo ? videoManager.getConstraints() : false,
audio: enableAudio ? audioManager.getConstraints() : false,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick:

Suggested change
const constraints = {
video: enableVideo ? videoManager.getConstraints() : false,
audio: enableAudio ? audioManager.getConstraints() : false,
};
const constraints = {
video: enableVideo && videoManager.getConstraints(),
audio: enableAudio && audioManager.getConstraints(),
};

Comment on lines 51 to 54
let [stream, deviceErrors] = await getAvailableMedia({
video: enableVideo ? prepareConstraints(previousDevices.video?.deviceId, constraints.video) : false,
audio: enableAudio ? prepareConstraints(previousDevices.audio?.deviceId, constraints.audio) : false,
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick:

Suggested change
let [stream, deviceErrors] = await getAvailableMedia({
video: enableVideo ? prepareConstraints(previousDevices.video?.deviceId, constraints.video) : false,
audio: enableAudio ? prepareConstraints(previousDevices.audio?.deviceId, constraints.audio) : false,
});
let [stream, deviceErrors] = await getAvailableMedia({
video: enableVideo && prepareConstraints(previousDevices.video?.deviceId, constraints.video),
audio: enableAudio && prepareConstraints(previousDevices.audio?.deviceId, constraints.audio),
});

Comment on lines 30 to 31
async (params?: UseInitializeDevicesParams) => {
const { enableVideo = true, enableAudio = true } = params || {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick:

Suggested change
async (params?: UseInitializeDevicesParams) => {
const { enableVideo = true, enableAudio = true } = params || {};
async (params: UseInitializeDevicesParams = { enableVideo = true, enableAudio = true }) => {

Copy link
Contributor Author

@MiloszFilimowski MiloszFilimowski Jan 14, 2025

Choose a reason for hiding this comment

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

Do you mean it like that?

async ({ enableVideo = true, enableAudio = true }: UseInitializeDevicesParams = {}) => 

The above solution won't work 🤔

@MiloszFilimowski MiloszFilimowski enabled auto-merge (squash) January 14, 2025 10:51
@MiloszFilimowski MiloszFilimowski merged commit 60822b7 into main Jan 14, 2025
2 checks passed
@MiloszFilimowski MiloszFilimowski deleted the mfilimowski/FCE-457-allow-single-source branch January 14, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants