AudioVideoFlow.BeginApplyChanges Method (AudioVideoFlowTemplate, AsyncCallback, Object)
Applies changes from the specified template.
Namespace: Microsoft.Rtc.Collaboration.AudioVideo
Assembly: Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)
Syntax
'Declaration
Public Function BeginApplyChanges ( _
template As AudioVideoFlowTemplate, _
userCallback As AsyncCallback, _
state As Object _
) As IAsyncResult
'Usage
Dim instance As AudioVideoFlow
Dim template As AudioVideoFlowTemplate
Dim userCallback As AsyncCallback
Dim state As Object
Dim returnValue As IAsyncResult
returnValue = instance.BeginApplyChanges(template, _
userCallback, state)
public IAsyncResult BeginApplyChanges(
AudioVideoFlowTemplate template,
AsyncCallback userCallback,
Object state
)
Parameters
- template
Type: Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoFlowTemplate
The template to be used as a reference.
- userCallback
Type: System.AsyncCallback
The method to be called when the asynchronous operation is completed.
- state
Type: System.Object
A user-provided object that distinguishes this particular asynchronous operation from other asynchronous operations.
Return Value
Type: System.IAsyncResult
An IAsyncResult that references the asynchronous operation.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | Thrown when the AudioVideoFlow is not in the Active state, or when the template has no channels, or when the template's HoldType property is not equal to either None or the AudioVideoFlow's current HoldStatus, or when there is already an asynchronous operation in progress. |
ArgumentNullException | Thrown when the template argument is null. |
Remarks
This method cannot be used to change the AudioVideoFlow's hold status. Call BeginHold to put the AudioVideoFlow on hold, and BeginRetrieve to unhold. The value of the template's HoldType property must be equal to either None or the current value of the AudioVideoFlow HoldStatus property. A value of None will not change the AudioVideoFlow's hold status.
Examples
The following example applies changes to an AudioVideoFlow.
C# Modifying AudioChannelTemplate properties.
AudioVideoFlowTemplate templateToApply = new AudioVideoFlowTemplate(audioVideoFlow);
AudioChannelTemplate audioChannelTemplate = (AudioChannelTemplate)templateToApply.Audio.GetChannels()[ChannelLabel.AudioMono];
audioChannelTemplate.AllowedDirection = MediaChannelDirection.SendOnly;
audioChannelTemplate.SendDirectionSamplingRate = AudioSamplingRate.EightKhz;
// ApplyChanges
audioVideoFlow.BeginApplyChanges(
templateToApply,
new AsyncCallback(delegate(IAsyncResult result)
{
try
{
audioVideoFlow.EndApplyChanges(result);
}
catch (RealTimeException e)
{
// handle exception
throw e;
}
// ApplyChanges is done, verify changes result..
AudioChannel audioChannel = audioVideoFlow.Audio.GetChannels()[ChannelLabel.AudioMono];
if (audioChannel.Direction == MediaChannelDirection.SendOnly &&
audioChannel.SendDirectionSamplingRate == AudioSamplingRate.EightKhz)
{
// remote side accepted changes as they were
}
else
{
// remote side accepted changes but filtered them more.
}
}),
this);