aboutsummaryrefslogtreecommitdiff
path: root/Captura
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2023-07-28 13:48:53 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2023-07-28 13:48:53 +0200
commitc9b9e1d654ea697afad9f6427d94623bfdf55cce (patch)
treea0095a75f2ba625f92923e72a9831740da989de7 /Captura
parentf5d16c1c8c259966338b23afd407d142f72784aa (diff)
Add clipboard
Diffstat (limited to 'Captura')
-rw-r--r--Captura/CapturaApp.swift (renamed from Captura/Presentation/Windows/CapturaApp.swift)231
-rw-r--r--Captura/Core Extensions/CVImageBuffer+cgImage.swift11
-rw-r--r--Captura/Core Extensions/Notification+AppEvents.swift2
-rw-r--r--Captura/Data/CapturaRemoteFile.swift13
-rw-r--r--Captura/Data/CapturaSettings.swift29
-rw-r--r--Captura/Domain/CapturaCaptureSession.swift60
-rw-r--r--Captura/Domain/CaptureState.swift (renamed from Captura/Data/CaptureState.swift)1
-rw-r--r--Captura/Item.swift18
-rw-r--r--Captura/Presentation/Screens/PreferencesScreen.swift6
-rw-r--r--Captura/Presentation/Settings/AdvancedSettings.swift32
-rw-r--r--Captura/Presentation/Settings/OutputSettings.swift5
-rw-r--r--Captura/Presentation/Windows/RecordingWindow.swift4
12 files changed, 259 insertions, 153 deletions
diff --git a/Captura/Presentation/Windows/CapturaApp.swift b/Captura/CapturaApp.swift
index 6cf7044..4f1ceff 100644
--- a/Captura/Presentation/Windows/CapturaApp.swift
+++ b/Captura/CapturaApp.swift
@@ -2,7 +2,7 @@ import SwiftUI
import SwiftData
import Cocoa
import Combine
-import ReplayKit
+import AVFoundation
@main
struct CapturaApp: App {
@@ -16,11 +16,11 @@ struct CapturaApp: App {
.frame(width: 650, height: 450)
}
.handlesExternalEvents(matching: Set(arrayLiteral: "PreferencesScreen"))
- .modelContainer(for: Item.self)
+ .modelContainer(for: CapturaRemoteFile.self)
}
}
-class CapturaAppDelegate: NSObject, NSApplicationDelegate, AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureFileOutputRecordingDelegate, NSMenuDelegate {
+class CapturaAppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
@Environment(\.openURL) var openURL
var statusItem: NSStatusItem!
@@ -30,12 +30,11 @@ class CapturaAppDelegate: NSObject, NSApplicationDelegate, AVCaptureVideoDataOut
var boxListener: AnyCancellable? = nil
var popover: NSPopover? = nil
var helpShown = false
- var receivedFrames = false
- var captureSession: AVCaptureSession? = nil
+ var captureSession: CapturaCaptureSession? = nil
var images: [CGImage] = []
var outputFile: CapturaFile? = nil
var gifCallbackTimer = ContinuousClock.now
- var fps = UserDefaults.standard.integer(forKey: "frameRate")
+ var fps = CapturaSettings.frameRate
var pixelDensity: CGFloat = 1.0
var stopTimer: DispatchWorkItem?
@@ -131,18 +130,19 @@ class CapturaAppDelegate: NSObject, NSApplicationDelegate, AVCaptureVideoDataOut
}
case .reset:
reset()
+ case .failedToStart:
+ failedToStart()
+ case .receivedFrame:
+ if let frame = notification.userInfo?["frame"] {
+ receivedFrame(frame as! CVImageBuffer)
+ }
default:
return
}
- /*
- if let data = notification.userInfo?["data"] as? String {
- print("Data received: \(data)")
- }
- */
}
- @objc func startAreaSelection() {
+ func startAreaSelection() {
helpShown = false
NSApp.activate(ignoringOtherApps: true)
if captureState != .selectingArea {
@@ -151,105 +151,59 @@ class CapturaAppDelegate: NSObject, NSApplicationDelegate, AVCaptureVideoDataOut
let rectInWindow = button.convert(button.bounds, to: nil)
let rectInScreen = button.window?.convertToScreen(rectInWindow)
recordingWindow = RecordingWindow(rectInScreen)
- if let view = recordingWindow?.contentView as? RecordingContentView {
- boxListener = view.$box
- .debounce(for: .seconds(0.3), scheduler: RunLoop.main)
- .sink { newValue in
- if newValue != nil {
- button.image = NSImage(systemSymbolName: "circle.rectangle.dashed", accessibilityDescription: "Captura")
- if !self.helpShown {
- self.helpShown = true
- self.showPopoverWithMessage("Click here when you're ready to record.")
- }
+ boxListener = recordingWindow?.recordingContentView.$box
+ .debounce(for: .seconds(0.3), scheduler: RunLoop.main)
+ .sink { newValue in
+ if newValue != nil {
+ self.updateImage()
+ if !self.helpShown {
+ self.helpShown = true
+ self.showPopoverWithMessage("Click here when you're ready to record.")
}
}
- }
+ }
}
}
}
func startRecording() {
captureState = .recording
- fps = UserDefaults.standard.integer(forKey: "frameRate")
+ updateImage()
+ fps = CapturaSettings.frameRate
outputFile = nil
images = [];
pixelDensity = recordingWindow?.pixelDensity ?? 1.0
- if let view = recordingWindow?.contentView as? RecordingContentView {
- view.startRecording()
- if let box = view.box {
- if let screen = NSScreen.main {
- let displayId = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as! CGDirectDisplayID
- let screenInput = AVCaptureScreenInput(displayID: displayId)
- screenInput?.cropRect = box.insetBy(dx: 1, dy: 1)
-
- captureSession = AVCaptureSession()
+ recordingWindow?.recordingContentView.startRecording()
+ if let box = recordingWindow?.recordingContentView.box {
+ if let screen = recordingWindow?.screen {
+ captureSession = CapturaCaptureSession(screen, box: box)
+
+ if let captureSession {
+
+ stopTimer = DispatchWorkItem {
+ self.stopRecording()
+ }
+ DispatchQueue.main.asyncAfter(deadline: .now() + 300, execute: stopTimer!)
- if let captureSession {
-
-
- if captureSession.canAddInput(screenInput!) {
- captureSession.addInput(screenInput!)
- }
-
- let videoOutput = AVCaptureVideoDataOutput()
- videoOutput.setSampleBufferDelegate(self, queue: DispatchQueue(label: "sample buffer delegate", attributes: []))
-
- if captureSession.canAddOutput(videoOutput) {
- captureSession.addOutput(videoOutput)
- }
-
- let movieFileOutput = AVCaptureMovieFileOutput()
- if captureSession.canAddOutput(movieFileOutput) {
- captureSession.addOutput(movieFileOutput)
- }
-
- stopTimer = DispatchWorkItem {
- self.stopRecording()
- }
- DispatchQueue.main.asyncAfter(deadline: .now() + 300, execute: stopTimer!)
-
- if let button = statusItem.button {
- button.image = NSImage(systemSymbolName: "checkmark.rectangle", accessibilityDescription: "Captura")
- }
-
- receivedFrames = false
+ outputFile = CapturaFile()
+ if CapturaSettings.shouldSaveMp4 {
+ captureSession.startRecording(to: outputFile!.mp4URL)
+ } else {
captureSession.startRunning()
-
- outputFile = CapturaFile()
- let outputFormatsSetting = OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "outputFormats")) ?? .all
- if outputFormatsSetting.shouldSaveMp4() {
- movieFileOutput.startRecording(to: outputFile!.mp4URL, recordingDelegate: self)
- }
-
- DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
- if !self.receivedFrames {
- self.requestPermission()
- }
- }
}
-
-
- } else {
- print("Should error")
+ return
}
}
}
+ NotificationCenter.default.post(name: .failedToStart, object: nil, userInfo: nil)
}
func stopRecording() {
- if let button = statusItem.button {
- button.image = NSImage(systemSymbolName: "dock.arrow.up.rectangle", accessibilityDescription: "Captura")
- }
- stopTimer?.cancel()
captureState = .uploading
- captureSession?.stopRunning()
- captureSession = nil
- boxListener?.cancel()
- recordingWindow?.close()
- self.recordingWindow = nil
+ updateImage()
+ stop()
- let outputFormatsSetting = OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "outputFormats")) ?? .all
- if !outputFormatsSetting.shouldSaveGif() {
+ if !CapturaSettings.shouldSaveMp4 {
NotificationCenter.default.post(name: .finalizeRecording, object: nil, userInfo: nil)
return
}
@@ -263,56 +217,53 @@ class CapturaAppDelegate: NSObject, NSApplicationDelegate, AVCaptureVideoDataOut
}
func finalizeRecording() {
- if let button = statusItem.button {
- button.image = NSImage(systemSymbolName: "checkmark.rectangle.fill", accessibilityDescription: "Captura")
- }
captureState = .uploaded
+ copyToClipboard()
+ updateImage()
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
- self.reset()
+ NotificationCenter.default.post(name: .reset, object: nil, userInfo: nil)
}
}
func reset() {
- if let button = statusItem.button {
- button.image = NSImage(systemSymbolName: "rectangle.dashed.badge.record", accessibilityDescription: "Captura")
- }
captureState = .idle
- stopTimer?.cancel()
- captureSession?.stopRunning()
- boxListener?.cancel()
- recordingWindow?.close()
- self.recordingWindow = nil
- }
-
- private func requestPermission() {
- reset()
- showPopoverWithMessage("Please grant Captura permission to record")
- if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenRecording") {
- NSWorkspace.shared.open(url)
- }
+ updateImage()
+ stop()
}
- func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
- receivedFrames = true
-
+ func receivedFrame(_ frame: CVImageBuffer) {
let now = ContinuousClock.now
if now - gifCallbackTimer > .nanoseconds(1_000_000_000 / UInt64(fps)) {
gifCallbackTimer = now
DispatchQueue.main.async {
- // Get the CVImageBuffer from the sample buffer
- guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }
- let ciImage = CIImage(cvImageBuffer: imageBuffer)
- let context = CIContext()
- if let cgImage = context.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(imageBuffer), height: CVPixelBufferGetHeight(imageBuffer))) {
- if let cgImage = cgImage.resize(by: self.pixelDensity) {
- self.images.append(cgImage)
- }
+ if let cgImage = frame.cgImage?.resize(by: self.pixelDensity) {
+ self.images.append(cgImage)
}
}
}
}
+ func failedToStart() {
+ captureState = .error
+ updateImage()
+ requestPermissionToRecord()
+ stop()
+ DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
+ NotificationCenter.default.post(name: .reset, object: nil, userInfo: nil)
+ }
+ }
+
+ // MARK: - Presentation Helpers
+
+
+ private func requestPermissionToRecord() {
+ showPopoverWithMessage("Please grant Captura permission to record")
+ if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenRecording") {
+ NSWorkspace.shared.open(url)
+ }
+ }
+
private func showPopoverWithMessage(_ message: String) {
if let button = statusItem.button {
(self.popover?.contentViewController as? HelpPopoverViewController)?.updateLabel(message)
@@ -323,7 +274,43 @@ class CapturaAppDelegate: NSObject, NSApplicationDelegate, AVCaptureVideoDataOut
}
}
- // MARK: - AVCaptureFileOutputRecordingDelegate Implementation
+ private func updateImage() {
+ if let button = statusItem.button {
+ let image: String = switch captureState {
+ case .idle:
+ "rectangle.dashed.badge.record"
+ case .selectingArea:
+ "circle.rectangle.dashed"
+ case .recording:
+ "checkmark.rectangle"
+ case .uploading:
+ "dock.arrow.up.rectangle"
+ case .uploaded:
+ "checkmark.rectangle.fill"
+ case .error:
+ "xmark.rectangle.fill"
+ }
+ button.image = NSImage(systemSymbolName: image, accessibilityDescription: "Captura")
+ }
+ }
+
+ private func stop() {
+ stopTimer?.cancel()
+ captureSession?.stopRunning()
+ captureSession = nil
+ boxListener?.cancel()
+ recordingWindow?.close()
+ recordingWindow = nil
+ }
- func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?) {}
+ private func copyToClipboard() {
+ let fileType: NSPasteboard.PasteboardType = .init(rawValue: CapturaSettings.shouldSaveGif ? "com.compuserve.gif" : "public.mpeg-4")
+ if let url = CapturaSettings.shouldSaveGif ? outputFile?.gifURL : outputFile?.mp4URL {
+ if let data = try? Data(contentsOf: url) {
+ let pasteboard = NSPasteboard.general
+ pasteboard.declareTypes([fileType], owner: nil)
+ pasteboard.setData(data, forType: fileType)
+ }
+ }
+ }
}
diff --git a/Captura/Core Extensions/CVImageBuffer+cgImage.swift b/Captura/Core Extensions/CVImageBuffer+cgImage.swift
new file mode 100644
index 0000000..c30cb0c
--- /dev/null
+++ b/Captura/Core Extensions/CVImageBuffer+cgImage.swift
@@ -0,0 +1,11 @@
+import Foundation
+import ReplayKit
+
+extension CVImageBuffer {
+
+ var cgImage: CGImage? {
+ let ciImage = CIImage(cvImageBuffer: self)
+ let context = CIContext()
+ return context.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self)))
+ }
+}
diff --git a/Captura/Core Extensions/Notification+AppEvents.swift b/Captura/Core Extensions/Notification+AppEvents.swift
index 809c00e..5d00937 100644
--- a/Captura/Core Extensions/Notification+AppEvents.swift
+++ b/Captura/Core Extensions/Notification+AppEvents.swift
@@ -6,4 +6,6 @@ extension Notification.Name {
static let stopRecording = Notification.Name("stopRecording")
static let finalizeRecording = Notification.Name("finalizeRecording")
static let reset = Notification.Name("reset")
+ static let failedToStart = Notification.Name("failedToStart")
+ static let receivedFrame = Notification.Name("receivedFrame")
}
diff --git a/Captura/Data/CapturaRemoteFile.swift b/Captura/Data/CapturaRemoteFile.swift
new file mode 100644
index 0000000..24d821e
--- /dev/null
+++ b/Captura/Data/CapturaRemoteFile.swift
@@ -0,0 +1,13 @@
+import Foundation
+import SwiftData
+
+@Model
+final class CapturaRemoteFile {
+ var timestamp: Date
+ var url: URL
+
+ init(url: URL) {
+ self.timestamp = Date()
+ self.url = url
+ }
+}
diff --git a/Captura/Data/CapturaSettings.swift b/Captura/Data/CapturaSettings.swift
new file mode 100644
index 0000000..d0d04f2
--- /dev/null
+++ b/Captura/Data/CapturaSettings.swift
@@ -0,0 +1,29 @@
+import Foundation
+
+struct CapturaSettings {
+ static var frameRate: Int {
+ UserDefaults.standard.integer(forKey: "frameRate")
+ }
+
+ static var outputFormats: OutputFormatSetting {
+ OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "outputFormats")) ?? .all
+ }
+
+ static var shouldSaveMp4: Bool {
+ outputFormats.shouldSaveMp4()
+ }
+
+ static var shouldSaveGif: Bool {
+ outputFormats.shouldSaveGif()
+ }
+
+
+ static var shouldSendNotifications: Bool {
+ get {
+ UserDefaults.standard.bool(forKey: "shouldSendNotifications")
+ }
+ set {
+ UserDefaults.standard.setValue(newValue, forKey: "shouldSendNotifications")
+ }
+ }
+}
diff --git a/Captura/Domain/CapturaCaptureSession.swift b/Captura/Domain/CapturaCaptureSession.swift
new file mode 100644
index 0000000..80240e6
--- /dev/null
+++ b/Captura/Domain/CapturaCaptureSession.swift
@@ -0,0 +1,60 @@
+import AppKit
+import AVFoundation
+
+class CapturaCaptureSession: AVCaptureSession, AVCaptureFileOutputRecordingDelegate, AVCaptureVideoDataOutputSampleBufferDelegate {
+
+ let videoOutput = AVCaptureVideoDataOutput()
+ let movieFileOutput = AVCaptureMovieFileOutput()
+ var receivedFrames = false
+
+ init(_ screen: NSScreen, box: NSRect) {
+ super.init()
+
+ let displayId = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as! CGDirectDisplayID
+ let screenInput = AVCaptureScreenInput(displayID: displayId)
+ screenInput?.cropRect = box.insetBy(dx: 1, dy: 1)
+
+ if self.canAddInput(screenInput!) {
+ self.addInput(screenInput!)
+ }
+
+ videoOutput.setSampleBufferDelegate(self, queue: Dispatch.DispatchQueue(label: "sample buffer delegate", attributes: []))
+
+ if self.canAddOutput(videoOutput) {
+ self.addOutput(videoOutput)
+ }
+
+ if self.canAddOutput(movieFileOutput) {
+ self.addOutput(movieFileOutput)
+ }
+ }
+
+ func startRecording() {
+ receivedFrames = false
+ self.startRunning()
+
+ DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+ if !self.receivedFrames {
+ NotificationCenter.default.post(name: .failedToStart, object: nil, userInfo: nil)
+ }
+ }
+ }
+
+ func startRecording(to url: URL) {
+ self.startRecording()
+ movieFileOutput.startRecording(to: url, recordingDelegate: self)
+ }
+
+ // MARK: - AVCaptureVideoDataOutputSampleBufferDelegate Implementation
+
+ func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
+ receivedFrames = true
+
+ guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return }
+ NotificationCenter.default.post(name: .receivedFrame, object: nil, userInfo: ["frame": imageBuffer])
+ }
+
+ // MARK: - AVCaptureFileOutputRecordingDelegate Implementation
+
+ func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?) {}
+}
diff --git a/Captura/Data/CaptureState.swift b/Captura/Domain/CaptureState.swift
index be354f6..0761b88 100644
--- a/Captura/Data/CaptureState.swift
+++ b/Captura/Domain/CaptureState.swift
@@ -4,4 +4,5 @@ enum CaptureState {
case recording
case uploading
case uploaded
+ case error
}
diff --git a/Captura/Item.swift b/Captura/Item.swift
deleted file mode 100644
index 22587d8..0000000
--- a/Captura/Item.swift
+++ /dev/null
@@ -1,18 +0,0 @@
-//
-// Item.swift
-// Captura
-//
-// Created by Ruben Beltran del Rio on 7/24/23.
-//
-
-import Foundation
-import SwiftData
-
-@Model
-final class Item {
- var timestamp: Date
-
- init(timestamp: Date) {
- self.timestamp = timestamp
- }
-}
diff --git a/Captura/Presentation/Screens/PreferencesScreen.swift b/Captura/Presentation/Screens/PreferencesScreen.swift
index f809502..a9c380b 100644
--- a/Captura/Presentation/Screens/PreferencesScreen.swift
+++ b/Captura/Presentation/Screens/PreferencesScreen.swift
@@ -2,9 +2,6 @@ import SwiftUI
import SwiftData
struct PreferencesScreen: View {
- @Environment(\.modelContext) private var modelContext
- @Query private var items: [Item]
-
var body: some View {
TabView {
OutputSettings().tabItem {
@@ -13,11 +10,10 @@ struct PreferencesScreen: View {
AdvancedSettings().tabItem {
Label("Advanced", systemImage: "gear")
}.padding(8.0)
- }.padding(16.0)
+ }.padding(16.0).frame(minWidth: 300, minHeight: 250)
}
}
#Preview {
PreferencesScreen()
- .modelContainer(for: Item.self, inMemory: true)
}
diff --git a/Captura/Presentation/Settings/AdvancedSettings.swift b/Captura/Presentation/Settings/AdvancedSettings.swift
index 7ed78d9..e5b77ce 100644
--- a/Captura/Presentation/Settings/AdvancedSettings.swift
+++ b/Captura/Presentation/Settings/AdvancedSettings.swift
@@ -3,25 +3,45 @@ import SwiftUI
struct AdvancedSettings: View {
@AppStorage("backendUrl") var backendUrl: String = ""
+ @AppStorage("backendFormat") var outputFormats: OutputFormatSetting = .gifOnly
@AppStorage("keepFiles") var keepFiles = true
+ var parsedBackendUrl: URL? {
+ URL(string: backendUrl)
+ }
+
var body: some View {
Form {
- VStack (alignment: .leading) {
+ VStack (alignment: .center) {
LabeledContent("Backend URL") {
- TextField("", text: $backendUrl)
- }.font(.headline)
- LabeledContent("Keep files after remote upload") {
- Toggle("", isOn: $keepFiles)
+ TextField("", text: $backendUrl).font(.body)
}.font(.headline)
+ Picker(selection: $outputFormats, label: Text("Backend Format").font(.headline)) {
+ Text("GIF")
+ .tag(OutputFormatSetting.gifOnly)
+ .padding(.horizontal, 4.0)
+ .padding(.vertical, 2.0)
+ Text("MP4")
+ .tag(OutputFormatSetting.mp4Only)
+ .padding(.horizontal, 4.0)
+ .padding(.vertical, 2.0)
+ }
+ .pickerStyle(.radioGroup)
+ .disabled(parsedBackendUrl == nil)
+ Toggle("Keep Local Files", isOn: $keepFiles)
+ .font(.headline)
+ .disabled(parsedBackendUrl == nil)
+ .padding(.vertical, 8.0)
HStack {
- Text("These settings can break things!")
+ Text("These settings can break things! Please make sure you understand how to use them before enabling.")
+ .lineLimit(3...10)
Button {
print("Not yet!")
} label: {
Image(systemName: "info.circle")
}.buttonStyle(.borderless)
}
+ Spacer()
}
}
}
diff --git a/Captura/Presentation/Settings/OutputSettings.swift b/Captura/Presentation/Settings/OutputSettings.swift
index 3b8e01c..df12541 100644
--- a/Captura/Presentation/Settings/OutputSettings.swift
+++ b/Captura/Presentation/Settings/OutputSettings.swift
@@ -7,14 +7,14 @@ struct OutputSettings: View {
var body: some View {
Form {
- VStack (alignment: .leading) {
+ VStack (alignment: .center) {
LabeledContent("GIF Framerate") {
Slider(value: $frameRate, in: 4...10, step: 1) {
Text("\(Int(frameRate))").font(.body).frame(width: 24)
} minimumValueLabel: {
Text("4")
} maximumValueLabel: {
- Text("12")
+ Text("10")
}
}.font(.headline)
Picker(selection: $outputFormats, label: Text("Output Formats").font(.headline)) {
@@ -33,6 +33,7 @@ struct OutputSettings: View {
.padding(.vertical, 2.0)
}.pickerStyle(.radioGroup)
}
+ Spacer()
}
}
}
diff --git a/Captura/Presentation/Windows/RecordingWindow.swift b/Captura/Presentation/Windows/RecordingWindow.swift
index 2bb9928..b9f212c 100644
--- a/Captura/Presentation/Windows/RecordingWindow.swift
+++ b/Captura/Presentation/Windows/RecordingWindow.swift
@@ -7,6 +7,10 @@ class RecordingWindow: NSWindow {
self.screen?.backingScaleFactor ?? 1.0
}
+ var recordingContentView: RecordingContentView {
+ self.contentView as! RecordingContentView
+ }
+
init(_ button: NSRect?) {
let screens = NSScreen.screens