Woppi
Woppi

Reputation: 5451

Twilio Video Media Stream Constraints

I'm using Twilio Video API and just wants audio call. I passed this constraint below however, the webcam is still appearing on the invited person. It seems the constraint only works for the one who created the conversation.

Is it possible to force all clients under the conversation to disable video by default?

var options = {
    localStreamConstraints: { video: false, audio: true }
};

TwilioConversationsClient.inviteToConversation(inviteTo, options).then(conversationStarted, function (error) {
    console.error('Unable to create conversation', error);
});

Also, is it possible for browser to ask for microphone only for permissions when only audio is activated? It's weird for it to be asking both microphone and camera if it's only an audio call.

Thanks for the guidance.

Source: https://media.twiliocdn.com/sdk/js/conversations/releases/0.13.9/docs/Client.html#inviteToConversation

Upvotes: 1

Views: 566

Answers (1)

philnash
philnash

Reputation: 73065

Twilio developer evangelist here.

When a user receives an invite to join a conversation you can pass the options for the media into the accept method. A bit like this:

client.on('invite', function(invite) {
  invite.accept({localStreamConstraints:{audio:true,video:false}})
});

When you do that, it should pass the constraints down to the browser's getUserMedia implementation and just ask for the relevant permissions.

Let me know if that helps at all.

Upvotes: 1

Related Questions