Related products: Media Player SDK .Net

Memory playback in Media Player SDK .Net

1. Create stream based on existing file

var _fileStream = new FileStream(edFilename.Text, FileMode.Open);
var _stream = new ManagedIStream(_fileStream);

MediaPlayer1.Source_Stream = _stream;
MediaPlayer1.Source_Stream_Size = _fileStream.Length;

or from memory array (_memorySource is byte[])

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

MediaPlayer1.Source_Stream = _stream;
MediaPlayer1.Source_Stream_Size = _memoryStream.Length;

2. Set audio and video availability flag

// true if video stream available
MediaPlayer1.Source_Stream_VideoPresent = true;

// true if audio stream available
MediaPlayer1.Source_Stream_AudioPresent = true;

3. Set mode

MediaPlayer1.Source_Mode = VFMediaPlayerSource.Memory_DS;

4. Start playback

MediaPlayer1.Play();

VisioForge © 2006-2019

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel