Skip to content

Commit

Permalink
Merge pull request #1375 from stream-labs/rtmpstream-declaration
Browse files Browse the repository at this point in the history
Change RTMPStream readyState observers to open
  • Loading branch information
shogo4405 authored Feb 14, 2024
2 parents e85c8ec + 1d72595 commit c712fe7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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

0 comments on commit c712fe7

Please sign in to comment.