问题
I have been given a new requirement that I make the option available to play media files in reverse, and the option to be able to increase/decrease playback speed.
The program with which I am working relies on VideoLan.Net to handle all our media playback needs, so the question I have is this:
Using VideoLan.Net, is it possible to play media backwards, and is it possible to increase/decrease the playback speed?
回答1:
vlc can not play media in reverse.
With LibVLC it certainly is possible to increase/decrease the playback speed: see libvlc_media_player_set_rate(float rate).
Use e.g 0.5f for half speed, 1.0f to return to normal speed, 2.0f for double speed and so on.
回答2:
You could use position, remembering that it implies a little play (used by VLC in order to re-render):
float deltaStep = (float)60000 / vlcControl.Length;
float backwardStep = deltaStep * 0.0000015f;
while (vlcControl.Position > backwardStep)
{
vlcControl.Position -= backwardStep * vlcControl.Rate;
}
For increasing/decreasing/normalizing playback speed:
vlcControl.Rate *= 2; // Faster
...
vlcControl.Rate /= 2; // Slower
...
vlcControl.Rate = 1.0f; // Normal
来源:https://stackoverflow.com/questions/21949702/videolan-net-play-media-backwards-change-playback-speed