[tvos] 入力切り替え・テレビ電源切断時の挙動メモ
入力切り替え・テレビ電源切断時に AppDelegate
Notification
AVPlayer
の挙動についてメモ
端末
AppleTV tvOS11.4
AppDelegateについて
UIApplicationDelegate | UIApplicationState | |
---|---|---|
入力切り替え(別へ) | func applicationWillResignActive(_ application: UIApplication) | active |
入力切り替え(AppleTVへ) | func applicationDidBecomeActive(_ application: UIApplication) | active |
AppleTVからHDMI抜く | func applicationWillResignActive(_ application: UIApplication) | active |
AppleTVにHDMI差す | func applicationDidBecomeActive(_ application: UIApplication) | active |
TVの電源OFF | 反応なし | |
TVの電源ON | 反応なし |
AVPlayer、Notificationについて
AVPlayer.rate | Notification | |
---|---|---|
入力切り替え(別へ) | 0 | UIApplicationWillResignActiveNotification |
入力切り替え(AppleTVへ) | 1 | AVAudioSessionRouteChangeNotification UIApplicationDidBecomeActiveNotification |
AppleTVからHDMI抜く | 0 | UIApplicationWillResignActiveNotification |
AppleTVにHDMI差す | 1 | AVAudioSessionRouteChangeNotification UIApplicationDidBecomeActiveNotification |
TVの電源OFF | 反応なし | |
TVの電源ON | 反応なし |
ログサンプル
入力切り替え(別へ)
AVPlayer.rate: 0.0
applicationWillResignActive applicationState=>active
Notification.Name(_rawValue: UIApplicationWillResignActiveNotification)
AVPlayer.rate: 0.0
入力切り替え(AppleTVへ)
Notification.Name(_rawValue: AVAudioSessionRouteChangeNotification)
applicationDidBecomeActive applicationState=>active
Notification.Name(_rawValue: UIApplicationDidBecomeActiveNotification)
AVPlayer.rate: 1.0
AppleTVからHDMI抜く
AVPlayer.rate: 0.0
applicationWillResignActive applicationState=>active
Notification.Name(_rawValue: UIApplicationWillResignActiveNotification)
AVPlayer.rate: 0.0
AppleTVにHDMI差す
Notification.Name(_rawValue: AVAudioSessionRouteChangeNotification)
applicationDidBecomeActive applicationState=>active
Notification.Name(_rawValue: UIApplicationDidBecomeActiveNotification)
AVPlayer.rate: 1.0
TVの電源OFF
AVPlayer.rate: 0.0
applicationWillResignActive applicationState=>active
Notification.Name(_rawValue: UIApplicationWillResignActiveNotification)
AVPlayer.rate: 0.0
Notification.Name(_rawValue: AVAudioSessionRouteChangeNotification)
applicationDidBecomeActive applicationState=>active
Notification.Name(_rawValue: UIApplicationDidBecomeActiveNotification)
AVPlayer.rate: 1.0
AVPlayer.rate: 0.0
applicationWillResignActive applicationState=>active
Notification.Name(_rawValue: UIApplicationWillResignActiveNotification)
AVPlayer.rate: 0.0
Notification.Name(_rawValue: AVAudioSessionRouteChangeNotification)
applicationDidBecomeActive applicationState=>active
Notification.Name(_rawValue: UIApplicationDidBecomeActiveNotification)
AVPlayer.rate: 1.0
TV電源ON
スクリーンセーバー
applicationWillResignActive applicationState=>active
Notification.Name(_rawValue: UIApplicationWillResignActiveNotification)
AVPlayer.rate: 0.0
スリープ
applicationDidEnterBackground applicationState=>background
Notification.Name(_rawValue: UIApplicationDidEnterBackgroundNotification)
application(_:shouldSaveApplicationState:) applicationState=>background
application(_:willEncodeRestorableStateWith:) applicationState=>background
Notification.Name(_rawValue: AVAudioSessionInterruptionNotification)
Author And Source
この問題について([tvos] 入力切り替え・テレビ電源切断時の挙動メモ), 我々は、より多くの情報をここで見つけました https://qiita.com/hryk224/items/9dc298224a2ba5b416e3著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .