Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ui/Controls/VideoPlayer/VideoPlayerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ public VideoPlayerControl(IVideoPlayer videoPlayerInstance)
Margin = new Thickness(2, 0, 0, 0),
[AutomationProperties.NameProperty] = Se.Language.General.VideoPosition,
};

// Right-click the position slider to jump to / copy the current video position
// (SE4 parity for the old "Video position" control).
var goToPositionItem = new Avalonia.Controls.MenuItem { Header = Se.Language.Options.Shortcuts.GeneralGoToVideoPosition };
goToPositionItem.Click += (_, _) => GoToPositionRequested?.Invoke();
var copyPositionItem = new Avalonia.Controls.MenuItem { Header = Se.Language.General.Copy };
copyPositionItem.Click += (_, _) => CopyPositionRequested?.Invoke();
sliderPosition.ContextFlyout = new MenuFlyout { Items = { goToPositionItem, copyPositionItem } };

if (Se.Settings.Appearance.ShowHints)
{
ToolTip.SetTip(sliderPosition, Se.Language.General.VideoPosition);
Expand Down Expand Up @@ -671,6 +680,8 @@ private void OnVideoWheelChanged(object? sender, PointerWheelEventArgs e)
public event Action<double>? UserSeeked;
public event Action<double>? VolumeChanged;
public event Action? ToggleDisplayProgressTextModeRequested;
public event Action? GoToPositionRequested;
public event Action? CopyPositionRequested;
public event Action<PointerPressedEventArgs>? VideoFileNamePointerPressed;

public void SetPlayPauseIcon(bool isPlaying)
Expand Down
2 changes: 2 additions & 0 deletions src/ui/Features/Main/Layout/InitVideoPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public static Grid MakeLayoutVideoPlayer(MainViewModel vm, Thickness nonFullScre
control.VideoFileNamePointerPressed += vm.VideoPlayerControlPointerPressed;
control.SurfacePointerPressed += (_, _) => vm.VideoPlayerAreaPointerPressed();
control.UserSeeked += vm.OnVideoPlayerUserSeeked;
control.GoToPositionRequested += () => vm.ShowGoToVideoPositionCommand.Execute(null);
control.CopyPositionRequested += () => vm.CopyVideoPositionCommand.Execute(null);

Grid.SetRow(control, 0);
mainGrid.Children.Add(control);
Expand Down
15 changes: 15 additions & 0 deletions src/ui/Features/Main/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5303,6 +5303,21 @@ private async Task ShowGoToVideoPosition()
}
}

[RelayCommand]
private async Task CopyVideoPosition()
{
var vp = GetVideoPlayerControl();
if (vp == null || Window == null || string.IsNullOrEmpty(_videoFileName))
{
return;
}

// Copy the current position as a timecode, applying the same video offset the player
// shows. SE4 parity: the old "Video position" control let you copy the current position.
var seconds = vp.Position + Se.Settings.General.CurrentVideoOffsetInMs / 1000.0;
await ClipboardHelper.SetTextAsync(Window, TimeCode.FromSeconds(seconds).ToDisplayString());
}

[RelayCommand]
private void ToggleIsWaveformToolbarVisible()
{
Expand Down