Add video type support for media attachement (reading)

This commit is contained in:
Thomas Ricouard 2022-12-30 18:40:10 +01:00
parent f215298917
commit b2d4d151e5
3 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import SwiftUI
import Env
@MainActor
extension View {
public func statusEditorToolbarItem(routeurPath: RouterPath) -> some ToolbarContent {
ToolbarItem(placement: .navigationBarTrailing) {

View File

@ -11,7 +11,7 @@ public struct MediaAttachement: Codable, Identifiable, Hashable {
}
public enum SupportedType: String {
case image, gifv
case image, gifv, video
}
public func hash(into hasher: inout Hasher) {

View File

@ -126,7 +126,7 @@ public struct StatusMediaPreviewView: View {
.shimmering()
})
}
case .gifv:
case .gifv, .video:
if let url = attachement.url {
VideoPlayerView(viewModel: .init(url: url))
.frame(height: imageMaxHeight)
@ -158,7 +158,7 @@ public struct StatusMediaPreviewView: View {
}
.frame(width: isCompact ? imageMaxHeight : proxy.frame(in: .local).width)
.frame(height: imageMaxHeight)
case .gifv:
case .gifv, .video:
if let url = attachement.url {
VideoPlayerView(viewModel: .init(url: url))
.frame(width: isCompact ? imageMaxHeight : proxy.frame(in: .local).width)