[UWP] how to set video source of media player as frame of Platform::Array<uint8> captured by UDP communication

WooHyun Ahn 1 Reputation point
2022-09-28T07:11:31.12+00:00

Hi.

I'm modifying a 360VideoPlayback projects of UWP samples to play video frames captured by custom UDP communication.

Video frames of UYVY format are stored in variable of Platform::Array<uint8> every 33 ms (about 1/30fps). Then, how can I feed these frames into Media Player?

I found this tutorial, but it seems that only real device can be used as media source.

https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/process-media-frames-with-mediaframereader#use-mediasource-to-display-frames-in-a-mediaplayerelement

Now, I'm trying as follows

static Windows::Media::Playback::MediaPlayer^ m_mediaPlayer;

// How to assignvariable of Platform::Array<uint8> into mediaFrameSource ??

Frames::MediaFrameSource^ mediaFrameSource;
MediaSource^ source = MediaSource::CreateFromMediaFrameSource(mediaFrameSource);

m_mediaPlayer->MediaOpened += ref new TypedEventHandler<MediaPlayer^, Object^>(this, &AppView::OnMediaOpened);
m_mediaPlayer->Source = source;

Thanks in advance

Universal Windows Platform (UWP)
{count} votes