         })
     }
 
+    private func showTimeLimitError() {
+        guard let window = view.window else { return }
+
+        let alert = NSAlert()
+        alert.messageText = "Selection too long"
+        alert.informativeText = "Sorry, shared clips are limited to a maximum duration of \(Constants.humanReadableMaxDuration). Please select a shorter segment to share."
+        alert.addButton(withTitle: "OK")
+        alert.beginSheetModal(for: window) { [weak self] _ in
+            self?.beginTrimming()
+        }
+    }
+
     private func showProgressUI() {
         progressIndicator.isIndeterminate = false
         progressIndicator.minValue = 0


        guard let item = player.currentItem else { return }

        showProgressUI()

        renderer = ClipRenderer(

import AVKit

final class ClipSharingViewController: NSViewController {

    struct Constants {
        // Limit shared clips to a maximum of 5 minutes.
        static let maximumDuration: Float64 = 60 * 5
        static let humanReadableMaxDuration = "5 minutes"
    }

    let assetURL: URL
    let asset: AVURLAsset
