Skip to content

Conversation

@Ebullioscopic
Copy link

Screen Recording Live Acitivity

Screen.Recording.2025-10-20.at.1.23.21.PM.mov

I replicated the screen recording live activity functionality from iOS' Dynamic Island

I tested with QuickTime, OBS, Google Meet, MS Teams and Zoom screenshare - it is working on all of them

I have used the ScreenWatcher Private API for making this - it is event driven - and does not do any kind of polling

Lemme know if you need any changes

@Alexander5015
Copy link
Member

Could you cherry-pick your commit to keep the git history clean?
It seems like a fairly straightforward change, so the review should be quick, but I’m pretty busy this week so I won't get to it right away.

@Alexander5015
Copy link
Member

Also, how did you prioritize this compared to the other views?

@Ebullioscopic
Copy link
Author

Screen recording live activity is a fairly common feature to people using iPhones > 15 and when I released the first iteration of changes to DynamicIsland - people liked that one specifically as it feels more native

Also adding this did not require removing the App Sandbox or adding any other dependencies

That's why I chose this feature to be contributed first as this does not feel very out of place as compared to the Stats one which non developers or non tech people will rarely use

So yeah that's the reason I picked this thing first

@Alexander5015
Copy link
Member

Oh I meant like if different events are happening including screen recording, how is it prioritized?

@Ebullioscopic
Copy link
Author

Oh my bad, I didn't prioritize it - just tried turning on the music visualizer after screen recording and it hides the screen recording indicator

Should I place it at the topmost priority so that it doesn't get hidden?

Copy link
Member

@Alexander5015 Alexander5015 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some feedback, feature looks good, just needs some tweaking. I’ll make another pass with more feedback once those changes are made.

recordingStartTime = Date()
recordingDuration = 0

durationTimer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { [weak self] _ in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better as a single task that sleeps, rather than a repeating timer that creates new tasks each time. The timer here should also probably be slower, 0.1s is probably unnecessary, and something like 0.3-0.5 would be better I think

recordingStartTime = nil

// Keep the last duration for a moment before resetting
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { [weak self] in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Swift concurrency instead

guard let context = context else { return }
let manager = Unmanaged<ScreenRecordingManager>.fromOpaque(context).takeUnretainedValue()

DispatchQueue.main.async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Swift Concurrency, it also seems like this will lead to multiple main thread hops

private var debounceIdleTask: Task<Void, Never>?

// MARK: - Configuration
private let debounceDelay: TimeInterval = 0.2 // Debounce rapid changes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this variable is unused, you should remove it unless it is necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants