Library for recording window and windowScene.
It is possible to use this function even when screen recording is being performed by an iOS function or while screen sharing is in progress.
import ScreenCapture
// config for recording
let config = Configuration(
codec: .h264,
fileType: .mp4,
fps: 60,
scale: 2
)
// record all windows in a scene
let screenCapture = ScreenCapture(for: windowScene,
with: config)
// record a particular window
let screenCapture = ScreenCapture(for: window,
with: config)
let tmpURL = FileManager.default.temporaryDirectory
let url = tmpURL.appending(components: UUID().uuidString + ".mp4")
try screenCapture.start(outputURL: url)
try screenCapture.end()
let tmpURL = FileManager.default.temporaryDirectory
let url = tmpURL.appending(components: UUID().uuidString + ".jpg")
try screenCapture.capture(outputURL: url)
ScreenCapture is released under the MIT License. See LICENSE