视频播放页面,处理前后台切换视频会被暂停播放的问题
This commit is contained in:
parent
5041ceff67
commit
fd8f2ef1b0
@ -338,8 +338,24 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
// NotificationCenter.default.addObserver(self, selector: #selector(notification_PlayerTimeJump(notification:)), name: AVPlayerItem.timeJumpedNotification, object: nil)
|
// NotificationCenter.default.addObserver(self, selector: #selector(notification_PlayerTimeJump(notification:)), name: AVPlayerItem.timeJumpedNotification, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(notificatin_failedToPlayToEndTimeNotification(notifiation: )), name: AVPlayerItem.failedToPlayToEndTimeNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(notificatin_failedToPlayToEndTimeNotification(notifiation: )), name: AVPlayerItem.failedToPlayToEndTimeNotification, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(notificatin_failedToPlayToEndTimeNotification(notifiation: )), name: AVPlayerItem.newErrorLogEntryNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(notificatin_failedToPlayToEndTimeNotification(notifiation: )), name: AVPlayerItem.newErrorLogEntryNotification, object: nil)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(notification_didEnterBackgroundNotification(notification: )), name: UIApplication.didEnterBackgroundNotification, object: nil)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(notification_didActiveNotification(notification: )), name: UIApplication.didBecomeActiveNotification, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//屏幕进入后台
|
||||||
|
@objc func notification_didEnterBackgroundNotification(notification:Notification) {
|
||||||
|
player?.pause()
|
||||||
|
|
||||||
|
print("ccs .....notification_didEnterBackgroundNotification")
|
||||||
|
}
|
||||||
|
//屏幕进入前台
|
||||||
|
@objc func notification_didActiveNotification(notification:Notification) {
|
||||||
|
self.checkAirPlayStatus()
|
||||||
|
print("ccs .....notification_didEnterBackgroundNotification")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@objc func notificatin_failedToPlayToEndTimeNotification(notifiation:Notification) {
|
@objc func notificatin_failedToPlayToEndTimeNotification(notifiation:Notification) {
|
||||||
print("notificatin_failedToPlayToEndTimeNotification....")
|
print("notificatin_failedToPlayToEndTimeNotification....")
|
||||||
|
|
||||||
@ -360,6 +376,7 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
let sec:TimeInterval = ZZHHelper.getSecFromUserDefaultByKey(kNowTimeToUserDefaultKey_VideoDisplayController)
|
let sec:TimeInterval = ZZHHelper.getSecFromUserDefaultByKey(kNowTimeToUserDefaultKey_VideoDisplayController)
|
||||||
Analytics.logEvent("preview_pv", parameters: ["refer_page":"视频预览页面","duration":sec])
|
Analytics.logEvent("preview_pv", parameters: ["refer_page":"视频预览页面","duration":sec])
|
||||||
|
|
||||||
|
print(".........ccs viewdid disappear....")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user