diff --git a/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift b/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift index 5e6c67b6..e8f11bac 100644 --- a/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift +++ b/Packages/MediaUI/Sources/MediaUI/MediaUIAttachmentVideoView.swift @@ -3,6 +3,7 @@ import DesignSystem import Env import Observation import SwiftUI +import Models @MainActor @Observable public class MediaUIAttachmentVideoViewModel { @@ -74,6 +75,7 @@ import SwiftUI @MainActor public struct MediaUIAttachmentVideoView: View { + @Environment(\.openWindow) private var openWindow @Environment(\.scenePhase) private var scenePhase @Environment(\.isMediaCompact) private var isCompact @Environment(UserPreferences.self) private var preferences @@ -101,7 +103,13 @@ public struct MediaUIAttachmentVideoView: View { viewModel.play() return } + #if targetEnvironment(macCatalyst) + viewModel.pause() + let attachement = MediaAttachment.videoWith(url: viewModel.url) + openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement], selectedAttachment: attachement)) + #else isFullScreen = true + #endif } .fullScreenCover(isPresented: $isFullScreen) { NavigationStack { diff --git a/Packages/Models/Sources/Models/MediaAttachement.swift b/Packages/Models/Sources/Models/MediaAttachement.swift index 1c52776d..6c6945ef 100644 --- a/Packages/Models/Sources/Models/MediaAttachement.swift +++ b/Packages/Models/Sources/Models/MediaAttachement.swift @@ -53,6 +53,15 @@ public struct MediaAttachment: Codable, Identifiable, Hashable, Equatable { description: "demo alt text here", meta: nil) } + + public static func videoWith(url: URL) -> MediaAttachment { + .init(id: UUID().uuidString, + type: "video", + url: url, + previewUrl: url, + description: nil, + meta: nil) + } } extension MediaAttachment: Sendable {}