VideoLan.Net: Play media backwards / Change playback speed?

旧巷老猫 提交于 2019-12-11 06:56:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!