diff --git a/.gitignore b/.gitignore
index d55939e..8b9cbb4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ bin
obj
.vs
*.DotSettings*
-*.user
\ No newline at end of file
+*.user
+log*
\ No newline at end of file
diff --git a/Azaion.Annotator/DTO/VideoFileInfo.cs b/Azaion.Annotator/DTO/VideoFileInfo.cs
index ea783fe..b4b1ba6 100644
--- a/Azaion.Annotator/DTO/VideoFileInfo.cs
+++ b/Azaion.Annotator/DTO/VideoFileInfo.cs
@@ -2,8 +2,9 @@
public class VideoFileInfo
{
- public string Name { get; set; } = null!;
- public string Path { get; set; } = null!;
- public TimeSpan Duration { get; set; }
- public bool HasAnnotations { get; set; }
+ public string Name { get; set; } = null!;
+ public string Path { get; set; } = null!;
+ public TimeSpan Duration { get; set; }
+ public string DurationStr => $"{Duration:h\\:mm\\:ss}";
+ public bool HasAnnotations { get; set; }
}
\ No newline at end of file
diff --git a/Azaion.Annotator/MainWindow.xaml b/Azaion.Annotator/MainWindow.xaml
index 7ebfc8b..978ea3e 100644
--- a/Azaion.Annotator/MainWindow.xaml
+++ b/Azaion.Annotator/MainWindow.xaml
@@ -62,6 +62,7 @@
+
@@ -81,10 +82,11 @@
-
+
+ DisplayMemberBinding="{Binding Path=DurationStr}"/>
@@ -144,7 +146,7 @@
CanUserResizeColumns="False">
@@ -178,6 +180,7 @@
ResizeDirection="Columns"
Grid.Column="1"
Grid.Row="1"
+ Grid.RowSpan="3"
ResizeBehavior="PreviousAndNext"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -189,9 +192,18 @@
x:Name="VideoView">
-
+
_logger;
+
public ObservableCollection AnnotationClasses { get; set; } = new();
private bool _suspendLayout;
@@ -39,7 +41,8 @@ public partial class MainWindow
IMediator mediator,
FormState formState,
IConfigRepository configRepository,
- HelpWindow helpWindow)
+ HelpWindow helpWindow,
+ ILogger logger)
{
InitializeComponent();
_libVLC = libVLC;
@@ -49,7 +52,8 @@ public partial class MainWindow
_configRepository = configRepository;
_config = _configRepository.Get();
_helpWindow = helpWindow;
-
+ _logger = logger;
+
VideoView.Loaded += VideoView_Loaded;
Closed += OnFormClosed;
}
@@ -217,15 +221,16 @@ public partial class MainWindow
var files = dir.GetFiles("mp4", "mov").Select(x =>
{
- _mediaPlayer.Media = new Media(_libVLC, x.FullName);
-
- return new VideoFileInfo
+ var media = new Media(_libVLC, x.FullName);
+ media.Parse();
+ var fInfo = new VideoFileInfo
{
Name = x.Name,
Path = x.FullName,
- Duration = TimeSpan.FromMilliseconds(_mediaPlayer.Media.Duration),
HasAnnotations = labelNames.ContainsKey(Path.GetFileNameWithoutExtension(x.Name).Replace(" ", ""))
};
+ media.ParsedChanged += (_, _) => fInfo.Duration = TimeSpan.FromMilliseconds(media.Duration);
+ return fInfo;
}).ToList();
LvFiles.ItemsSource = new ObservableCollection(files);
@@ -271,7 +276,11 @@ public partial class MainWindow
ReloadFiles();
}
- private void PlayClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Play));
+ private void PlayClick(object sender, RoutedEventArgs e)
+ {
+ _mediator.Publish(new PlaybackControlEvent(_mediaPlayer.CanPause ? PlaybackControlEnum.Pause : PlaybackControlEnum.Play));
+ }
+
private void PauseClick(object sender, RoutedEventArgs e)=> _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Pause));
private void StopClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Stop));