Skip to main content

Memory playback

Products: Media Player SDK .Net

Sample code

  1. Create a stream based on the existing file
var _fileStream = new FileStream(edFilename.Text, FileMode.Open);
var _stream = new ManagedIStream(_fileStream);

var videoPresent = true;
var audioPresent = true;

MediaPlayer1.Source_MemoryStream = new MemoryStreamSource(_stream, videoPresent, audioPresent, _fileStream.Length);

or from the memory array (_memorySource is byte array)

var _memoryStream = new MemoryStream(_memorySource);
var _stream = new ManagedIStream(_memoryStream);

var videoPresent = true;
var audioPresent = true;

MediaPlayer1.Source_MemoryStream = new MemoryStreamSource(_stream, videoPresent, audioPresent, _memoryStream.Length);
  1. Set mode
MediaPlayer1.Source_Mode = MediaPlayerSourceMode.Memory_DS;
  1. Start playback
await MediaPlayer1.PlayAsync();

Required redists

  • Base redist
  • SDK redist

How can the required redists be installed or deployed to the user's PC?


Visit our GitHub page to get more code samples.