Skip to content

Commit

Permalink
fixed can't startRecording when failedToFinishWriting occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Sep 29, 2024
1 parent 2a2786d commit b1fca75
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/HKStream/HKStreamRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ public actor HKStreamRecorder {
guard isRecording else {
throw Error.invalidState
}
defer {
isRecording = false
self.writer = nil
self.writerInputs.removeAll()
}
guard let writer = writer, writer.status == .writing else {
throw Error.failedToFinishWriting(error: writer?.error)
}
for (_, input) in writerInputs {
input.markAsFinished()
}
await writer.finishWriting()
defer {
isRecording = false
self.writer = nil
self.writerInputs.removeAll()
}
return writer.outputURL
}

Expand Down

0 comments on commit b1fca75

Please sign in to comment.