Win8 Metro MediaCapture Class

Source: Internet
Author: User

Recently contacted by the project is about WIN8 Metro Camera project, where the more important class is the Mediacapture class, now introduce the Mediacapture class, also summarizes some of their own project experience:

Here are some method invocations of the Mediacapture class:

Using system;using windows.foundation;using windows.foundation.collections;using windows.foundation.metadata;using Windows.media;using windows.media.devices;using windows.media.mediaproperties;using Windows.Storage;using Windows.storage.streams;namespace windows.media.capture{//Summary://provides functionality for capturing pho    TOS, audio, and videos from a capture//device, such as a webcam.    [Activatable (100794368)]    [Dualapipartition (Version = 100794368)]    [Marshalingbehavior (Marshalingtype.standard)]    [Threading (THREADINGMODEL.MTA)] [Version (100794368)] public sealed class Mediacapture:idisposable {//Create an instance of a MediaCapture object pub        Lic MediaCapture (); Returns an object that controls the microphone setting, Audiodevicecontroller object is the object that controls microphone settings public Audiodevicecontroller        Audiodevicecontroller {get;} The Mediacapturesettings object contains the settings of the Mediacapture, which returns the settings of the Mediacapture object, public mediacapturesettings Mediac Apturesettings {get;} Returns an object that controls the settings of the video camera, Videodevicecontroller is the object public Videodevicecontroller Videodeviceco        Ntroller {get;}  Summary://This is the events of the Mediacapture class, which occurs when an error occurs while media is capturing the public event Mediacapturefailedeventhandler        Failed; Summary://This is also the events of the Mediacapture class, which triggers this event when the record limit is exceeded Recordlimitationexceededeve        Nthandler recordlimitationexceeded;        Summary://Adds an audio or video effect. Parameters://Mediastreamtype://Specifies the streams to which the effect would be APPL        Ied.         Effectactivationid://The class identifier of the Activatable runtime class that implements the Effect.        The runtime class must implement the Imediaextension interface.        Effectsettings://Configuration parameters for the effect.    Returns:    Returns an Iasyncaction object, which is used to control the asynchronous operation. Public iasyncaction Addeffectasync (Mediastreamtype mediastreamtype, string Effectactivationid, Ipropertyset        Effectsettings);        Summary://Captures a photo to a storage file.        Parameters://Type://The encoding properties for the output image.        File://The storage file where the image is saved.        Returns://Returns an Iasyncaction object which is used to control the asynchronous operation.        Public iasyncaction Capturephototostoragefileasync (imageencodingproperties type, istoragefile file);        Summary://Captures a photo to a random-access stream.        Parameters://Type://The encoding properties for the output image. Stream://The stream where the Image data is written.        Returns://Returns an Iasyncaction object which is used to control the asynchronous operation.        Public iasyncaction Capturephototostreamasync (imageencodingproperties type, Irandomaccessstream stream);        Summary://Removes all audio and video effects from a stream.        Parameters://Mediastreamtype://The stream from which to remove the effects.        Returns://Returns A Iasyncaction object that's used to control the asynchronous operation.        Public iasyncaction Cleareffectsasync (Mediastreamtype mediastreamtype);     Summary://performs tasks associated with freeing, releasing, or resetting unmanaged//        Resources.        public void Dispose ();        Summary://Gets The value of a encoding property. Parameters://Mediastreamtype://     Specifies the stream to a query for the encoding property.        PropertyId://The Encoding property to retrieve.        Returns://Returns The value of the Encoding property.        public Object Getencoderproperty (Mediastreamtype mediastreamtype, Guid PropertyId);        Summary://Queries whether the video stream is mirrored horizontally. Returns://True if mirroring is enabled;        False otherwise.        public bool Getpreviewmirroring ();        Summary://Gets The rotation of the video preview stream.        Returns://The amount by which, the video preview stream is rotated.        Public videorotation getpreviewrotation ();        Summary://Gets The rotation of the recorded video.        Returns://The amount by which, the recorded video is rotated. Public VideorotatiOn Getrecordrotation ();        Summary://Initializes the MediaCapture object, using default settings.        Returns://Returns A Iasyncaction object that's used to control the asynchronous operation.        [Overload ("Initializeasync")] public iasyncaction initializeasync ();        Summary://initializes the MediaCapture object.        Parameters://Mediacaptureinitializationsettings://The initialization settings.        Returns://Returns A Iasyncaction object that's used to control the asynchronous operation. [Overload ("Initializewithsettingsasync")] public iasyncaction Initializeasync (Mediacaptureinitializationsetti        NGS mediacaptureinitializationsettings);        Summary://initializes the low shutter lag photo capture and provides the Lowlagphotocapture Object used to manage the RecordiNg.        Parameters://Type://The encoding profile used for the image.     Returns://When the This method completes, a Lowlagphotocapture object is returned which//        Can is used to start the photo capture.        Public iasyncoperation<lowlagphotocapture> Preparelowlagphotocaptureasync (imageencodingproperties type); Summary://initializes the low shutter lag photo sequence capture and provides the LOWLAGPHOTOSEQ        Uencecapture//Object used to manage the recording.        Parameters://Type://The encoding profile used for the image.     Returns://When the method completes, a Lowlagphotosequencecapture object is returned//        which can used to start the photo sequence capture. Public iasyncoperation<lowlagphotosequencecapture> Preparelowlagphotosequencecaptureasync (ImageEncodingProperties type);     Summary://Initializes the low lag recording using the specified custom sink to store// The recording.        This method provides the Lowlagmediarecording object used//to managed the capture.        Parameters:///Encodingprofile:///The encoding profile to use for the recording.        Custommediasink://The media extension for the custom media sink.     Returns://When the This method completes, a Lowlagmediarecording object is returned which//        Can is used to start the photo capture. [Overload ("Preparelowlagrecordtocustomsinkasync")] public iasyncoperation<lowlagmediarecording>        Preparelowlagrecordtocustomsinkasync (Mediaencodingprofile encodingprofile, imediaextension customMediaSink);  Summary://Initializes the low lag recording using the specified custom sink to store      The recording.        This method provides the Lowlagmediarecording object used//to managed the recording.        Parameters:///Encodingprofile:///The encoding profile to use for the recording.  Customsinkactivationid://The Activatable class ID of the media extension for the custom media        Sink.        Customsinksettings://Contains properties of the media extension.     Returns://When the This method completes, a Lowlagmediarecording object is returned which//        Can is used to start the photo capture. [Overload ("Preparelowlagrecordtocustomsinkidasync")] public iasyncoperation<lowlagmediarecording> Preparelowlagrecordtocustomsinkasync (Mediaencodingprofile encodingprofile, String Customsinkactivationid,        Ipropertyset customsinksettings); Summary://Initializes the low lag recording using the Specified file to store the recording.        This method provides the Lowlagmediarecording object used to managed the//recording.        Parameters://Encodingprofile://The encoding profile for the recording.        File://The storage file where the image is saved.     Returns://When the This method completes, a Lowlagmediarecording object is returned which//        Can is used to start the photo capture. Public iasyncoperation<lowlagmediarecording> Preparelowlagrecordtostoragefileasync (MediaEncodingProfile        Encodingprofile, istoragefile file);     Summary://Initializes the low lag recording using the specified random-access stream// To store the recording.        This method provides the Lowlagmediarecording object//used to managed the recording.       Parameters://Encodingprofile: The encoding profile is for the recording.        Stream://The stream where the image data is written.     Returns://When the This method completes, a Lowlagmediarecording object is returned which//        Can is used to start the photo capture. Public iasyncoperation<lowlagmediarecording> Preparelowlagrecordtostreamasync (MediaEncodingProfile        Encodingprofile, Irandomaccessstream Stream);        Summary://sets an encoding property. Parameters://Mediastreamtype://The type of media data the stream represents, such as        Video or audio.        PropertyId://The Encoding property to set.        PropertyValue://The new value of the Encoding property.        public void Setencoderproperty (Mediastreamtype mediastreamtype, Guid PropertyId, Object propertyvalue); Summary://     Asynchronously sets the media encoding properties. Parameters://Mediastreamtype://The type of media data the stream represents, such as        Video or audio.        Mediaencodingproperties://The properties for the media encoding.        Encoderproperties://The properties for the encoder.        Returns://Object that's used to control the asynchronous operation. Public iasyncaction Setencodingpropertiesasync (Mediastreamtype mediastreamtype, imediaencodingproperties        Mediaencodingproperties, Mediapropertyset encoderproperties);        Summary://Enables or disables horizontal mirroring of the video preview stream. Parameters://value://True to enable mirroring;        False to disable mirroring.        public void setpreviewmirroring (bool value); Summary://Rotates THe video preview stream.        Parameters://value://The amount by which to rotate the video.        public void Setpreviewrotation (videorotation value);        Summary://Rotates the recorded video.        Parameters://value://The amount by which to rotate the video.        public void Setrecordrotation (videorotation value);        Summary://Starts preview.        Returns://Returns A Iasyncaction object that's used to control the asynchronous operation.        Public iasyncaction Startpreviewasync ();     Summary://starts sending a preview stream to a custom media sink using the specified//        Encoding profile.        Parameters:///Encodingprofile:///The encoding profile to use for the recording. Custommediasink://The Media extensIon for the custom media sink.        Returns://An object, used to control the asynchronous operation. [Overload ("Startpreviewtocustomsinkasync")] public iasyncaction Startpreviewtocustomsinkasync (        Mediaencodingprofile Encodingprofile, imediaextension custommediasink);     Summary://starts sending a preview stream to a custom media sink using the specified//        Encoding profile and sink settings.        Parameters:///Encodingprofile:///The encoding profile to use for the recording.  Customsinkactivationid://The Activatable class ID of the media extension for the custom media        Sink.        Customsinksettings://Contains properties of the media extension.        Returns://An object, used to control the asynchronous operation.  [Overload ("Startpreviewtocustomsinkidasync")]      Public iasyncaction Startpreviewtocustomsinkasync (mediaencodingprofile encodingprofile, String customSinkActivation        Id, Ipropertyset customsinksettings);        Summary://Start Recording to a custom media sink using the specified encoding profile.        Parameters:///Encodingprofile:///The encoding profile to use for the recording.        Custommediasink://The media extension for the custom media sink.        Returns://An object, used to control the asynchronous operation. [Overload ("Startrecordtocustomsinkasync")] public iasyncaction Startrecordtocustomsinkasync (MediaEncodingProfile E        Ncodingprofile, Imediaextension Custommediasink);     Summary://Start Recording to a custom media sink using the specified encoding profile//        and sink settings.    Parameters://Encodingprofile:    The encoding profile to use for the recording. Customsinkactivationid://The Activatable class ID of the media extension for the custom media        Sink.        Customsinksettings://Contains properties of the media extension.        Returns://AnObject that's used to control the asynchronous operation. [Overload ("Startrecordtocustomsinkidasync")] public iasyncaction Startrecordtocustomsinkasync (        Mediaencodingprofile encodingprofile, String customsinkactivationid, Ipropertyset customsinksettings);        Summary://Starts recording asynchronously to a storage file.        Parameters://Encodingprofile://The encoding profile for the recording.        File://The storage file where the image is saved. Returns://Returns A Iasyncaction object that's used to control THe asynchronous operation.        Public iasyncaction Startrecordtostoragefileasync (mediaencodingprofile encodingprofile, IStorageFile file);        Summary://Starts recording to a random-access stream.        Parameters://Encodingprofile://The encoding profile for the recording.        Stream://The stream where the image data is written.        Returns://Returns A Iasyncaction object that's used to control the asynchronous operation.        Public iasyncaction Startrecordtostreamasync (mediaencodingprofile encodingprofile, Irandomaccessstream stream);        Summary://Stops Preview.        Returns://Returns A Iasyncaction object that's used to control the asynchronous operation.        Public iasyncaction Stoppreviewasync ();        Summary://Stops recording.      Returns:  Returns a Iasyncaction object that's used to control the asynchronous operation.    Public iasyncaction Stoprecordasync (); }}

Mediacapture class mainly uses some capturing devices, such as camera, microphone, etc., capturing photos, audio, video, etc., and provides some other functions;

Its namespace is the using Windows.Media.Capture;


If you want to see some examples of the use, it is recommended to go to the WIN8 official web site, or I have two of blog posts in the case there are some involved, thank you, this issue is introduced here.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.