diff --git a/Config.xcconfig b/Config.xcconfig index 33c8fa8..ab54b8e 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -7,7 +7,7 @@ VERSION = 0.1 -BUILD = 2 +BUILD = 3 // Configuration settings file format documentation can be found at: // https://developer.apple.com/documentation/xcode/adding-a-build-configuration-file-to-your-project diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json index 3f00db4..b0ad5e6 100644 --- a/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,51 +1,61 @@ { "images" : [ { + "filename" : "Scream@0.5x 1 copy 6.png", "idiom" : "mac", "scale" : "1x", "size" : "16x16" }, { + "filename" : "Scream@0.5x 1 copy 5.png", "idiom" : "mac", "scale" : "2x", "size" : "16x16" }, { + "filename" : "Scream@0.5x 1 copy 4.png", "idiom" : "mac", "scale" : "1x", "size" : "32x32" }, { + "filename" : "Scream@0.5x 1 copy 3.png", "idiom" : "mac", "scale" : "2x", "size" : "32x32" }, { + "filename" : "Scream@0.5x 1 copy 2.png", "idiom" : "mac", "scale" : "1x", "size" : "128x128" }, { + "filename" : "Scream@0.5x 1 copy 1.png", "idiom" : "mac", "scale" : "2x", "size" : "128x128" }, { + "filename" : "Scream@0.5x 1 copy.png", "idiom" : "mac", "scale" : "1x", "size" : "256x256" }, { + "filename" : "Scream@0.5x 1.png", "idiom" : "mac", "scale" : "2x", "size" : "256x256" }, { + "filename" : "Scream@0.5x.png", "idiom" : "mac", "scale" : "1x", "size" : "512x512" }, { + "filename" : "Scream.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream.png new file mode 100644 index 0000000..d3cbedf Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 1.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 1.png new file mode 100644 index 0000000..94c63d9 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 1.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 2.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 2.png new file mode 100644 index 0000000..a7f360b Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 2.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 3.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 3.png new file mode 100644 index 0000000..4dba96a Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 3.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 4.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 4.png new file mode 100644 index 0000000..561d4d8 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 4.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 5.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 5.png new file mode 100644 index 0000000..561d4d8 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 5.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 6.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 6.png new file mode 100644 index 0000000..8417d15 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy 6.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy.png new file mode 100644 index 0000000..94c63d9 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1 copy.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1.png new file mode 100644 index 0000000..12f01f2 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x 1.png differ diff --git a/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x.png b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x.png new file mode 100644 index 0000000..12f01f2 Binary files /dev/null and b/Resources/Assets.xcassets/AppIcon.appiconset/Scream@0.5x.png differ diff --git a/Scream.xcodeproj/project.pbxproj b/Scream.xcodeproj/project.pbxproj index a2a1726..de748d1 100644 --- a/Scream.xcodeproj/project.pbxproj +++ b/Scream.xcodeproj/project.pbxproj @@ -476,7 +476,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = "${BUILD}"; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 8JGND254B7; ENABLE_APP_SANDBOX = YES; ENABLE_HARDENED_RUNTIME = YES; @@ -521,7 +521,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = "${BUILD}"; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 8JGND254B7; ENABLE_APP_SANDBOX = YES; ENABLE_HARDENED_RUNTIME = YES; diff --git a/Scream/AppDelegate.swift b/Scream/AppDelegate.swift index 0c1450a..3635aee 100644 --- a/Scream/AppDelegate.swift +++ b/Scream/AppDelegate.swift @@ -10,33 +10,41 @@ import Cocoa @main class AppDelegate: NSObject, NSApplicationDelegate { let sr = ScreenRecorder() + lazy var preview = CaptureVideoPreview(layer: sr.contentLayer) + let button = NSButton(title: "Start Stream", target: self, action: #selector(Button)) + var isRunning = false // let udpclient = UDPClientImplementation(port: 03067) // let udpserver = UDPServerImplementation(host: "localhost", port: 03067, initialMessage: "kys") @IBOutlet var window: NSWindow! @IBAction func Button(_ sender: Any) { + isRunning.toggle() + print(isRunning, "\(isRunning ? "Stop" : "Start") Stream") + self.button.title = "\(isRunning ? "Stop" : "Start") Stream" + preview.layer?.opacity = isRunning ? 1 : 0 Task { - await sr.start() + if isRunning { + await sr.start() + } else { + await sr.stop() + } } } -// @IBAction func Button2(_ sender: Any) { -// udpclient.start() -// udpserver.start() -// } func applicationDidFinishLaunching(_ aNotification: Notification) { - // Insert code here to initialize your application - let preview = CaptureVideoPreview(layer: sr.contentLayer) - preview.frame.size = window.contentView!.frame.size window.contentView?.addSubview(preview) - Button(self) -// Button2(self) + window.contentView?.addSubview(button) + preview.translatesAutoresizingMaskIntoConstraints = false + + preview.leadingAnchor.constraint(equalTo: window.contentView!.leadingAnchor).isActive = true + preview.trailingAnchor.constraint(equalTo: window.contentView!.trailingAnchor).isActive = true + preview.topAnchor.constraint(equalTo: window.contentView!.topAnchor).isActive = true + preview.bottomAnchor.constraint(equalTo: window.contentView!.bottomAnchor).isActive = true + } - func applicationWillTerminate(_ aNotification: Notification) { - // Insert code here to tear down your application - } + func applicationWillTerminate(_ aNotification: Notification) { } func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true diff --git a/Scream/ScreenRecorder.swift b/Scream/ScreenRecorder.swift index 3cc41d4..22ec63d 100644 --- a/Scream/ScreenRecorder.swift +++ b/Scream/ScreenRecorder.swift @@ -89,17 +89,18 @@ class ScreenRecorder: NSObject { } } -extension ScreenRecorder: SCContentSharingPickerObserver { - @available(macOS 14, *) - func contentSharingPicker(_ picker: SCContentSharingPicker, didCancelFor stream: SCStream?) { - print("canceleed picker") - } - @available(macOS 14, *) - func contentSharingPicker(_ picker: SCContentSharingPicker, didUpdateWith filter: SCContentFilter, for stream: SCStream?) { - print(picker.description) - } - - func contentSharingPickerStartDidFailWithError(_ error: any Error) { - print(error.localizedDescription) - } -} +//extension ScreenRecorder: SCContentSharingPickerObserver { +// if #available(macOS 14, *) { +// func contentSharingPicker(_ picker: SCContentSharingPicker, didCancelFor stream: SCStream?) { +// print("canceleed picker") +// } +// // @available(macOS 14, *) +// func contentSharingPicker(_ picker: SCContentSharingPicker, didUpdateWith filter: SCContentFilter, for stream: SCStream?) { +// print(picker.description) +// } +// } +// +// func contentSharingPickerStartDidFailWithError(_ error: any Error) { +// print(error.localizedDescription) +// } +//} diff --git a/Scream/Views/Base.lproj/MainMenu.xib b/Scream/Views/Base.lproj/MainMenu.xib index 340585a..c9baddb 100644 --- a/Scream/Views/Base.lproj/MainMenu.xib +++ b/Scream/Views/Base.lproj/MainMenu.xib @@ -203,29 +203,16 @@ - + - + - - - - +