Compare commits

..
0 Commits
18 changed files with 46 additions and 159 deletions

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
VERSION = 0.1 VERSION = 0.1
BUILD = 3 BUILD = 2
// Configuration settings file format documentation can be found at: // Configuration settings file format documentation can be found at:
// https://developer.apple.com/documentation/xcode/adding-a-build-configuration-file-to-your-project // https://developer.apple.com/documentation/xcode/adding-a-build-configuration-file-to-your-project
-20
View File
@@ -1,20 +0,0 @@
# Scream
Scream is a fast screensharing app for macOS devices. It uses macOS APIs (`ScreenCaptureKit`) to capture the screen
### Roadmap
- Screen recording
- Streaming
- Authentication
- Client app
- Server app
- iOS Client app
### Compilation
Make sure Xcode is installedd
Clone the repo
Open the project in Xcode
Select your Team ID
Set the destination to "My Mac"
Hit Command + R
Make sure to allow screen recording permissions
@@ -1,61 +1,51 @@
{ {
"images" : [ "images" : [
{ {
"filename" : "[email protected] 1 copy 6.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "1x", "scale" : "1x",
"size" : "16x16" "size" : "16x16"
}, },
{ {
"filename" : "[email protected] 1 copy 5.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "2x", "scale" : "2x",
"size" : "16x16" "size" : "16x16"
}, },
{ {
"filename" : "[email protected] 1 copy 4.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "1x", "scale" : "1x",
"size" : "32x32" "size" : "32x32"
}, },
{ {
"filename" : "[email protected] 1 copy 3.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "2x", "scale" : "2x",
"size" : "32x32" "size" : "32x32"
}, },
{ {
"filename" : "[email protected] 1 copy 2.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "1x", "scale" : "1x",
"size" : "128x128" "size" : "128x128"
}, },
{ {
"filename" : "[email protected] 1 copy 1.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "2x", "scale" : "2x",
"size" : "128x128" "size" : "128x128"
}, },
{ {
"filename" : "[email protected] 1 copy.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "1x", "scale" : "1x",
"size" : "256x256" "size" : "256x256"
}, },
{ {
"filename" : "[email protected] 1.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "2x", "scale" : "2x",
"size" : "256x256" "size" : "256x256"
}, },
{ {
"filename" : "[email protected]",
"idiom" : "mac", "idiom" : "mac",
"scale" : "1x", "scale" : "1x",
"size" : "512x512" "size" : "512x512"
}, },
{ {
"filename" : "Scream.png",
"idiom" : "mac", "idiom" : "mac",
"scale" : "2x", "scale" : "2x",
"size" : "512x512" "size" : "512x512"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

+2 -2
View File
@@ -476,7 +476,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3; CURRENT_PROJECT_VERSION = "${BUILD}";
DEVELOPMENT_TEAM = 8JGND254B7; DEVELOPMENT_TEAM = 8JGND254B7;
ENABLE_APP_SANDBOX = YES; ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -521,7 +521,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3; CURRENT_PROJECT_VERSION = "${BUILD}";
DEVELOPMENT_TEAM = 8JGND254B7; DEVELOPMENT_TEAM = 8JGND254B7;
ENABLE_APP_SANDBOX = YES; ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
+13 -106
View File
@@ -10,128 +10,35 @@ import Cocoa
@main @main
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
let sr = ScreenRecorder() let sr = ScreenRecorder()
lazy var preview = CaptureVideoPreview(layer: sr.contentLayer)
let button = NSButton(title: "Start Stream", target: self, action: #selector(Button))
var isRunning = false
static let controller = StreamWindowController()
// let udpclient = UDPClientImplementation(port: 03067) // let udpclient = UDPClientImplementation(port: 03067)
// let udpserver = UDPServerImplementation(host: "localhost", port: 03067, initialMessage: "kys") // let udpserver = UDPServerImplementation(host: "localhost", port: 03067, initialMessage: "kys")
@IBOutlet var window: NSWindow! @IBOutlet var window: NSWindow!
@IBAction func Button(_ sender: Any) { @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 { Task {
if isRunning { await sr.start()
await sr.start()
} else {
await sr.stop()
}
} }
} }
// @IBAction func Button2(_ sender: Any) {
// udpclient.start()
// udpserver.start()
// }
func applicationDidFinishLaunching(_ aNotification: Notification) { 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) window.contentView?.addSubview(preview)
window.contentView?.addSubview(button) Button(self)
preview.translatesAutoresizingMaskIntoConstraints = false // Button2(self)
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
AppDelegate.controller.showWindow(nil)
// controller.streamView.display(sampleBuffer: sampleBuffer)
window.addChildWindow(AppDelegate.controller.window!, ordered: .above)
} }
func applicationWillTerminate(_ aNotification: Notification) { } func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true return true
} }
} }
import Cocoa
import AVFoundation
import VideoToolbox
final class StreamWindowView: NSView {
private let displayLayer = AVSampleBufferDisplayLayer()
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
wantsLayer = true
displayLayer.videoGravity = .resizeAspect
displayLayer.frame = bounds
displayLayer.autoresizingMask = [
.layerWidthSizable,
.layerHeightSizable
]
layer?.addSublayer(displayLayer)
}
required init?(coder: NSCoder) {
fatalError()
}
// Feed packets here.
func enqueue(packet: ScreamPacket) {
// POC:
// Pretend packet.data already contains one complete CMSampleBuffer.
//
// Later this will become:
// packet -> NAL units -> CMBlockBuffer ->
// CMSampleBuffer -> displayLayer.enqueue()
}
// POC helper
func display(sampleBuffer: CMSampleBuffer) {
displayLayer.enqueue(sampleBuffer)
}
func flush() {
displayLayer.flushAndRemoveImage()
}
}
import Cocoa
final class StreamWindowController: NSWindowController {
let streamView = StreamWindowView(frame: .zero)
convenience init() {
let window = NSWindow(
contentRect: NSRect(x: 100, y: 100, width: 1280, height: 720),
styleMask: [
.titled,
.closable,
.miniaturizable,
.resizable
],
backing: .buffered,
defer: false
)
self.init(window: window)
window.title = "Remote Stream"
window.contentView = streamView
// Hardcoded black background
streamView.layer?.backgroundColor = NSColor.black.cgColor
}
}
-2
View File
@@ -74,7 +74,6 @@ class CaptureEngine: NSObject {
infoFlagsOut: nil infoFlagsOut: nil
) { status, infoFlags, sampleBuffer in ) { status, infoFlags, sampleBuffer in
guard let sampleBuffer else { return } guard let sampleBuffer else { return }
AppDelegate.controller.streamView.display(sampleBuffer: sampleBuffer)
let packet = ScreamPacket( let packet = ScreamPacket(
timestamp: sampleBuffer.presentationTimeStamp.seconds, timestamp: sampleBuffer.presentationTimeStamp.seconds,
data: try! sampleBuffer.dataBuffer!.dataBytes(), data: try! sampleBuffer.dataBuffer!.dataBytes(),
@@ -85,7 +84,6 @@ class CaptureEngine: NSObject {
let data = try! JSONEncoder().encode(packet) let data = try! JSONEncoder().encode(packet)
self.udpServer.send(data) self.udpServer.send(data)
print(packet) print(packet)
AppDelegate.controller.streamView.enqueue(packet: packet)
} }
// outputHandler: self.outputHandler) // outputHandler: self.outputHandler)
continuation.yield(frame) continuation.yield(frame)
+14 -15
View File
@@ -89,18 +89,17 @@ class ScreenRecorder: NSObject {
} }
} }
//extension ScreenRecorder: SCContentSharingPickerObserver { extension ScreenRecorder: SCContentSharingPickerObserver {
// if #available(macOS 14, *) { @available(macOS 14, *)
// func contentSharingPicker(_ picker: SCContentSharingPicker, didCancelFor stream: SCStream?) { func contentSharingPicker(_ picker: SCContentSharingPicker, didCancelFor stream: SCStream?) {
// print("canceleed picker") print("canceleed picker")
// } }
// // @available(macOS 14, *) @available(macOS 14, *)
// func contentSharingPicker(_ picker: SCContentSharingPicker, didUpdateWith filter: SCContentFilter, for stream: SCStream?) { func contentSharingPicker(_ picker: SCContentSharingPicker, didUpdateWith filter: SCContentFilter, for stream: SCStream?) {
// print(picker.description) print(picker.description)
// } }
// }
// func contentSharingPickerStartDidFailWithError(_ error: any Error) {
// func contentSharingPickerStartDidFailWithError(_ error: any Error) { print(error.localizedDescription)
// print(error.localizedDescription) }
// } }
//}
+16 -3
View File
@@ -203,16 +203,29 @@
<window title="Scream" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g"> <window title="Scream" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="800" height="470"/> <rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="3200" height="1775"/> <rect key="screenRect" x="0.0" y="0.0" width="3200" height="1775"/>
<view key="contentView" id="EiT-Mj-1SZ"> <view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="800" height="470"/> <rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8In-w0-vJZ">
<rect key="frame" x="180" y="163" width="121" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="stream screen" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ycE-q8-8mw">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="Button:" target="Voe-Tx-rLC" id="9Qu-NJ-TM0"/>
</connections>
</button>
</subviews>
</view> </view>
<connections> <connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="top-28-M4D"/> <outlet property="delegate" destination="Voe-Tx-rLC" id="top-28-M4D"/>
</connections> </connections>
<point key="canvasLocation" x="360" y="455"/> <point key="canvasLocation" x="200" y="400"/>
</window> </window>
</objects> </objects>
</document> </document>
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.