AddEffectAsync | addEffectAsync method
TOC
Collapse the table of content
Expand the table of content

MediaCapture.AddEffectAsync | addEffectAsync method

Adds an audio or video effect.

Syntax


mediaCapture.addEffectAsync(mediaStreamType, effectActivationID, effectSettings).done( /* Your success and error handlers */ );

Parameters

mediaStreamType

Type: MediaStreamType

Specifies the streams to which the effect will be applied.

effectActivationID

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The class identifier of the activatable runtime class that implements the effect. The runtime class must implement the IMediaExtension interface.

effectSettings

Type: IPropertySet

Configuration parameters for the effect.

Return value

Type: IAsyncAction

Returns an IAsyncAction object that is used to control the asynchronous operation.

Remarks

AddEffectAsync must complete before another effect can be added to the MediaCapture object.

See Effects for video capture for an example of adding Windows.Media.VideoEffects.VideoStabilization effect.

With some cameras (USB webcams in particular), record/preview/photo all come from the same video stream. So applying an effect to one applies the effect to all. Whether video streams are identical or independent is given by MediaCapture.MediaCaptureSettings.VideoDeviceCharacteristic. The following sample code shows adding an adding an effect to the preview stream, checking to see if the preview and record streams use the same stream, and if not, the effect is added to the record stream as well.


await capture.AddEffectAsync(MediaStreamType.VideoPreview, "Extensions.MyEffect", null);

// If preview and record are different streams, also add the effect to the record stream as well
if ((capture.MediaCaptureSettings.VideoDeviceCharacteristic != VideoDeviceCharacteristic.AllStreamsIdentical) && 
    (capture.MediaCaptureSettings.VideoDeviceCharacteristic != VideoDeviceCharacteristic.PreviewRecordStreamsIdentical))
{
    await capture.AddEffectAsync(MediaStreamType.VideoRecord, "Extensions.MyEffect", null);
}

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Media.Capture
Windows::Media::Capture [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Capabilities

webcam
microphone

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Media.Capture
Windows::Media::Capture [C++]

Metadata

Windows.winmd

Capabilities

webcam
microphone

Attributes

[Deprecated()]

See also

MediaCapture

 

 

Show:
© 2016 Microsoft