Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: VeinGuo/VGPlayer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.2.0
Choose a base ref
...
head repository: VeinGuo/VGPlayer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 8 commits
  • 48 files changed
  • 2 contributors

Commits on Sep 21, 2017

  1. update v0.2.0

    VeinGuo committed Sep 21, 2017
    Copy the full SHA
    218e008 View commit details

Commits on Oct 16, 2017

  1. fix time duration

    VeinGuo committed Oct 16, 2017
    Copy the full SHA
    041361c View commit details

Commits on Jan 23, 2018

  1. fix UIButton hitTest error

    VeinGuo committed Jan 23, 2018
    Copy the full SHA
    51c6e38 View commit details

Commits on Sep 25, 2018

  1. Update Timer+VGPlayer.swift

    balitax authored Sep 25, 2018
    Copy the full SHA
    660bf31 View commit details

Commits on Sep 30, 2018

  1. Merge pull request #62 from balitax/master

    Update Timer+VGPlayer.swift
    VeinGuo authored Sep 30, 2018
    Copy the full SHA
    48bbe39 View commit details

Commits on Nov 6, 2018

  1. format code

    VeinGuo committed Nov 6, 2018
    Copy the full SHA
    b964158 View commit details
  2. fix demo crash

    VeinGuo committed Nov 6, 2018
    Copy the full SHA
    61e0337 View commit details
  3. update swift 4.2

    VeinGuo committed Nov 6, 2018
    Copy the full SHA
    511c98c View commit details
Showing with 728 additions and 581 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 .swift-version
  3. +1 −1 Cartfile
  4. +1 −1 Cartfile.resolved
  5. +16 −6 README.md
  6. +3 −3 VGPlayer.podspec
  7. +26 −7 VGPlayer.xcodeproj/project.pbxproj
  8. +8 −0 VGPlayer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  9. BIN VGPlayer.xcodeproj/project.xcworkspace/xcuserdata/gwr.xcuserdatad/UserInterfaceState.xcuserstate
  10. +1 −1 VGPlayer.xcodeproj/xcshareddata/xcschemes/VGPlayer.xcscheme
  11. +2 −2 VGPlayer/Classes/MediaCache/VGPlayerCacheManager.swift
  12. +1 −1 VGPlayer/Classes/MediaCache/VGPlayerCacheMediaWorker.swift
  13. +1 −1 VGPlayer/Classes/Timer+VGPlayer.swift
  14. +1 −1 VGPlayer/Classes/UIButton+VGPlayer.swift
  15. +11 −11 VGPlayer/Classes/VGPlayer.swift
  16. +3 −3 VGPlayer/Classes/VGPlayerLoadingIndicator.swift
  17. +13 −13 VGPlayer/Classes/VGPlayerView.swift
  18. +3 −3 VGPlayer/Classes/VGSubtitles.swift
  19. +11 −7 VGPlayerExample/Podfile.lock
  20. +4 −4 VGPlayerExample/Pods/Local Podspecs/VGPlayer.podspec.json
  21. +11 −7 VGPlayerExample/Pods/Manifest.lock
  22. +359 −349 VGPlayerExample/Pods/Pods.xcodeproj/project.pbxproj
  23. +1 −1 ...yerExample/Pods/Pods.xcodeproj/xcuserdata/gwr.xcuserdatad/xcschemes/Pods-VGPlayerExample.xcscheme
  24. +25 −14 VGPlayerExample/Pods/Pods.xcodeproj/xcuserdata/gwr.xcuserdatad/xcschemes/SnapKit.xcscheme
  25. +25 −14 VGPlayerExample/Pods/Pods.xcodeproj/xcuserdata/gwr.xcuserdatad/xcschemes/VGPlayer.xcscheme
  26. +1 −17 VGPlayerExample/Pods/Pods.xcodeproj/xcuserdata/gwr.xcuserdatad/xcschemes/xcschememanagement.plist
  27. +21 −4 VGPlayerExample/Pods/SnapKit/Source/Constraint.swift
  28. +34 −29 VGPlayerExample/Pods/SnapKit/Source/ConstraintAttributes.swift
  29. +2 −18 VGPlayerExample/Pods/SnapKit/Source/ConstraintMaker.swift
  30. +10 −0 VGPlayerExample/Pods/SnapKit/Source/ConstraintPriorityTarget.swift
  31. +5 −0 VGPlayerExample/Pods/SnapKit/Source/Typealiases.swift
  32. +49 −8 VGPlayerExample/Pods/Target Support Files/Pods-VGPlayerExample/Pods-VGPlayerExample-frameworks.sh
  33. +15 −3 VGPlayerExample/Pods/Target Support Files/Pods-VGPlayerExample/Pods-VGPlayerExample-resources.sh
  34. +4 −4 VGPlayerExample/Pods/Target Support Files/Pods-VGPlayerExample/Pods-VGPlayerExample.debug.xcconfig
  35. +4 −4 VGPlayerExample/Pods/Target Support Files/Pods-VGPlayerExample/Pods-VGPlayerExample.release.xcconfig
  36. +1 −1 VGPlayerExample/Pods/Target Support Files/SnapKit/Info.plist
  37. +3 −4 VGPlayerExample/Pods/Target Support Files/SnapKit/SnapKit.xcconfig
  38. +1 −1 VGPlayerExample/Pods/Target Support Files/VGPlayer/Info.plist
  39. +5 −6 VGPlayerExample/Pods/Target Support Files/VGPlayer/VGPlayer.xcconfig
  40. +19 −19 VGPlayerExample/VGPlayerExample.xcodeproj/project.pbxproj
  41. +1 −1 ...erExample/VGPlayerExample.xcodeproj/xcuserdata/gwr.xcuserdatad/xcschemes/VGPlayerExample.xcscheme
  42. +8 −0 VGPlayerExample/VGPlayerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  43. BIN ...ayerExample/VGPlayerExample.xcworkspace/xcuserdata/gwr.xcuserdatad/UserInterfaceState.xcuserstate
  44. +2 −2 ...ample/VGPlayerExample.xcworkspace/xcuserdata/gwr.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  45. +7 −2 VGPlayerExample/VGPlayerExample/AppDelegate.swift
  46. +5 −0 VGPlayerExample/VGPlayerExample/Assets.xcassets/AppIcon.appiconset/Contents.json
  47. +1 −1 VGPlayerExample/VGPlayerExample/DefaultPlayerView/VGMediaViewController.swift
  48. +1 −5 VGPlayerExample/VGPlayerExample/Embed/VGEmbedTableViewController.swift
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build
Carthage/

# fastlane
#
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "SnapKit/SnapKit" ~> 3.2.0
github "SnapKit/SnapKit" ~> 4.2.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "SnapKit/SnapKit" "3.2.0"
github "SnapKit/SnapKit" "4.2.0"
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
![Swift](https://img.shields.io/badge/Swift-3.0-orange.svg)
[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/VeinGuo/VGPlayer/blob/master/LICENSE)
[![Platform](https://img.shields.io/cocoapods/p/Pastel.svg?style=flat)](https://github.com/VeinGuo/VGPlayer)
[![Cocoapod](https://img.shields.io/badge/pod-v0.1.5-blue.svg)](http://cocoadocs.org/docsets/VGPlayer/0.1.5/)
[![Cocoapod](https://img.shields.io/badge/pod-v0.2.0-blue.svg)](http://cocoadocs.org/docsets/VGPlayer/0.2.0/)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

![Banners](https://github.com/VeinGuo/VGPlayer/blob/master/Image/Banners.png)
@@ -54,7 +54,9 @@ Swift developed based on AVPlayer iOS player,support horizontal gestures Fast fo
- 2017-9-6 v0.1.5
- fix url param praser
- fix pause play error

- 2017-9-21 v0.2.0
- clean code
- convert to swift4

## Usage
### Play Video
@@ -196,14 +198,22 @@ self.player.backgroundMode = .proceed
## Installation
- Download VGPlayer. Move to your project.

- Cocoapods
### Cocoapods


**Swift 4**
```
platform :ios, '8.0'
use_frameworks!
pod 'VGPlayer'
pod 'VGPlayer', '~> 0.2.0'
```

**Swift 3**
```
- Carthage
use_frameworks!
pod 'VGPlayer', '~> 0.1.5'
```

### Carthage

```
github "VeinGuo/VGPlayer"
6 changes: 3 additions & 3 deletions VGPlayer.podspec
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

Pod::Spec.new do |s|
s.name = "VGPlayer"
s.version = "0.1.5"
s.version = "0.2.0"
s.summary = "A simple iOS video player in Swift"
s.description = "A simple iOS video player in Swift by Vein."

@@ -15,13 +15,13 @@ Pod::Spec.new do |s|

s.ios.deployment_target = "8.0"
s.platform = :ios, "8.0"
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }

s.source = { :git => "https://github.com/VeinGuo/VGPlayer.git", :tag => s.version }
s.source_files = 'VGPlayer/Classes/*.*', 'VGPlayer/Classes/**/*.*'
s.resources = 'VGPlayer/*.xcassets'
s.requires_arc = true
s.dependency 'SnapKit', '~> 4.0.0'
s.dependency 'SnapKit', '~> 4.2.0'
s.frameworks = 'UIKit', 'AVFoundation', 'Foundation'

end
33 changes: 26 additions & 7 deletions VGPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
336DDBC71EE5075A004BDE6F /* VGPlayerLoadingIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336DDBC61EE5075A004BDE6F /* VGPlayerLoadingIndicator.swift */; };
33A448371F09F15C002103B4 /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33A448361F09F15C002103B4 /* SnapKit.framework */; };
33B36A9C1EE5327500F9BC2B /* VGPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33B36A9B1EE5327500F9BC2B /* VGPlayerView.swift */; };
33D264DA1EEE74A800A42DDA /* Timer+VGPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D264D91EEE74A800A42DDA /* Timer+VGPlayer.swift */; };
8001CB2F1EDD7D4E00C6C9D2 /* VGPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8001CB2E1EDD7D4E00C6C9D2 /* VGPlayer.swift */; };
@@ -29,6 +28,7 @@
807A46EF1EDC706100A99141 /* VGPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 807A46E51EDC706100A99141 /* VGPlayer.framework */; };
807A46F41EDC706100A99141 /* VGPlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 807A46F31EDC706100A99141 /* VGPlayerTests.swift */; };
807A46F61EDC706100A99141 /* VGPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 807A46E81EDC706100A99141 /* VGPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
80AF1E3C2191EC1F00A73925 /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33A448361F09F15C002103B4 /* SnapKit.framework */; };
80B21B411EF5489C009E00EA /* VGSubtitles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80B21B401EF5489C009E00EA /* VGSubtitles.swift */; };
80D923A21EE4368600564FFD /* VGPlayerError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80D923A01EE4368600564FFD /* VGPlayerError.swift */; };
80D923A31EE4368600564FFD /* VGPlayerSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80D923A11EE4368600564FFD /* VGPlayerSlider.swift */; };
@@ -84,7 +84,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
33A448371F09F15C002103B4 /* SnapKit.framework in Frameworks */,
80AF1E3C2191EC1F00A73925 /* SnapKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -240,7 +240,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = Vein;
TargetAttributes = {
807A46E41EDC706100A99141 = {
@@ -250,6 +250,7 @@
};
807A46ED1EDC706100A99141 = {
CreatedOnToolsVersion = 8.3;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
};
@@ -349,15 +350,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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_DOCUMENTATION_COMMENTS = YES;
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_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -403,15 +412,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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_DOCUMENTATION_COMMENTS = YES;
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_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -461,7 +478,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
@@ -486,7 +503,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.Vein.VGPlayer;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
@@ -499,7 +516,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Vein.VGPlayerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -511,7 +529,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Vein.VGPlayerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
4 changes: 2 additions & 2 deletions VGPlayer/Classes/MediaCache/VGPlayerCacheManager.swift
Original file line number Diff line number Diff line change
@@ -21,12 +21,12 @@ open class VGPlayerCacheManager: NSObject {
static public let VGPlayerCacheErrorKey: String = "VGPlayerCacheErrorKey"
static public let VGPlayerCleanCacheKey: String = "VGPlayerCleanCacheKey"

open static var mediaCacheNotifyInterval = 0.1
public static var mediaCacheNotifyInterval = 0.1

fileprivate let ioQueue = DispatchQueue(label: "com.vgplayer.ioQueue")
fileprivate var fileManager: FileManager!

open static let shared = VGPlayerCacheManager()
public static let shared = VGPlayerCacheManager()
open private(set) var cacheConfig = VGPlayerCacheConfiguration()

public override init() {
2 changes: 1 addition & 1 deletion VGPlayer/Classes/MediaCache/VGPlayerCacheMediaWorker.swift
Original file line number Diff line number Diff line change
@@ -185,7 +185,7 @@ open class VGPlayerCacheMediaWorker: NSObject {

open func startWritting() {
if !isWritting {
NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground(_:)), name: .UIApplicationDidEnterBackground, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground(_:)), name:UIApplication.didEnterBackgroundNotification , object: nil)
}
isWritting = true
starWriteDate = NSDate()
2 changes: 1 addition & 1 deletion VGPlayer/Classes/Timer+VGPlayer.swift
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import Foundation

extension Timer {
class func vgPlayer_scheduledTimerWithTimeInterval(_ timeInterval: TimeInterval, block: ()->(), repeats: Bool) -> Timer {
class func vgPlayer_scheduledTimerWithTimeInterval(_ timeInterval: TimeInterval, block: @escaping ()->(), repeats: Bool) -> Timer {
return self.scheduledTimer(timeInterval: timeInterval, target:
self, selector: #selector(self.vgPlayer_blcokInvoke(_:)), userInfo: block, repeats: repeats)
}
2 changes: 1 addition & 1 deletion VGPlayer/Classes/UIButton+VGPlayer.swift
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ extension UIButton {
let largerFrame = self.bounds.insetBy(dx: -widthToAdd / 2, dy: -heightToAdd / 2)

// perform hit test on larger frame
return (largerFrame.contains(point)) ? self : nil
return (largerFrame.contains(point)) ? super.hitTest(point, with: event) : nil
}

}
22 changes: 11 additions & 11 deletions VGPlayer/Classes/VGPlayer.swift
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ open class VGPlayer: NSObject {
internal func addPlayerObservers() {
timeObserver = player?.addPeriodicTimeObserver(forInterval: .init(value: 1, timescale: 1), queue: DispatchQueue.main, using: { [weak self] time in
guard let strongSelf = self else { return }
if let currentTime = strongSelf.player?.currentTime().seconds, let totalDuration = strongSelf.player?.currentItem?.duration.seconds{
if let currentTime = strongSelf.player?.currentTime().seconds, let totalDuration = strongSelf.player?.currentItem?.duration.seconds {
strongSelf.currentDuration = currentTime
strongSelf.delegate?.vgPlayer(strongSelf, playerDurationDidChange: currentTime, totalDuration: totalDuration)
strongSelf.displayView.playerDurationDidChange(currentTime, totalDuration: totalDuration)
@@ -275,7 +275,7 @@ extension VGPlayer {
guard let strongSelf = self else { return }
strongSelf.seeking = true
strongSelf.startPlayerBuffering()
strongSelf.playerItem?.seek(to: CMTimeMakeWithSeconds(time, Int32(NSEC_PER_SEC)), completionHandler: { (finished) in
strongSelf.playerItem?.seek(to: CMTimeMakeWithSeconds(time, preferredTimescale: Int32(NSEC_PER_SEC)), completionHandler: { (finished) in
DispatchQueue.main.async {
strongSelf.seeking = false
strongSelf.stopPlayerBuffering()
@@ -327,8 +327,8 @@ extension VGPlayer {

internal func addPlayerNotifications() {
NotificationCenter.default.addObserver(self, selector: .playerItemDidPlayToEndTime, name: .AVPlayerItemDidPlayToEndTime, object: nil)
NotificationCenter.default.addObserver(self, selector: .applicationWillEnterForeground, name: .UIApplicationWillEnterForeground, object: nil)
NotificationCenter.default.addObserver(self, selector: .applicationDidEnterBackground, name: .UIApplicationDidEnterBackground, object: nil)
NotificationCenter.default.addObserver(self, selector: .applicationWillEnterForeground, name: UIApplication.willEnterForegroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: .applicationDidEnterBackground, name: UIApplication.didEnterBackgroundNotification, object: nil)
}

internal func removePlayerItemObservers() {
@@ -339,8 +339,8 @@ extension VGPlayer {

internal func removePlayerNotifations() {
NotificationCenter.default.removeObserver(self, name: .AVPlayerItemDidPlayToEndTime, object: nil)
NotificationCenter.default.removeObserver(self, name: .UIApplicationWillEnterForeground, object: nil)
NotificationCenter.default.removeObserver(self, name: .UIApplicationDidEnterBackground, object: nil)
NotificationCenter.default.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIApplication.didEnterBackgroundNotification, object: nil)
}


@@ -390,19 +390,19 @@ extension VGPlayer {
if (context == &playerItemContext) {

if keyPath == #keyPath(AVPlayerItem.status) {
let status: AVPlayerItemStatus
let status: AVPlayerItem.Status
if let statusNumber = change?[.newKey] as? NSNumber {
status = AVPlayerItemStatus(rawValue: statusNumber.intValue)!
status = AVPlayerItem.Status(rawValue: statusNumber.intValue)!
} else {
status = .unknown
}

switch status {
case AVPlayerItemStatus.unknown:
case .unknown:
startPlayerBuffering()
case AVPlayerItemStatus.readyToPlay:
case .readyToPlay:
bufferState = .readyToPlay
case AVPlayerItemStatus.failed:
case .failed:
state = .error
collectPlayerErrorLogEvent()
stopPlayerBuffering()
6 changes: 3 additions & 3 deletions VGPlayer/Classes/VGPlayerLoadingIndicator.swift
Original file line number Diff line number Diff line change
@@ -37,16 +37,16 @@ open class VGPlayerLoadingIndicator: UIView {
}

internal func commonInit(){
timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
setupIndicatorLayer()
}

internal func setupIndicatorLayer() {
indicatorLayer.strokeColor = UIColor.white.cgColor
indicatorLayer.fillColor = nil
indicatorLayer.lineWidth = 2.0
indicatorLayer.lineJoin = kCALineJoinRound;
indicatorLayer.lineCap = kCALineCapRound;
indicatorLayer.lineJoin = CAShapeLayerLineJoin.round;
indicatorLayer.lineCap = CAShapeLayerLineCap.round;
layer.addSublayer(indicatorLayer)
updateIndicatorLayerPath()
}
Loading