399d2c7be1
* 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
38 lines
866 B
Swift
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
|
|
}
|
|
}
|