Memory playback in Media Player SDK .Net

Related 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[])
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);

2. Set mode

MediaPlayer1.Source_Mode = MediaPlayerSourceMode.Memory_DS;

3. Start playback

await MediaPlayer1.PlayAsync();
Please contact support to get help with this tutorial. Visit our GitHub page to get more code samples.
abstract 2abstract 1abstract 3
logo
VisioForge © 2006 - 2022