Call receiveVideo

This commit is contained in:
shogo4405 2020-02-23 18:31:16 +09:00
parent 2613b79eb6
commit 7bf21be246
1 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,8 @@ final class LiveViewController: UIViewController {
audioBitrateSlider?.value = Float(RTMPStream.defaultAudioBitrate) / 1024
NotificationCenter.default.addObserver(self, selector: #selector(on(_:)), name: UIDevice.orientationDidChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didEnterBackground(_:)), name: UIApplication.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActive(_:)), name: UIApplication.didBecomeActiveNotification, object: nil)
}
override func viewWillAppear(_ animated: Bool) {
@ -221,6 +223,16 @@ final class LiveViewController: UIViewController {
rtmpStream.orientation = orientation
}
@objc
private func didEnterBackground(_ notification: Notification) {
// rtmpStream.receiveVideo = false
}
@objc
private func didBecomeActive(_ notification: Notification) {
// rtmpStream.receiveVideo = true
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
if Thread.isMainThread {
currentFPSLabel?.text = "\(rtmpStream.currentFPS)"