Files
PlayerKit/Sources/AVPlayer+Utilities.swift
Bryant Balatbat 399d2c7be1 [CRI-1211] Update project structure to more closely resemble other public repos (#85)
* Reorganize project and top level

- Move sources into Sources
- Update podspec to reflect new sources location
- Move Example files into top level

* Update Fastfile

- Point to new project/workspace locations

* Update Fastfile with correct config

* Fix CI build failures

- Update Fastfile to point to correct scheme
- Add Tests file to PlayerKit-iOSTests target
- Update Example scheme to exclude tests
- Update scheme for iOS Framework target to include tests

* Update .gitignore and commit Pods directory

* Remove cocoapods from lane altogether
2019-08-06 10:14:07 -04:00

38 lines
866 B
Swift

//
// AVPlayer+Utilities.swift
// Pods
//
// Created by King, Gavin on 3/7/17.
//
//
import Foundation
import AVFoundation
extension AVPlayer {
var errorForPlayerOrItem: NSError? {
// First try to return the current item's error
if let error = self.currentItem?.error {
// If current item's error has an underlying error, return that
if let underlyingError = (error as NSError).userInfo[NSUnderlyingErrorKey] as? NSError {
return underlyingError
}
else {
return error as NSError?
}
}
// Otherwise, try to return the player error
if let error = self.error {
return error as NSError?
}
// An error cannot be found
return nil
}
}