Skip to main content

Previous frame and reverse video playback

Products: Media Player SDK .Net

MediaPlayerCoreX engine (cross-platform)

To use reverse playback, set the rate to a negative value. Use the -2.0 value to play the video in reverse at double speed.

Sample code:

// create new instance of MediaPlayerCoreX
MediaPlayerCoreX MediaPlayer1 = new MediaPlayerCoreX(VideoView1);

// set the source file
var fileSource = await UniversalSourceSettings.CreateAsync(new Uri("video.mp4"));
await MediaPlayer1.OpenAsync(fileSource);

// start playback
await MediaPlayer1.PlayAsync();

// set rate to -1.0
MediaPlayer1.Rate_Set(-1.0);

MediaPlayerCore engine (Windows-only)

Sometimes, a previous frame playback is required, but most video codecs do not support this feature. Media Player SDK .Net can use caching of several previous frames (100 by default) to resolve this problem. To use it, you must set

MediaPlayer1.ReversePlayback_CacheSize = 100; // set cache size

MediaPlayer1.ReversePlayback_Enabled = true; // enable playback

before the Play method call.

After the Play call, you can navigate to the previous frame using

MediaPlayer1.ReversePlayback_PreviousFrame();

call.

Required redists

  • Base redist
  • SDK redist

Visit our GitHub page to get more code samples.