Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Last active October 19, 2021 14:27
Show Gist options
  • Save rdelrosario/ea27804572b2311a594acfd760d1135f to your computer and use it in GitHub Desktop.
Save rdelrosario/ea27804572b2311a594acfd760d1135f to your computer and use it in GitHub Desktop.
public class MainViewModel : INotifyPropertyChanged {
...
public TimeSpan Position { get; set; }
public MainViewModel() {
...
_videoPlayerStateMachine.Configure(VideoState.Playing)
.OnActivate(OnStateEntry)
.OnEntry(OnStateEntry)
.Permit(VideoTrigger.Pause, VideoState.Paused)
.Permit(VideoTrigger.Stop, VideoState.Stopped)
.InternalTransition(VideoTrigger.Rewind, ()=> {
Position = Position.Subtract(TimeSpan.FromSeconds(5));
})
.InternalTransition(VideoTrigger.Forward, () => {
Position = Position.Add(TimeSpan.FromSeconds(5));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment