diff --git a/Examples/macOS/PlaybackViewController.swift b/Examples/macOS/PlaybackViewController.swift index 7c420e845..2dff3a928 100644 --- a/Examples/macOS/PlaybackViewController.swift +++ b/Examples/macOS/PlaybackViewController.swift @@ -16,6 +16,12 @@ final class PlaybackViewController: NSViewController { } @IBAction private func didTappedPlayback(_ button: NSButton) { - netStreamSwitcher.open(.playback) + if button.title == "Playback" { + button.title = "Close" + netStreamSwitcher.open(.playback) + } else { + button.title = "Playback" + netStreamSwitcher.close() + } } } diff --git a/Sources/IO/IOTellyUnit.swift b/Sources/IO/IOTellyUnit.swift index 56bcedb5d..ec90672f4 100644 --- a/Sources/IO/IOTellyUnit.swift +++ b/Sources/IO/IOTellyUnit.swift @@ -54,9 +54,10 @@ extension IOTellyUnit: Running { guard isRunning.value else { return } + // https://github.com/shogo4405/HaishinKit.swift/issues/1454 + mediaLink.stopRunning() audioFormat = nil videoFormat = nil - mediaLink.stopRunning() isRunning.mutate { $0 = false } } }