 
         guard let item = player.currentItem else { return }
 
+        let range = CMTimeRangeFromTimeToTime(start: item.reversePlaybackEndTime, end: item.forwardPlaybackEndTime)
+        guard CMTimeGetSeconds(range.duration) <= Constants.maximumDuration else {
+            showTimeLimitError()
+            return
+        }
+
         showProgressUI()
 
         renderer = ClipRenderer(

import AVKit

final class ClipSharingViewController: NSViewController {

    let assetURL: URL
    let asset: AVURLAsset

        })
    }

    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
