Skip to main content
MediaCapture.StartRecordToStorageFileAsync | startRecordToStorageFileAsync method

Applies to Windows and Windows Phone

Starts recording asynchronously to a storage file.

Syntax


mediaCapture.startRecordToStorageFileAsync(encodingProfile, file).done( /* Your success and error handlers */ );

public IAsyncAction StartRecordToStorageFileAsync(
  MediaEncodingProfile encodingProfile, 
  IStorageFile file
)

Public Function StartRecordToStorageFileAsync(
  encodingProfile As MediaEncodingProfile,  
  file As IStorageFile 
) As IAsyncAction

public:
IAsyncAction^ StartRecordToStorageFileAsync(
  MediaEncodingProfile^ encodingProfile, 
  IStorageFile^ file
)

Parameters

encodingProfile

Type: MediaEncodingProfile

The encoding profile for the recording.

file

Type: IStorageFile

The storage file where the image is saved.

Return value

Type: IAsyncAction

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

Examples

The following example shows how to create a storage file and record to that file.


// Start the video capture.
function startMediaCaptureSession() {
   Windows.Storage.KnownFolders.videosLibrary.createFileAsync("cameraCapture.mp4", Windows.Storage.CreationCollisionOption.generateUniqueName).then(function (newFile) {
        storageFile = newFile;
        oMediaCapture.startRecordToStorageFileAsync(profile, storageFile).then(function (result) {           
           
        }, errorHandler);
    }  );   
}

Requirements

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

See also

MediaCapture