Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change RTMPStream readyState observers to open #1375

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Examples/iOS/NetStreamSwitcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,12 @@ extension NetStreamSwitcher: IOStreamDelegate {
/// Tells the receiver to the stream opened.
func streamDidOpen(_ stream: IOStream) {
}

/// Tells the receiver that the ready state will change.
func stream(_ stream: IOStream, willChangeReadyState state: IOStream.ReadyState) {
}

/// Tells the receiver that the ready state did change.
func stream(_ stream: IOStream, didChangeReadyState state: IOStream.ReadyState) {
}
}
6 changes: 6 additions & 0 deletions Sources/IO/IOStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public protocol IOStreamDelegate: AnyObject {
func stream(_ stream: IOStream, audioErrorOccurred error: IOAudioUnitError)
/// Tells the receiver to the stream opened.
func streamDidOpen(_ stream: IOStream)
/// Tells the receiver that the ready state will change.
func stream(_ stream: IOStream, willChangeReadyState state: IOStream.ReadyState)
/// Tells the receiver that the ready state did change.
func stream(_ stream: IOStream, didChangeReadyState state: IOStream.ReadyState)
}

@available(*, deprecated, renamed: "IOStream")
Expand Down Expand Up @@ -301,13 +305,15 @@ open class IOStream: NSObject {
guard readyState != newValue else {
return
}
delegate?.stream(self, willChangeReadyState: readyState)
readyStateWillChange(to: newValue)
}
didSet {
guard readyState != oldValue else {
return
}
readyStateDidChange(to: readyState)
delegate?.stream(self, didChangeReadyState: readyState)
}
}

Expand Down