Compare commits

...
3 Commits
Author SHA1 Message Date
neon443 5cef1d362c added viewer
very spaghetti code :pf:
2026-07-21 22:48:11 +01:00
neon443 40402a91cc fixed button to start/stop stream being behind the stream
the button has reactive text
the stream animates in and out when start/stopping
2026-07-21 19:47:20 +01:00
Nihaal Sharma a2c3fd9fa3 Create README.md 2026-07-01 13:59:21 +01:00
18 changed files with 159 additions and 46 deletions

No files matched your search

+1 -1
View File
@@ -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
+20
View File
@@ -0,0 +1,20 @@
# 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,51 +1,61 @@
{
"images" : [
{
"filename" : "[email protected] 1 copy 6.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "[email protected] 1 copy 5.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "[email protected] 1 copy 4.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "[email protected] 1 copy 3.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "[email protected] 1 copy 2.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "[email protected] 1 copy 1.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "[email protected] 1 copy.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "[email protected] 1.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "Scream.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+2 -2
View File
@@ -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;
+106 -13
View File
@@ -10,35 +10,128 @@ 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
static let controller = StreamWindowController()
// 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
AppDelegate.controller.showWindow(nil)
// controller.streamView.display(sampleBuffer: sampleBuffer)
window.addChildWindow(AppDelegate.controller.window!, ordered: .above)
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
func applicationWillTerminate(_ aNotification: Notification) { }
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
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,6 +74,7 @@ class CaptureEngine: NSObject {
infoFlagsOut: nil
) { status, infoFlags, sampleBuffer in
guard let sampleBuffer else { return }
AppDelegate.controller.streamView.display(sampleBuffer: sampleBuffer)
let packet = ScreamPacket(
timestamp: sampleBuffer.presentationTimeStamp.seconds,
data: try! sampleBuffer.dataBuffer!.dataBytes(),
@@ -84,6 +85,7 @@ class CaptureEngine: NSObject {
let data = try! JSONEncoder().encode(packet)
self.udpServer.send(data)
print(packet)
AppDelegate.controller.streamView.enqueue(packet: packet)
}
// outputHandler: self.outputHandler)
continuation.yield(frame)
+15 -14
View File
@@ -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)
// }
//}
+3 -16
View File
@@ -203,29 +203,16 @@
<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"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="contentRect" x="335" y="390" width="800" height="470"/>
<rect key="screenRect" x="0.0" y="0.0" width="3200" height="1775"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<rect key="frame" x="0.0" y="0.0" width="800" height="470"/>
<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>
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="top-28-M4D"/>
</connections>
<point key="canvasLocation" x="200" y="400"/>
<point key="canvasLocation" x="360" y="455"/>
</window>
</objects>
</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.