去掉对status的监听
This commit is contained in:
parent
5377417a1e
commit
684a5f3cf0
Binary file not shown.
@ -611,8 +611,8 @@
|
||||
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "340"
|
||||
endingLineNumber = "340"
|
||||
startingLineNumber = "347"
|
||||
endingLineNumber = "347"
|
||||
landmarkName = "viewDidAppear(_:)"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
@ -627,10 +627,42 @@
|
||||
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "627"
|
||||
endingLineNumber = "627"
|
||||
startingLineNumber = "634"
|
||||
endingLineNumber = "634"
|
||||
landmarkName = "selectedSpatialType(selectedIndex:)"
|
||||
landmarkType = "7">
|
||||
<Locations>
|
||||
<Location
|
||||
uuid = "EF28D223-534C-4D5B-8564-50D9720BA766 - 6adcab4b430491b5"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "SwiftProject.CCSpatialVideoDisplayController.selectedSpatialType(selectedIndex: Swift.Int) -> ()"
|
||||
moduleName = "SwiftProject"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "632"
|
||||
endingLineNumber = "632"
|
||||
offsetFromSymbolStart = "56">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "EF28D223-534C-4D5B-8564-50D9720BA766 - 6adcab4b430491b5"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "SwiftProject.CCSpatialVideoDisplayController.selectedSpatialType(selectedIndex: Swift.Int) -> ()"
|
||||
moduleName = "SwiftProject"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "632"
|
||||
endingLineNumber = "632"
|
||||
offsetFromSymbolStart = "52">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
|
||||
@ -233,32 +233,39 @@ class CCSpatialVideoDisplayController: BaseController {
|
||||
Task {
|
||||
print("ccs viewdid load ---------")
|
||||
await self.loadVideoAssetReader()
|
||||
DispatchQueue.main.async {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now()+0.2) {
|
||||
self.configureInfo()
|
||||
// 检查当前是否已连接到 AirPlay 设备
|
||||
self.checkAirPlayStatus()
|
||||
}
|
||||
// DispatchQueue.main.async {
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
|
||||
print("播放状态status改变....")
|
||||
if(keyPath == "status"){
|
||||
guard let ce = change else {
|
||||
return
|
||||
}
|
||||
|
||||
let newVa = ce[NSKeyValueChangeKey.newKey] as! AVPlayer.Status
|
||||
let oldVa = ce[NSKeyValueChangeKey.oldKey] as! AVPlayer.Status
|
||||
if (newVa != oldVa) {
|
||||
if newVa == .readyToPlay {
|
||||
player?.play()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
|
||||
// print("播放状态\(keyPath)改变...\(change).")
|
||||
// if(keyPath == "status"){
|
||||
// guard let ce = change else {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// let newVa = ce[NSKeyValueChangeKey.kindKey] as? Int
|
||||
//
|
||||
// if newVa != nil {
|
||||
// if AVPlayer.Status(rawValue: newVa!) == .readyToPlay {
|
||||
// DispatchQueue.main.async {[weak self] in
|
||||
// print(">>>>>>bo fang....")
|
||||
// self?.player?.play()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
func configureInfo(){
|
||||
|
||||
@ -266,7 +273,7 @@ class CCSpatialVideoDisplayController: BaseController {
|
||||
player = AVPlayer()
|
||||
player?.allowsExternalPlayback = true
|
||||
player?.usesExternalPlaybackWhileExternalScreenIsActive = true
|
||||
player?.addObserver(self, forKeyPath: "status", context: nil)
|
||||
// player?.addObserver(self, forKeyPath: "status", context: nil)
|
||||
|
||||
print("getPlayerItem >>>>>>>")
|
||||
self.view.backgroundColor = UIColor(hexString: "#060507")
|
||||
@ -521,7 +528,7 @@ class CCSpatialVideoDisplayController: BaseController {
|
||||
releaseVideoComposition()
|
||||
assetReader?.cancelReading()
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
player?.removeObserver(self, forKeyPath: "status")
|
||||
// player?.removeObserver(self, forKeyPath: "status")
|
||||
}
|
||||
|
||||
func releaseVideoComposition() {
|
||||
|
||||
@ -157,7 +157,7 @@ extension CCSpatialVideoDisplayController {
|
||||
//加载完毕之后再进行play
|
||||
DispatchQueue.main.async {
|
||||
|
||||
self.player!.play()
|
||||
self.player?.play()
|
||||
|
||||
print("资产加载完毕。。。。开始播放player\n err:\(self.player?.error)")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user