Skip to content

Commit

Permalink
fix recording filename, settings parameter set correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
AppPear committed Oct 16, 2024
1 parent 6f41038 commit e390793
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/HKStream/HKStreamRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ public actor HKStreamRecorder {
}

/// Starts recording.
public func startRecording(_ filaName: String? = nil, settings: [AVMediaType: [String: any Sendable]] = HKStreamRecorder.defaultSettings) async throws {
public func startRecording(_ fileName: String? = nil, settings: [AVMediaType: [String: any Sendable]] = HKStreamRecorder.defaultSettings) async throws {
guard !isRecording else {
throw Error.invalidState
}

self.fileName = fileName ?? UUID().uuidString
self.settings = settings

guard let fileName = self.fileName else { throw Error.invalidState }

videoPresentationTime = .zero
audioPresentationTime = .zero
let fileName = fileName ?? UUID().uuidString

let url = moviesDirectory.appendingPathComponent(fileName).appendingPathExtension("mp4")
writer = try AVAssetWriter(outputURL: url, fileType: .mp4)
isRecording = true
Expand Down

0 comments on commit e390793

Please sign in to comment.