shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The operation couldn’t be completed. (HaishinKit.IORecorder.Error error 3.)

mkrn opened this issue · comments

Describe the bug

Sometimes if the stream getting trouble connecting in the end I get the
The operation couldn’t be completed. (HaishinKit.IORecorder.Error error 3.)
Is there any reason or a

To Reproduce

Unfortunately no steps, but this usually happens when there's issue with connecting on 4g / multiple reconnects

Expected behavior

Recording to always save no matter what

Version

master

Smartphone info.

Apple iPhone 12 Pro Max

Additional context

No response

Screenshots

No response

Relevant log output

No response

I want to know the content of the error message. You can see the content inside Error.Domain with print(error).

  1. This commonly occurs when the microphone is detached, and the app is in the background for 30 seconds or more, especially when the Control Center is open for 30 seconds or longer. This can lead to recording failures.

    failedToFinishWriting(error: Optional(Error Domain=AVFoundationErrorDomain Code=-11847 "Operation Interrupted" UserInfo={NSLocalizedRecoverySuggestion=Stop other operations and try again., NSLocalizedDescription=Operation Interrupted, NSUnderlyingError=0x2815224c0 {Error Domain=NSOSStatusErrorDomain Code=-16121 "(null)"}}))

  2. When you specify recorder.startRecording([.audio: [], .video: []]) and either the video or audio is missing, recording will fail. The error message in this case is as follows:

    failedToFinishWriting(error: nil)

Apparently here's what happened:
Swipe to left to other app => app goes to background => sessionWasInterrupted => stop recording
While my app was in background, sessionInterruptionEnded called => started streaming & recording
...something empty recorded,
returned to foreground...
stop recording=> error nil

I fixed the logic in my app, but FYI recording error may happen if recording was running in the background.