how to create custom media sink?

mc 3,221 Reputation points

I created MediaCapture to capture usb webcam and want to post the stream to the api.

there is StartRecordToCustomSinkAsync and how to create custom sink?

I want a stream sink and when data received I can post the data to the remote api.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
655 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 7,696 Reputation points Microsoft Vendor


    Welcome to Microsoft Q&A!

    If you want to create custom sink.

    I suggest you could refer to the Doc: Using Custom Sinks

    To create your own sink, implement the IWMWriterSink interface in a class in your application.

    If you want to know how to get the IMediaExtension.

    I suggest you could refer to the sample:

    // Create new sink
                    mediaSink = new StspMediaSinkProxy();
                    mediaSink.IncomingConnectionEvent += mediaSink_IncomingConnectionEvent;
                    var mfExtension = await mediaSink.InitializeAsync(encodingProfile.Audio, encodingProfile.Video);
                    await mediaCapture.StartRecordToCustomSinkAsync(encodingProfile, mfExtension);

    According to the sample, as far as I'm concerned, you could get IMediaExtension from MediaEncodingProfile.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful