https://github.com/p-x9/screencapture
📱Library for recording window and windowScene.
https://github.com/p-x9/screencapture
ios screen-capture swift swiftpackage
Last synced: about 1 year ago
JSON representation
📱Library for recording window and windowScene.
- Host: GitHub
- URL: https://github.com/p-x9/screencapture
- Owner: p-x9
- License: mit
- Created: 2023-05-19T08:46:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-18T16:07:38.000Z (almost 3 years ago)
- Last Synced: 2025-03-18T15:12:41.546Z (about 1 year ago)
- Topics: ios, screen-capture, swift, swiftpackage
- Language: Swift
- Homepage:
- Size: 70.3 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ScreenCapture
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.
[](https://github.com/p-x9/ScreenCapture/issues)
[](https://github.com/p-x9/ScreenCapture/network/members)
[](https://github.com/p-x9/ScreenCapture/stargazers)
[](https://github.com/p-x9/ScreenCapture/)
## Document
### Instance
```swift
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)
```
### Video
#### Start Recording
```swift
let tmpURL = FileManager.default.temporaryDirectory
let url = tmpURL.appending(components: UUID().uuidString + ".mp4")
try screenCapture.start(outputURL: url)
```
#### End Recording
```swift
try screenCapture.end()
```
### Image
```swift
let tmpURL = FileManager.default.temporaryDirectory
let url = tmpURL.appending(components: UUID().uuidString + ".jpg")
try screenCapture.capture(outputURL: url)
```
## License
ScreenCapture is released under the MIT License. See [LICENSE](./LICENSE)