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

sessionInterruptionEnded never called because there's no reason

mkrn opened this issue · comments

Describe the bug

In this line, in notification object of streamInterruptionEnded there's no reason provided by Apple, so guard is keeping delegate method from ever executing.
Reason should be removed from delegates

guard let userInfoValue = notification.userInfo?[AVCaptureSessionInterruptionReasonKey] as AnyObject?,

To Reproduce

add a NetStreamDelegate
add a function

func stream(_ stream: NetStream, sessionInterruptionEnded session: AVCaptureSession, reason: ... ) {
        // Implementation for handling session interruption end on iOS
        print("sessionInterruptionEnded \(stream) \(session)")
    }

it is never called after coming from background or if using another app like Facetime, multitasking and switching back

Expected behavior

stream sessionInterruptionEnded delegate method should be called

Version

main

Smartphone info.

iPhone 13 Pro

Additional context

No response

Screenshots

No response

Relevant log output

No response

Indeed, that is correct.

2023-29-07 22:59:42.138 [Info] [com.haishinkit.HaishinKit] [IOMixer.swift:415] sessionWasInterrupted(_:) > name = AVCaptureSessionWasInterruptedNotification, object = Optional(<AVCaptureMultiCamSession: 0x28053b400 [AVCaptureSessionPresetInputPriority]>
2023-29-07 22:59:47.639 [Info] [com.haishinkit.HaishinKit] [IOMixer.swift:427] sessionInterruptionEnded(_:) > name = AVCaptureSessionInterruptionEndedNotification, object = Optional(<AVCaptureMultiCamSession: 0x28053b400 [AVCaptureSessionPresetInputPriority]>