how to play from stream?

mc 3,221 Reputation points
2023-11-17T01:04:11.2066667+00:00
var ms=new MemoryStream();
MediaSource.CreateFromStream(ms.AsRandomAccessStream(),"video/mp4");
while(true)
{
//here I will read from another stream to buffer.
ms.Write(buffer,0,buffer.Length);
}

but it will not play the video. and will throw exception that System.OutOfMemoryException but the length is only 130Mb of the stream.

why?

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.
653 questions
{count} votes