Generate video thumbnails
This commit is contained in:
@ -26,7 +26,7 @@ struct FileContentView: View {
|
||||
} else {
|
||||
switch file.type.category {
|
||||
case .image:
|
||||
file.imageToDisplay
|
||||
(file.imageToDisplay ?? Image(systemSymbol: .exclamationmarkTriangle))
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
case .model:
|
||||
@ -44,14 +44,19 @@ struct FileContentView: View {
|
||||
.id(file.id)
|
||||
case .video:
|
||||
VStack {
|
||||
Image(systemSymbol: .film)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: iconSize)
|
||||
Text("No preview available")
|
||||
.font(.title)
|
||||
}
|
||||
.foregroundStyle(.secondary)
|
||||
if let image = file.imageToDisplay {
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
} else {
|
||||
Image(systemSymbol: .film)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: iconSize)
|
||||
Button("Generate preview", action: generateVideoPreview)
|
||||
.font(.body)
|
||||
}
|
||||
}.foregroundStyle(.secondary)
|
||||
case .resource:
|
||||
VStack {
|
||||
Image(systemSymbol: .docQuestionmark)
|
||||
@ -76,6 +81,10 @@ struct FileContentView: View {
|
||||
}
|
||||
}.padding()
|
||||
}
|
||||
|
||||
private func generateVideoPreview() {
|
||||
file.createVideoThumbnail()
|
||||
}
|
||||
}
|
||||
|
||||
extension FileContentView: MainContentView {
|
||||
|
Reference in New Issue
Block a user