From bbe3c209ac519428482ef063f2a434192d74b8d8 Mon Sep 17 00:00:00 2001 From: Emirhan Saygiver Date: Sun, 19 Mar 2023 23:24:07 +0300 Subject: [PATCH] version 0.1.0 --- EVPlayer.podspec | 13 +++------- Example/EVPlayer.xcodeproj/project.pbxproj | 16 ++++++++---- .../xcschemes/EVPlayer-Example.xcscheme | 26 +++++++------------ Example/EVPlayer/AppDelegate.swift | 2 +- Example/EVPlayer/ViewController.swift | 4 +-- Example/Pods/Pods.xcodeproj/project.pbxproj | 6 ++--- Source/EVPlayer.swift | 6 ++--- Source/Interfaces/ObserverImpl.swift | 2 +- Source/Interfaces/PlayerImpl.swift | 2 +- Source/Interfaces/StateImpl.swift | 8 +++--- Source/Interfaces/UIImpl.swift | 9 +++---- Source/Views/EVBufferingView.swift | 4 +-- Source/Views/EVEmptyView.swift | 1 + 13 files changed, 46 insertions(+), 53 deletions(-) diff --git a/EVPlayer.podspec b/EVPlayer.podspec index c292486..274a766 100644 --- a/EVPlayer.podspec +++ b/EVPlayer.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = 'EVPlayer' s.version = '0.1.0' - s.summary = 'A short description of EVPlayer.' + s.summary = 'EVPlayer has very easy usage & set up and, offers an interface enhanced with animations.' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? @@ -17,9 +17,7 @@ Pod::Spec.new do |s| # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! - s.description = <<-DESC -TODO: Add long description of the pod here. - DESC + s.description = 'EVPlayer is a customized UIView with AVPlayer inside. With multiple states, it makes video playback extremely easy for the user and the developer.' s.homepage = 'https://github.com/esaygiver/EVPlayer' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' @@ -31,17 +29,14 @@ TODO: Add long description of the pod here. s.ios.deployment_target = '12.0' s.swift_version = "5.0" s.platforms = { - "ios" : "12.0" + "ios": "12.0" } - s.source_files = 'Source/*.{h,m,swift}' + s.source_files = 'Source/**/*.swift' s.resource = 'Example/Pods/Resources/**/*' # s.resource_bundles = { # 'EVPlayer' => ['EVPlayer/Assets/*.png'] # } - # s.public_header_files = 'Pod/Classes/**/*.h' - # s.frameworks = 'UIKit', 'MapKit' - # s.dependency 'AFNetworking', '~> 2.3' end diff --git a/Example/EVPlayer.xcodeproj/project.pbxproj b/Example/EVPlayer.xcodeproj/project.pbxproj index 63a95c1..b330391 100644 --- a/Example/EVPlayer.xcodeproj/project.pbxproj +++ b/Example/EVPlayer.xcodeproj/project.pbxproj @@ -210,7 +210,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0830; + LastUpgradeCheck = 1420; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { @@ -391,14 +391,17 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -444,14 +447,17 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -491,7 +497,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -508,7 +514,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -530,7 +536,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EVPlayer_Example.app/EVPlayer_Example"; }; name = Debug; @@ -549,7 +555,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/EVPlayer_Example.app/EVPlayer_Example"; }; name = Release; diff --git a/Example/EVPlayer.xcodeproj/xcshareddata/xcschemes/EVPlayer-Example.xcscheme b/Example/EVPlayer.xcodeproj/xcshareddata/xcschemes/EVPlayer-Example.xcscheme index 343010e..e79f53e 100644 --- a/Example/EVPlayer.xcodeproj/xcshareddata/xcschemes/EVPlayer-Example.xcscheme +++ b/Example/EVPlayer.xcodeproj/xcshareddata/xcschemes/EVPlayer-Example.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -54,23 +62,11 @@ - - - - - - - - Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/Example/EVPlayer/ViewController.swift b/Example/EVPlayer/ViewController.swift index 70e599c..01434ec 100644 --- a/Example/EVPlayer/ViewController.swift +++ b/Example/EVPlayer/ViewController.swift @@ -36,7 +36,7 @@ class ViewController: UIViewController { evPlayer.delegate = self evPlayer.center = view.center - var config = EVConfiguration(media: media, + let config = EVConfiguration(media: media, initialState: .quickPlay) evPlayer.load(with: config) } @@ -55,7 +55,7 @@ extension ViewController: EVPlayerDelegate { } func evPlayer(timeChangedTo currentTime: Double, totalTime: Double, loadedRange: Double) { - print("loadedRange ->", loadedRange) +// print("loadedRange ->", loadedRange) } func evPlayer(fullScreenTransactionUpdateTo state: EVFullScreenState) { diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index f7d77e1..bfedfee 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -510,7 +510,7 @@ LastUpgradeCheck = 1240; TargetAttributes = { 4BAF0BA169763C8AA77888CF6448F905 = { - LastSwiftMigration = 1420; + LastSwiftMigration = ""; }; }; }; @@ -657,7 +657,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -850,7 +850,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Source/EVPlayer.swift b/Source/EVPlayer.swift index 9c158aa..49c9609 100644 --- a/Source/EVPlayer.swift +++ b/Source/EVPlayer.swift @@ -23,7 +23,6 @@ open class EVPlayer: UIView { let coverView = EVCoverView() let propertiesStackView = EVPlayerPropertiesView() let bufferingView = EVBufferingView() - let emptyView = EVEmptyView() // Tap Gestures lazy var singleTapGR = UITapGestureRecognizer(target: self, action: #selector(handleSingleTap)) @@ -44,7 +43,6 @@ open class EVPlayer: UIView { var configuration: EVConfiguration? - // State lazy var videoState: EVVideoState = .empty { didSet { delegate?.evPlayer(stateDidChangedTo: videoState) @@ -143,7 +141,7 @@ extension EVPlayer: EVCoverViewDelegate { let cachedState = videoState updateState(to: .pause) - let lastTime: CMTime = CMTimeMake(Int64(newTime * 1000 as Float64), 1000) + let lastTime: CMTime = CMTimeMake(value: Int64(newTime * 1000 as Float64), timescale: 1000) seek(to: lastTime, continueFrom: cachedState) showOverlayAnimation(type: .rewind, seek: seconds) @@ -161,7 +159,7 @@ extension EVPlayer: EVCoverViewDelegate { let cachedState = videoState updateState(to: .pause) - let lastTime: CMTime = CMTimeMake(Int64(newTime * 1000 as Float64), 1000) + let lastTime: CMTime = CMTimeMake(value: Int64(newTime * 1000 as Float64), timescale: 1000) seek(to: lastTime, continueFrom: cachedState) showOverlayAnimation(type: .forward, seek: seconds) diff --git a/Source/Interfaces/ObserverImpl.swift b/Source/Interfaces/ObserverImpl.swift index a3f095a..8632642 100644 --- a/Source/Interfaces/ObserverImpl.swift +++ b/Source/Interfaces/ObserverImpl.swift @@ -85,7 +85,7 @@ extension EVObserverProtocol where Self: EVPlayer { } func addWillResignActiveNotification() { - NotificationCenter.default.addObserver(forName: NSNotification.Name.UIApplicationWillResignActive, object: nil, queue: .main) { [weak self] _ in + NotificationCenter.default.addObserver(forName: UIApplication.willResignActiveNotification, object: nil, queue: .main) { [weak self] _ in guard let strongSelf = self else { return } strongSelf.updateState(to: .pause) diff --git a/Source/Interfaces/PlayerImpl.swift b/Source/Interfaces/PlayerImpl.swift index 557bbc8..039e6e5 100644 --- a/Source/Interfaces/PlayerImpl.swift +++ b/Source/Interfaces/PlayerImpl.swift @@ -42,7 +42,7 @@ extension EVPlayerProtocol where Self: EVPlayer { func seek(to time: CMTime?, continueFrom state: EVVideoState? = nil) { if let seekTime = time { - player?.seek(to: seekTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { [weak self] _ in + player?.seek(to: seekTime, toleranceBefore: .zero, toleranceAfter: .zero, completionHandler: { [weak self] _ in guard let strongSelf = self else { return } strongSelf.updateUI(with: seekTime) diff --git a/Source/Interfaces/StateImpl.swift b/Source/Interfaces/StateImpl.swift index 0c8f011..00c3495 100644 --- a/Source/Interfaces/StateImpl.swift +++ b/Source/Interfaces/StateImpl.swift @@ -39,7 +39,7 @@ extension EVStateProtocol where Self: EVPlayer { case .thumbnail: updateState(to: .pause) - bringSubview(toFront: thumbnailView) + bringSubviewToFront(thumbnailView) thumbnailView.isHidden = false propertiesStackView.isHidden = true @@ -47,10 +47,12 @@ extension EVStateProtocol where Self: EVPlayer { coverView.notifyPlayerEnded() case .restart: - seek(to: kCMTimeZero, continueFrom: .play) + seek(to: .zero, continueFrom: .play) case .empty: - emptyView.isHidden = false + let emptyURLView = EVEmptyView() + addSubview(emptyURLView) + emptyURLView.cuiPinToSuperview() } } } diff --git a/Source/Interfaces/UIImpl.swift b/Source/Interfaces/UIImpl.swift index 11398c0..f21132c 100644 --- a/Source/Interfaces/UIImpl.swift +++ b/Source/Interfaces/UIImpl.swift @@ -71,10 +71,7 @@ extension EVUIProtocol where Self: EVPlayer { bufferingView.widthAnchor.cuiSet(to: 40) // emptyView - addSubview(emptyView) - emptyView.cuiPinToSuperview() - emptyView.backgroundColor = .black - emptyView.isHidden = true + // Tap Gesture Recognizers @@ -160,14 +157,14 @@ extension EVUIProtocol where Self: EVPlayer { func showProgress() { DispatchQueue.main.async { self.coverView.changePlayButtonImageForBufferState() - self.bringSubview(toFront: self.bufferingView) + self.bringSubviewToFront(self.bufferingView) self.bufferingView.show() } } func hideProgress() { DispatchQueue.main.async { - self.sendSubview(toBack: self.bufferingView) + self.sendSubviewToBack(self.bufferingView) self.bufferingView.hide { [weak self] in self?.coverView.changePlayButtonImageForLoadedState() } diff --git a/Source/Views/EVBufferingView.swift b/Source/Views/EVBufferingView.swift index a81b314..2c0c8e0 100644 --- a/Source/Views/EVBufferingView.swift +++ b/Source/Views/EVBufferingView.swift @@ -16,9 +16,9 @@ public class EVBufferingView: EVBaseView { prgView.hidesWhenStopped = true prgView.layer.cornerRadius = 12 if #available(iOS 13.0, *) { - prgView.activityIndicatorViewStyle = .medium + prgView.style = .medium } else { - prgView.activityIndicatorViewStyle = .gray + prgView.style = .gray } return prgView }() diff --git a/Source/Views/EVEmptyView.swift b/Source/Views/EVEmptyView.swift index 6d70522..cb8e9ce 100644 --- a/Source/Views/EVEmptyView.swift +++ b/Source/Views/EVEmptyView.swift @@ -20,6 +20,7 @@ final class EVEmptyView: EVBaseView { override func setup() { addSubview(emptyImageView) super.setup() + backgroundColor = .black } override func setConstraints() {