Compare commits
No files matched your search
@@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
VERSION = 0.1
|
||||
BUILD = 3
|
||||
BUILD = 2
|
||||
|
||||
// Configuration settings file format documentation can be found at:
|
||||
// https://developer.apple.com/documentation/xcode/adding-a-build-configuration-file-to-your-project
|
||||
@@ -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" : [
|
||||
{
|
||||
"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"
|
||||
|
||||
|
Before Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 65 KiB |
@@ -476,7 +476,7 @@
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 3;
|
||||
CURRENT_PROJECT_VERSION = "${BUILD}";
|
||||
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 = 3;
|
||||
CURRENT_PROJECT_VERSION = "${BUILD}";
|
||||
DEVELOPMENT_TEAM = 8JGND254B7;
|
||||
ENABLE_APP_SANDBOX = YES;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
|
||||
@@ -10,128 +10,35 @@ 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 {
|
||||
if isRunning {
|
||||
await sr.start()
|
||||
} else {
|
||||
await sr.stop()
|
||||
}
|
||||
await sr.start()
|
||||
}
|
||||
}
|
||||
// @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)
|
||||
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)
|
||||
Button(self)
|
||||
// Button2(self)
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ aNotification: Notification) { }
|
||||
func applicationWillTerminate(_ aNotification: Notification) {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,6 @@ 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(),
|
||||
@@ -85,7 +84,6 @@ 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)
|
||||
|
||||
@@ -89,18 +89,17 @@ class ScreenRecorder: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
//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)
|
||||
// }
|
||||
//}
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -203,16 +203,29 @@
|
||||
<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="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"/>
|
||||
<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"/>
|
||||
<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="360" y="455"/>
|
||||
<point key="canvasLocation" x="200" y="400"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||