fix: avoid main-actor stopCapture error
This commit is contained in:
@@ -180,8 +180,8 @@ final class ScreenRecordService {
|
|||||||
|
|
||||||
try await Task.sleep(nanoseconds: UInt64(durationMs) * 1_000_000)
|
try await Task.sleep(nanoseconds: UInt64(durationMs) * 1_000_000)
|
||||||
|
|
||||||
let stopError = await MainActor.run {
|
let stopError = await withCheckedContinuation { cont in
|
||||||
await withCheckedContinuation { cont in
|
Task { @MainActor in
|
||||||
recorder.stopCapture { error in cont.resume(returning: error) }
|
recorder.stopCapture { error in cont.resume(returning: error) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user