Add or remove audio in a conversation
Applies to: Skype for Business 2015
In this article
Add audio to a conversation
Remove audio from a conversation
Subscribe to changes from the audioService in a conversation
Accept video and sending video automatically
Mute a conversation
Put a conversation on hold
With an existing conversation instance, audio can be added or removed.
Add audio to a conversation
conversation.audioService.start().then(function () {
// Successfully added audio to the conversation
});
Remove audio from a conversation
Conversation.audioService.stop().then(function () {
// Successfully removed audio from the conversation
});
Subscribe to changes from the audioService in a conversation
An event is fired when the client has successfully added audio to the conversation, or another participant has invited the client to add audio.
- Subscribe to the event.
conversation.selfParticipant.audio.state.changed(function (val) {
…
});
- If the val argument in the previous snippet indicates the event is an invitation to add audio, the client may reject or accept the invitation.
if (val == 'Notified') {
if (confirm('Accept incoming audio request?')) {
console.log('accepting the incoming audio request');
conversation.audioService.accept();
console.log('Accepting incoming audio request');
} else {
console.log('declining the incoming audio request');
conversation.audioService.reject();
}
}
Accept video and send video automatically
Calling videoService.accept() in response to an audio invitation does nothing. Calling videoService.accept() in response to a video invitation will accept the audio and video and start its own video as well.
- Subscribe to the audio state changed event.
conversation.selfParticipant.audio.state.changed(function (val) {
…
});
- If the val argument in the previous snippet indicates the event is an invitation to add audio, the client may accept the invitation while also sending their own video in Skype, as follows.
if (val == 'Notified') {
conversation.videoService.accept();
}
Mute a conversation
The client may temporarily mute their own audio in the conversation.
// Toggle muting the client's audio
conversation.selfParticipant.audio.isMuted.set(!audio.isMuted());
Put a conversation on hold
The client may also place itself on hold, temporarily pausing all incoming and outgoing audio.
// Toggle placing the conversation on hold
var isOnHold = conversation.selfParticipant.audio.isOnHold();
conversation.selfParticipant.audio.isOnHold.set(!isOnHold);