diff --git a/SwiftProject/SwiftProject.xcodeproj/project.pbxproj b/SwiftProject/SwiftProject.xcodeproj/project.pbxproj index 04b2829..2bc877c 100644 --- a/SwiftProject/SwiftProject.xcodeproj/project.pbxproj +++ b/SwiftProject/SwiftProject.xcodeproj/project.pbxproj @@ -19,6 +19,8 @@ 006B61D32BBAA938003FCB49 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006B61D22BBAA938003FCB49 /* StoreKit.framework */; }; 006B61DC2BBCFAC4003FCB49 /* CustomSheetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006B61DB2BBCFAC4003FCB49 /* CustomSheetController.swift */; }; 006B61DE2BBCFB45003FCB49 /* CustomSheetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006B61DD2BBCFB45003FCB49 /* CustomSheetCell.swift */; }; + 0073BD142BCE80F700721885 /* ZZHCustomPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0073BD132BCE80F700721885 /* ZZHCustomPlayer.swift */; }; + 0073BD182BCF7B3400721885 /* ZZHCustomSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0073BD172BCF7B3400721885 /* ZZHCustomSlider.swift */; }; 009661F82BAD6C7100FCA65F /* CCSpaceAlbumFilterPopView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 009661F72BAD6C7100FCA65F /* CCSpaceAlbumFilterPopView2.swift */; }; 009661FA2BAD876200FCA65F /* PhotosUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 009661F92BAD876200FCA65F /* PhotosUI.framework */; }; 009661FC2BADB20D00FCA65F /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 009661FB2BADB20D00FCA65F /* CoreMotion.framework */; }; @@ -126,6 +128,8 @@ 006B61D22BBAA938003FCB49 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; 006B61DB2BBCFAC4003FCB49 /* CustomSheetController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSheetController.swift; sourceTree = ""; }; 006B61DD2BBCFB45003FCB49 /* CustomSheetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSheetCell.swift; sourceTree = ""; }; + 0073BD132BCE80F700721885 /* ZZHCustomPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZZHCustomPlayer.swift; sourceTree = ""; }; + 0073BD172BCF7B3400721885 /* ZZHCustomSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZZHCustomSlider.swift; sourceTree = ""; }; 009661F72BAD6C7100FCA65F /* CCSpaceAlbumFilterPopView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCSpaceAlbumFilterPopView2.swift; sourceTree = ""; }; 009661F92BAD876200FCA65F /* PhotosUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PhotosUI.framework; path = System/Library/Frameworks/PhotosUI.framework; sourceTree = SDKROOT; }; 009661FB2BADB20D00FCA65F /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; @@ -296,6 +300,8 @@ children = ( 1E1EA2932B9364F000A5D5D2 /* CCSpatialVideoDisplayController.swift */, 009662592BB552E700FCA65F /* CCSpatialVideoDisplayForVideoTask.swift */, + 0073BD132BCE80F700721885 /* ZZHCustomPlayer.swift */, + 0073BD172BCF7B3400721885 /* ZZHCustomSlider.swift */, ); path = CCSpatialVideoDisplayController; sourceTree = ""; @@ -816,6 +822,7 @@ AF2120C32B4E95DA00400B7F /* NSObject+Add.swift in Sources */, 1EE5C5F72B8F973A00EDFC2F /* CCSpatialShootController.swift in Sources */, 006B61DE2BBCFB45003FCB49 /* CustomSheetCell.swift in Sources */, + 0073BD142BCE80F700721885 /* ZZHCustomPlayer.swift in Sources */, 1EFB8C782B88E2F600C72119 /* UIColor+CCExtension.swift in Sources */, 00D33BF62B99A19900604A44 /* SpatialVideoConvertor.swift in Sources */, CBBE190C2BC929F50095F6C4 /* FeedBackVC.swift in Sources */, @@ -859,6 +866,7 @@ 0096625A2BB552E700FCA65F /* CCSpatialVideoDisplayForVideoTask.swift in Sources */, 1EFB8C702B88DA4800C72119 /* CCBottomMenuCell.swift in Sources */, AF2120FA2B4EA5BD00400B7F /* CCHomeController.swift in Sources */, + 0073BD182BCF7B3400721885 /* ZZHCustomSlider.swift in Sources */, 00ED6B342BA04AC200915BDE /* PlayByTransferConvertor.swift in Sources */, AF2121072B4EA63000400B7F /* CCHomeData.swift in Sources */, AF2120FE2B4EA5F100400B7F /* CCLoginController.swift in Sources */, diff --git a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate index 7633cd6..597a3b5 100644 Binary files a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate and b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 47d2ab5..9c77ae3 100644 --- a/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/SwiftProject/SwiftProject.xcworkspace/xcuserdata/aaa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -14,9 +14,9 @@ filePath = "SwiftProject/Project/Controller/CCHomeController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "571" - endingLineNumber = "571" - landmarkName = "imagePickerController(_:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:infos:)" + startingLineNumber = "584" + endingLineNumber = "584" + landmarkName = "imagePickerController(_:didFinishPickingMediaWithInfo:)" landmarkType = "7"> @@ -30,10 +30,10 @@ filePath = "SwiftProject/Project/Controller/CCHomeController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "563" - endingLineNumber = "563" - landmarkName = "imagePickerController(_:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:infos:)" - landmarkType = "7"> + startingLineNumber = "576" + endingLineNumber = "576" + landmarkName = "CCHomeController" + landmarkType = "21"> @@ -457,102 +457,6 @@ landmarkType = "7"> - - - - - - - - - - - - - - - - - - - - Void +class ZZHCustomSlider: UIView { + var sHeight:CGFloat? + var sLabel:UILabel? + var eLabel:UILabel? + var timeSlider:CustomSlider? + var processChangeValueCallback:CustomSliderProcessChangeValueCallback? + var preValue:Float = 0.0 //更新进度前的value + + let bgView:UIView = UIView() + + + + override init(frame: CGRect) { + super.init(frame: frame) + self.backgroundColor = .black + self.addSubview(bgView) + bgView.snp.makeConstraints { make in + make.left.right.equalToSuperview() + make.centerY.equalToSuperview() + make.height.equalTo(28) + } + + timeSlider = CustomSlider() + timeSlider?.isUserInteractionEnabled = false + bgView.addSubview(timeSlider!) + timeSlider!.snp.makeConstraints { make in + make.top.equalToSuperview() + make.left.equalToSuperview() + make.right.equalToSuperview() + } + + sLabel = UILabel() + bgView.addSubview(sLabel!) + eLabel = UILabel() + bgView.addSubview(eLabel!) + sLabel?.snp.makeConstraints({ make in + make.left.equalTo(timeSlider!.snp.left) + make.top.equalTo(timeSlider!.snp.bottom).offset(10) + make.bottom.equalToSuperview() + }) + + eLabel?.snp.makeConstraints({ make in + make.right.equalTo(timeSlider!.snp.right) + make.top.equalTo(sLabel!.snp.top) + make.bottom.equalTo(sLabel!.snp.bottom) + + }) + + sLabel?.font = UIFont.systemFont(ofSize: 14) + eLabel?.font = UIFont.systemFont(ofSize: 14) + + sLabel?.textColor = .white + eLabel?.textColor = .white + + sLabel?.text = "--:--:--" + eLabel?.text = "--:--:--" + timeSlider?.setThumbImage(UIImage(named: "slider_thumb"), for: .normal) + timeSlider?.minimumTrackTintColor = .white + timeSlider?.maximumTrackTintColor = UIColor(r: 20, g: 20, b: 20, a: 0.8) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //内部拖动更新当前滑块value:0~1 + func updateProcessValue(value:Float) { + self.timeSlider!.value = value + guard let processChangeValueCallback else { + return + } + var currentValue = max(0, min(value, 1)) + //格式化为0.x + let formattedValue = String(format: "%.1f", currentValue) + currentValue = Float(formattedValue)! + + if currentValue > preValue || currentValue < preValue { + preValue = currentValue + processChangeValueCallback(preValue) + } + } + + //外部播放时的更新当前滑块 + func exUpdateProcessValue(value:Float) { + self.timeSlider!.value = value + preValue = value + } + + + override func touchesMoved(_ touches: Set, with event: UIEvent?) { + super.touchesMoved(touches, with: event) + if timeSlider!.isNormal == true { + timeSlider!.isNormal = false + sHeight = self.bgView.height + self.updateSliderHeight(height: (self.sHeight)! + 5) + } + let touch = touches.first + if let th = touch { + let touchPoint = th.location(in: self.timeSlider!) + + updateProcessValue(value: Float(touchPoint.x / self.timeSlider!.frame.size.width)) + } + } + + override func touchesEnded(_ touches: Set, with event: UIEvent?) { + super.touchesEnded(touches, with: event) + if timeSlider!.isNormal == false { + timeSlider!.isNormal = true + self.updateSliderHeight(height: (self.sHeight)!) + } + } + + override func touchesCancelled(_ touches: Set, with event: UIEvent?) { + if timeSlider!.isNormal == false { + timeSlider!.isNormal = true + self.updateSliderHeight(height: (self.sHeight)!) + } + } + + + func updateSliderHeight(height:CGFloat) { + UIView.animate(withDuration: 0.25) {[weak self] in + self?.bgView.snp.updateConstraints {make in + make.height.equalTo(height) + } + self?.layoutIfNeeded() + } completion: { finish in + + } + } + +} + + + +class CustomSlider: UISlider { + var isNormal:Bool = true { + didSet { + self.setNeedsLayout() + self.layoutIfNeeded() + } + } + + + override func trackRect(forBounds bounds: CGRect) -> CGRect { + var rect = super.trackRect(forBounds: bounds) + if isNormal == true { + rect = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, 8) + } + else { + rect = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, 10) + } + return rect + } + + +// override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect { +// var nb = super.thumbRect(forBounds: bounds, trackRect: rect, value: value) +// nb = CGRectMake(nb.origin.x, nb.origin.y, 1, 1) +// return nb +// } + + +} diff --git a/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate b/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate index f30ad5c..c0137b3 100644 Binary files a/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate and b/tdvideo/tdvideo.xcodeproj/project.xcworkspace/xcuserdata/aaa.xcuserdatad/UserInterfaceState.xcuserstate differ