Skip to content

Commit

Permalink
version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
esaygiver committed Mar 19, 2023
1 parent 604d4b3 commit bbe3c20
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 53 deletions.
13 changes: 4 additions & 9 deletions EVPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
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?
# * Try to keep it short, snappy and to the point.
# * 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'
Expand All @@ -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
16 changes: 11 additions & 5 deletions Example/EVPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1420;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,8 +40,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "EVPlayer_Example.app"
BlueprintName = "EVPlayer_Example"
ReferencedContainer = "container:EVPlayer.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -54,23 +62,11 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "EVPlayer_Example.app"
BlueprintName = "EVPlayer_Example"
ReferencedContainer = "container:EVPlayer.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -87,8 +83,6 @@
ReferencedContainer = "container:EVPlayer.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion Example/EVPlayer/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
4 changes: 2 additions & 2 deletions Example/EVPlayer/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions Source/EVPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -44,7 +43,6 @@ open class EVPlayer: UIView {

var configuration: EVConfiguration?

// State
lazy var videoState: EVVideoState = .empty {
didSet {
delegate?.evPlayer(stateDidChangedTo: videoState)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Interfaces/ObserverImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Interfaces/PlayerImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions Source/Interfaces/StateImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ extension EVStateProtocol where Self: EVPlayer {

case .thumbnail:
updateState(to: .pause)
bringSubview(toFront: thumbnailView)
bringSubviewToFront(thumbnailView)
thumbnailView.isHidden = false
propertiesStackView.isHidden = true

case .ended:
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()
}
}
}
9 changes: 3 additions & 6 deletions Source/Interfaces/UIImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Views/EVBufferingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()
Expand Down
1 change: 1 addition & 0 deletions Source/Views/EVEmptyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final class EVEmptyView: EVBaseView {
override func setup() {
addSubview(emptyImageView)
super.setup()
backgroundColor = .black
}

override func setConstraints() {
Expand Down

0 comments on commit bbe3c20

Please sign in to comment.