Add controls to the VideoPlayer

This commit is contained in:
Paddy Xu
2017-05-08 22:00:25 +03:00
parent 66759992f1
commit 0995ebb7c2
10 changed files with 225 additions and 45 deletions

View File

@@ -34,6 +34,8 @@ namespace QuickLook.Plugin.VideoViewer
using (var element = new MediaElement {Source = new Uri(path)})
{
context.SetPreferredSizeFit(new Size(element.NaturalVideoWidth, element.NaturalVideoHeight), 0.6);
context.PreferredSize = new Size(context.PreferredSize.Width,
context.PreferredSize.Height + 26); // add control bar
}
}
@@ -45,7 +47,8 @@ namespace QuickLook.Plugin.VideoViewer
_vp.LoadAndPlay(path);
context.Title = $"{Path.GetFileName(path)} ({TimeSpan.FromSeconds(_vp.mediaElement.NaturalDuration).ToString(@"hh\:mm\:ss")}, {_vp.mediaElement.NaturalVideoWidth} × {_vp.mediaElement.NaturalVideoHeight} )";
context.Title =
$"{Path.GetFileName(path)} ({_vp.mediaElement.NaturalVideoWidth}×{_vp.mediaElement.NaturalVideoHeight})";
context.IsBusy = false;
}
@@ -54,4 +57,4 @@ namespace QuickLook.Plugin.VideoViewer
_vp?.Dispose();
}
}
}
}