播放页面,控制横屏,还需要进一步处理
This commit is contained in:
parent
71d0ca1a10
commit
61ef45d508
@ -1070,7 +1070,7 @@
|
|||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
|
||||||
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
|
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
@ -1122,7 +1122,7 @@
|
|||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard;
|
||||||
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
|
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
|||||||
Binary file not shown.
@ -545,8 +545,8 @@
|
|||||||
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/CCSpatialVideoDisplayController.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "280"
|
startingLineNumber = "373"
|
||||||
endingLineNumber = "280"
|
endingLineNumber = "373"
|
||||||
landmarkName = "notification_didActiveNotification(notification:)"
|
landmarkName = "notification_didActiveNotification(notification:)"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@ -641,8 +641,8 @@
|
|||||||
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/ZZHCustomSlider.swift"
|
filePath = "SwiftProject/Project/Controller/RecordingVideo/CCSpatialVideoDisplayController/ZZHCustomSlider.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "265"
|
startingLineNumber = "266"
|
||||||
endingLineNumber = "265"
|
endingLineNumber = "266"
|
||||||
landmarkName = "touchesCancelled(_:with:)"
|
landmarkName = "touchesCancelled(_:with:)"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@ -650,49 +650,49 @@
|
|||||||
<BreakpointProxy
|
<BreakpointProxy
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
<BreakpointContent
|
<BreakpointContent
|
||||||
uuid = "33963580-0C7F-4FE4-AE70-F6DF35741254"
|
uuid = "CD9BB14F-8F94-4719-990D-C68773DB9C48"
|
||||||
shouldBeEnabled = "Yes"
|
shouldBeEnabled = "Yes"
|
||||||
ignoreCount = "0"
|
ignoreCount = "0"
|
||||||
continueAfterRunningActions = "No"
|
continueAfterRunningActions = "No"
|
||||||
filePath = "SwiftProject/Project/Util/PlayByTransferConvertor.swift"
|
filePath = "SwiftProject/Project/Controller/RecordingVideo/VRVideoTransformController.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "260"
|
startingLineNumber = "160"
|
||||||
endingLineNumber = "260"
|
endingLineNumber = "160"
|
||||||
landmarkName = "getImgWithScale(image:scale:)"
|
landmarkName = "viewDidLoad()"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "9F19BD4E-941C-4D52-B3EF-40E453A907BA"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "SwiftProject/CCKit/Base/BaseVirtualController.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "90"
|
||||||
|
endingLineNumber = "90"
|
||||||
|
landmarkName = "setNavgationBarColor(color:)"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "67370F57-E845-49B3-A0B1-BBC5E230A1D7"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "SwiftProject/CCKit/Base/BaseVirtualController.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "69"
|
||||||
|
endingLineNumber = "69"
|
||||||
|
landmarkName = "setNavgationBarImg(string:)"
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
<Locations>
|
|
||||||
<Location
|
|
||||||
uuid = "33963580-0C7F-4FE4-AE70-F6DF35741254 - 93a5385675665f6e"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
symbolName = "SwiftProject.PlayByTransferConvertor.getImgWithScale(image: __C.UIImage, scale: CoreGraphics.CGFloat) -> (__C.UIImage, __C.CGSize)"
|
|
||||||
moduleName = "SwiftProject"
|
|
||||||
usesParentBreakpointCondition = "Yes"
|
|
||||||
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/PlayByTransferConvertor.swift"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "256"
|
|
||||||
endingLineNumber = "256"
|
|
||||||
offsetFromSymbolStart = "1056">
|
|
||||||
</Location>
|
|
||||||
<Location
|
|
||||||
uuid = "33963580-0C7F-4FE4-AE70-F6DF35741254 - e6cd3874189e0e8a"
|
|
||||||
shouldBeEnabled = "Yes"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
symbolName = "SwiftProject.PlayByTransferConvertor.joinImages_backup(leftImage: __C.CIImage, rightImage: __C.CIImage) -> __C.CIImage"
|
|
||||||
moduleName = "SwiftProject"
|
|
||||||
usesParentBreakpointCondition = "Yes"
|
|
||||||
urlString = "file:///Users/aaa/Documents/IOS%20Dev/VR/SwiftProject/SwiftProject/Project/Util/PlayByTransferConvertor.swift"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "256"
|
|
||||||
endingLineNumber = "256"
|
|
||||||
offsetFromSymbolStart = "572">
|
|
||||||
</Location>
|
|
||||||
</Locations>
|
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
</Breakpoints>
|
</Breakpoints>
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import FirebaseRemoteConfig
|
|||||||
|
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
var remoteConfig:FirebaseRemoteConfig.RemoteConfig?
|
var remoteConfig:FirebaseRemoteConfig.RemoteConfig?
|
||||||
|
var allowRotation = false
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
// var root:RootManager?
|
// var root:RootManager?
|
||||||
var newWindow:UIWindow?
|
var newWindow:UIWindow?
|
||||||
@ -87,6 +88,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
|
||||||
|
if self.allowRotation {
|
||||||
|
return UIInterfaceOrientationMask.all
|
||||||
|
}
|
||||||
|
return UIInterfaceOrientationMask.portrait
|
||||||
|
}
|
||||||
|
|
||||||
// func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
// func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
||||||
// print("configurationForConnecting....")
|
// print("configurationForConnecting....")
|
||||||
// let scene = UIWindowScene(session: connectingSceneSession, connectionOptions: options)
|
// let scene = UIWindowScene(session: connectingSceneSession, connectionOptions: options)
|
||||||
|
|||||||
@ -78,8 +78,13 @@ class BaseController: BaseVirtualController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
KAppDelegate?.allowRotation = false
|
||||||
|
self.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||||
|
|
||||||
self.setNavgationBarColorImg(color: .black)
|
self.setNavgationBarColorImg(color: .black)
|
||||||
// self.setNavgationBarColorImg(color: tabBarTintSelectColor)
|
// self.setNavgationBarColorImg(color: tabBarTintSelectColor)
|
||||||
self.setNavgationBarLine(color: BackGroundColor)
|
self.setNavgationBarLine(color: BackGroundColor)
|
||||||
|
|||||||
@ -112,9 +112,13 @@ class BaseVirtualController: UIViewController {
|
|||||||
public func setNavgationBarColorImg(color:UIColor){
|
public func setNavgationBarColorImg(color:UIColor){
|
||||||
if(navtionBar == nil){
|
if(navtionBar == nil){
|
||||||
navtionBar = UIImageView.init()
|
navtionBar = UIImageView.init()
|
||||||
navtionBar?.frame = CGRect.init(x: 0, y: 0, width: SCREEN_Width, height: SafeAreaTop_Height)
|
// navtionBar?.frame = CGRect.init(x: 0, y: 0, width: SCREEN_Width, height: SafeAreaTop_Height)
|
||||||
navtionBar?.isUserInteractionEnabled = true
|
navtionBar?.isUserInteractionEnabled = true
|
||||||
view.addSubview(navtionBar!)
|
view.addSubview(navtionBar!)
|
||||||
|
navtionBar?.snp.makeConstraints { make in
|
||||||
|
make.left.top.right.equalToSuperview()
|
||||||
|
make.height.equalTo(SafeAreaTop_Height)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(navtionImgView == nil){
|
if(navtionImgView == nil){
|
||||||
navtionImgView = UIImageView.init()
|
navtionImgView = UIImageView.init()
|
||||||
|
|||||||
@ -23,5 +23,7 @@ class RootNavigationController: UINavigationController {
|
|||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// appli
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,23 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>fb349630657543828</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>FacebookAppID</key>
|
||||||
|
<string>349630657543828</string>
|
||||||
<key>FacebookAutoLogAppEventsEnabled</key>
|
<key>FacebookAutoLogAppEventsEnabled</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>FacebookClientToken</key>
|
||||||
|
<string>14b6cc1b437b5a201663ebd7e1a9b2bb</string>
|
||||||
|
<key>FacebookDisplayName</key>
|
||||||
|
<string>VPCamera</string>
|
||||||
<key>FirebaseAutomaticScreenReportingEnabled</key>
|
<key>FirebaseAutomaticScreenReportingEnabled</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
@ -43,20 +58,5 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<key>UIBackgroundModes</key>
|
<key>UIBackgroundModes</key>
|
||||||
<array/>
|
<array/>
|
||||||
<key>CFBundleURLTypes</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleURLSchemes</key>
|
|
||||||
<array>
|
|
||||||
<string>fb349630657543828</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>FacebookAppID</key>
|
|
||||||
<string>349630657543828</string>
|
|
||||||
<key>FacebookClientToken</key>
|
|
||||||
<string>14b6cc1b437b5a201663ebd7e1a9b2bb</string>
|
|
||||||
<key>FacebookDisplayName</key>
|
|
||||||
<string>VPCamera</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@ -104,6 +104,7 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
|
|
||||||
var customPlayer:ZZHCustomPlayer = {
|
var customPlayer:ZZHCustomPlayer = {
|
||||||
let cp = ZZHCustomPlayer(frame: .zero)
|
let cp = ZZHCustomPlayer(frame: .zero)
|
||||||
|
|
||||||
return cp
|
return cp
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -222,8 +223,86 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
self.customPlayer.setUPPlayer()
|
self.customPlayer.setUPPlayer()
|
||||||
// 检查当前是否已连接到 AirPlay 设备
|
// 检查当前是否已连接到 AirPlay 设备
|
||||||
self.checkAirPlayStatus()
|
self.checkAirPlayStatus()
|
||||||
|
KAppDelegate?.allowRotation = true
|
||||||
|
listingScreenOrientatinChange()
|
||||||
|
// self.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewWillDisappear(_ animated: Bool) {
|
||||||
|
super.viewWillDisappear(animated)
|
||||||
|
self.customPlayer.play(false)
|
||||||
|
KAppDelegate?.allowRotation = false
|
||||||
|
self.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
|
super.viewWillAppear(animated)
|
||||||
|
KAppDelegate?.allowRotation = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override func viewDidDisappear(_ animated: Bool) {
|
||||||
|
super.viewDidDisappear(animated)
|
||||||
|
if externalVC != nil {
|
||||||
|
externalVC?.playerLayer?.player = nil
|
||||||
|
}
|
||||||
|
customPlayer.play(false)
|
||||||
|
releaseVideoComposition()
|
||||||
|
|
||||||
|
let sec:TimeInterval = ZZHHelper.getSecFromUserDefaultByKey(kNowTimeToUserDefaultKey_VideoDisplayController)
|
||||||
|
Analytics.logEvent("preview_pv", parameters: ["refer_page":"视频预览页面","duration":sec])
|
||||||
|
|
||||||
|
print(".........ccs viewdid disappear....")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
|
super.viewDidAppear(animated)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始监听设备方向变化
|
||||||
|
func listingScreenOrientatinChange() {
|
||||||
|
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
|
||||||
|
// 添加监听器
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(screenOrientationRotate), name: UIDevice.orientationDidChangeNotification, object: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func screenOrientationRotate() {
|
||||||
|
let orientation = UIDevice.current.orientation
|
||||||
|
switch orientation {
|
||||||
|
case .portrait , .portraitUpsideDown:
|
||||||
|
print("Portrait")
|
||||||
|
self.customPlayer.snp.updateConstraints { make in
|
||||||
|
make.height.equalTo(460)
|
||||||
|
}
|
||||||
|
navtionBar?.snp.updateConstraints { make in
|
||||||
|
make.top.equalToSuperview().offset(0)
|
||||||
|
}
|
||||||
|
self.view.layoutIfNeeded()
|
||||||
|
self.customPlayer.layoutViewWhenScreenLandscape(value: false)
|
||||||
|
self.navtionBar?.isHidden = false
|
||||||
|
self.customPlayer.isLandscape = false
|
||||||
|
break
|
||||||
|
case .landscapeLeft , .landscapeRight:
|
||||||
|
print("Landscape ...")
|
||||||
|
self.customPlayer.isLandscape = true
|
||||||
|
self.customPlayer.snp.updateConstraints { make in
|
||||||
|
make.height.equalTo(KScreenWidth)
|
||||||
|
}
|
||||||
|
|
||||||
|
navtionBar?.snp.updateConstraints { make in
|
||||||
|
make.top.equalToSuperview().offset(-KStatusBarHeight * 0.5)
|
||||||
|
}
|
||||||
|
self.view.layoutIfNeeded()
|
||||||
|
self.customPlayer.layoutViewWhenScreenLandscape(value: true)
|
||||||
|
self.navtionBar?.isHidden = true
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
print("Other")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func configureUI(){
|
func configureUI(){
|
||||||
self.view.backgroundColor = UIColor(hexString: "#060507")
|
self.view.backgroundColor = UIColor(hexString: "#060507")
|
||||||
@ -237,7 +316,19 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
self.view.bringSubviewToFront(self.navtionBar!)
|
self.view.bringSubviewToFront(self.navtionBar!)
|
||||||
|
|
||||||
navtionBar?.addSubview(transformButton)
|
navtionBar?.addSubview(transformButton)
|
||||||
|
transformButton.snp.makeConstraints { make in
|
||||||
|
make.width.equalTo(56)
|
||||||
|
make.height.equalTo(36)
|
||||||
|
make.right.equalToSuperview().offset(-14)
|
||||||
|
make.centerY.equalToSuperview().offset(StatuBar_Height*0.5)
|
||||||
|
}
|
||||||
navtionBar?.addSubview(mTopCenterTypeButton)
|
navtionBar?.addSubview(mTopCenterTypeButton)
|
||||||
|
mTopCenterTypeButton.snp.makeConstraints { make in
|
||||||
|
make.height.equalTo(36)
|
||||||
|
make.width.equalTo(SCREEN_Width * 0.4 + 20)
|
||||||
|
make.centerX.equalToSuperview()
|
||||||
|
make.centerY.equalToSuperview().offset(StatuBar_Height*0.5)
|
||||||
|
}
|
||||||
|
|
||||||
self.view.addSubview(tipsButton)
|
self.view.addSubview(tipsButton)
|
||||||
self.view.addSubview(self.customPlayer)
|
self.view.addSubview(self.customPlayer)
|
||||||
@ -246,7 +337,9 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
make.height.equalTo(460)
|
make.height.equalTo(460)
|
||||||
}
|
}
|
||||||
self.customPlayer.sourceVideoURL = sourceVideoURL
|
self.customPlayer.sourceVideoURL = sourceVideoURL
|
||||||
|
self.customPlayer.maskViewTapCallback = {[weak self] in
|
||||||
|
self?.navtionBar?.isHidden = !(self?.navtionBar?.isHidden ?? true)
|
||||||
|
}
|
||||||
self.view.addSubview(self.maskLabel)
|
self.view.addSubview(self.maskLabel)
|
||||||
self.maskLabel.snp.makeConstraints { make in
|
self.maskLabel.snp.makeConstraints { make in
|
||||||
make.left.equalTo(customPlayer.snp.left)
|
make.left.equalTo(customPlayer.snp.left)
|
||||||
@ -294,27 +387,7 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
print("notificatin_newErrorLogEntryNotification....")
|
print("notificatin_newErrorLogEntryNotification....")
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidDisappear(_ animated: Bool) {
|
|
||||||
super.viewDidDisappear(animated)
|
|
||||||
if externalVC != nil {
|
|
||||||
externalVC?.playerLayer?.player = nil
|
|
||||||
}
|
|
||||||
customPlayer.play(false)
|
|
||||||
releaseVideoComposition()
|
|
||||||
|
|
||||||
let sec:TimeInterval = ZZHHelper.getSecFromUserDefaultByKey(kNowTimeToUserDefaultKey_VideoDisplayController)
|
|
||||||
Analytics.logEvent("preview_pv", parameters: ["refer_page":"视频预览页面","duration":sec])
|
|
||||||
|
|
||||||
print(".........ccs viewdid disappear....")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override func viewDidAppear(_ animated: Bool) {
|
|
||||||
super.viewDidAppear(animated)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//MARK: - 监听设备投流
|
//MARK: - 监听设备投流
|
||||||
@objc private func airPlayStatusDidChange(_ notification: Notification) {
|
@objc private func airPlayStatusDidChange(_ notification: Notification) {
|
||||||
@ -472,6 +545,8 @@ class CCSpatialVideoDisplayController: BaseController {
|
|||||||
print("patialvideodisplaycontroler deinit......")
|
print("patialvideodisplaycontroler deinit......")
|
||||||
releaseVideoComposition()
|
releaseVideoComposition()
|
||||||
NotificationCenter.default.removeObserver(self)
|
NotificationCenter.default.removeObserver(self)
|
||||||
|
// 停止监听设备方向变化
|
||||||
|
UIDevice.current.endGeneratingDeviceOrientationNotifications()
|
||||||
}
|
}
|
||||||
|
|
||||||
func releaseVideoComposition() {
|
func releaseVideoComposition() {
|
||||||
|
|||||||
@ -9,10 +9,14 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
|
|
||||||
|
typealias CustomMaskViewTapCallback = ()->Void
|
||||||
|
|
||||||
class ZZHCustomPlayer: UIView {
|
class ZZHCustomPlayer: UIView {
|
||||||
|
|
||||||
|
//点击maskview 的回调,主要用于方向旋转
|
||||||
|
var maskViewTapCallback:CustomMaskViewTapCallback?
|
||||||
|
//标记是否为横屏
|
||||||
|
var isLandscape:Bool = false
|
||||||
//视频资源
|
//视频资源
|
||||||
var sourceVideoURL:URL?
|
var sourceVideoURL:URL?
|
||||||
var assetTrack:AVAssetTrack?
|
var assetTrack:AVAssetTrack?
|
||||||
@ -63,7 +67,7 @@ class ZZHCustomPlayer: UIView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let playerPauseBgColor:UIColor = UIColor(r: 20, g: 20, b: 20, a: 0.2)//暂停时的背景颜色
|
let playerPauseBgColor:UIColor = UIColor(r: 20, g: 20, b: 20, a: 0.2)//暂停时的背景颜色
|
||||||
|
let playerHeight = 230 //播放器默认高度
|
||||||
|
|
||||||
lazy var maskPlayerView:UIView? = {//播放按钮 背景
|
lazy var maskPlayerView:UIView? = {//播放按钮 背景
|
||||||
let bgView = UIView()
|
let bgView = UIView()
|
||||||
@ -127,7 +131,7 @@ class ZZHCustomPlayer: UIView {
|
|||||||
NotificationCenter.default.addObserver(self, selector: #selector(notification_PlayerEndTime(notification:)), name: AVPlayerItem.didPlayToEndTimeNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(notification_PlayerEndTime(notification:)), name: AVPlayerItem.didPlayToEndTimeNotification, object: nil)
|
||||||
|
|
||||||
let playerWidth = KScreenWidth
|
let playerWidth = KScreenWidth
|
||||||
let playerHeight = 230
|
|
||||||
playerLayerBgView = UIView()
|
playerLayerBgView = UIView()
|
||||||
self.addSubview(playerLayerBgView!)
|
self.addSubview(playerLayerBgView!)
|
||||||
playerLayerBgView!.snp.makeConstraints { make in
|
playerLayerBgView!.snp.makeConstraints { make in
|
||||||
@ -147,11 +151,17 @@ class ZZHCustomPlayer: UIView {
|
|||||||
playerLayerBgView?.backgroundColor = UIColor.red
|
playerLayerBgView?.backgroundColor = UIColor.red
|
||||||
|
|
||||||
//添加遮罩视图
|
//添加遮罩视图
|
||||||
let mpBgView = UIView(frame: avPlayerLayer!.frame)
|
let mpBgView = UIView(frame: .zero)
|
||||||
playerLayerBgView?.addSubview(mpBgView)
|
playerLayerBgView?.addSubview(mpBgView)
|
||||||
|
mpBgView.snp.makeConstraints { make in
|
||||||
|
make.left.top.bottom.right.equalToSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
self.maskPlayerView?.frame = mpBgView.bounds
|
self.maskPlayerView?.frame = mpBgView.bounds
|
||||||
mpBgView.addSubview(maskPlayerView!)
|
mpBgView.addSubview(maskPlayerView!)
|
||||||
|
maskPlayerView?.snp.makeConstraints { make in
|
||||||
|
make.left.top.bottom.right.equalToSuperview()
|
||||||
|
}
|
||||||
|
|
||||||
let tgr = UITapGestureRecognizer(target: self, action: #selector(tapPlayerMaskView(sender: )))
|
let tgr = UITapGestureRecognizer(target: self, action: #selector(tapPlayerMaskView(sender: )))
|
||||||
mpBgView.addGestureRecognizer(tgr)
|
mpBgView.addGestureRecognizer(tgr)
|
||||||
@ -168,8 +178,8 @@ class ZZHCustomPlayer: UIView {
|
|||||||
timeSlider!.snp.makeConstraints { make in
|
timeSlider!.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(24)
|
make.left.equalToSuperview().offset(24)
|
||||||
// make.right.equalToSuperview().offset(-24)
|
// make.right.equalToSuperview().offset(-24)
|
||||||
make.bottom.equalToSuperview().offset(0)
|
make.bottom.equalToSuperview().offset(-30)
|
||||||
make.height.equalTo(114)
|
make.height.equalTo(84)
|
||||||
}
|
}
|
||||||
|
|
||||||
edBtn = UIButton()
|
edBtn = UIButton()
|
||||||
@ -186,6 +196,28 @@ class ZZHCustomPlayer: UIView {
|
|||||||
self.backgroundColor = .orange
|
self.backgroundColor = .orange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//屏幕旋转时自动隐藏timeSlider、edBtn,同时将播放layer设置为全屏
|
||||||
|
func layoutViewWhenScreenLandscape(value:Bool) {
|
||||||
|
if value {
|
||||||
|
timeSlider?.isHidden = true
|
||||||
|
edBtn?.isHidden = true
|
||||||
|
playerLayerBgView?.snp.updateConstraints { make in
|
||||||
|
make.height.equalTo(KScreenWidth)
|
||||||
|
}
|
||||||
|
self.layoutIfNeeded()
|
||||||
|
avPlayerLayer?.frame = CGRect(x: 0, y: 0, width: KScreenHeight, height: KScreenWidth)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
timeSlider?.isHidden = false
|
||||||
|
edBtn?.isHidden = false
|
||||||
|
playerLayerBgView?.snp.updateConstraints { make in
|
||||||
|
make.height.equalTo(KScreenWidth)
|
||||||
|
}
|
||||||
|
self.layoutIfNeeded()
|
||||||
|
avPlayerLayer?.frame = CGRect(x: 0, y: 0, width: Int(KScreenWidth), height: playerHeight)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//显示调节瞳距、缩放的界面
|
//显示调节瞳距、缩放的界面
|
||||||
@objc func showEDView(sender:UIButton){
|
@objc func showEDView(sender:UIButton){
|
||||||
CustomParamBoardView.showBoard(scaleCallback: {[weak self] scale in
|
CustomParamBoardView.showBoard(scaleCallback: {[weak self] scale in
|
||||||
@ -322,6 +354,14 @@ class ZZHCustomPlayer: UIView {
|
|||||||
//点击了player 的maskview
|
//点击了player 的maskview
|
||||||
@objc func tapPlayerMaskView(sender:UITapGestureRecognizer) {
|
@objc func tapPlayerMaskView(sender:UITapGestureRecognizer) {
|
||||||
updatePlayMaskView(!(maskPlayerView!.isHidden))
|
updatePlayMaskView(!(maskPlayerView!.isHidden))
|
||||||
|
if isLandscape {
|
||||||
|
if let mcallback = maskViewTapCallback {
|
||||||
|
mcallback()
|
||||||
|
}
|
||||||
|
self.timeSlider?.isHidden = !self.timeSlider!.isHidden
|
||||||
|
self.edBtn?.isHidden = !self.edBtn!.isHidden
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//缩放手势 正在player的maskview进行缩放
|
//缩放手势 正在player的maskview进行缩放
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
typealias CustomSliderProcessChangeValueCallback = (_ currentValue:Float,_ isMoving:Bool)->Void
|
typealias CustomSliderProcessChangeValueCallback = (_ currentValue:Float,_ isMoving:Bool)->Void
|
||||||
class ZZHCustomSlider: UIView {
|
class ZZHCustomSlider: UIView {
|
||||||
|
|
||||||
var sHeight:CGFloat?
|
var sHeight:CGFloat?
|
||||||
var sLabel:UILabel?
|
var sLabel:UILabel?
|
||||||
var eLabel:UILabel?
|
var eLabel:UILabel?
|
||||||
@ -25,7 +26,7 @@ class ZZHCustomSlider: UIView {
|
|||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
self.backgroundColor = .black
|
self.backgroundColor = .clear
|
||||||
self.addSubview(bgView)
|
self.addSubview(bgView)
|
||||||
bgView.snp.makeConstraints { make in
|
bgView.snp.makeConstraints { make in
|
||||||
make.left.right.equalToSuperview()
|
make.left.right.equalToSuperview()
|
||||||
@ -370,7 +371,7 @@ class CustomParamBoardView: UIView {
|
|||||||
make.bottom.equalToSuperview().offset(bgViewHeight)
|
make.bottom.equalToSuperview().offset(bgViewHeight)
|
||||||
make.centerX.equalToSuperview()
|
make.centerX.equalToSuperview()
|
||||||
}
|
}
|
||||||
self.superBgView.backgroundColor = .black
|
self.superBgView.backgroundColor = .clear
|
||||||
// let blackBgView = UIView()
|
// let blackBgView = UIView()
|
||||||
// self.addSubview(blackBgView)
|
// self.addSubview(blackBgView)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user