Skip to content

Commit

Permalink
Merge pull request #23 from krzd/patch-2
Browse files Browse the repository at this point in the history
Fix #22
  • Loading branch information
gilesvangruisen committed Jul 16, 2015
2 parents 8782c7f + 13791e6 commit 4a84bfe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions YouTubePlayer/YouTubePlayer/YouTubePlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ private extension NSURL {
}

public func videoIDFromYouTubeURL(videoURL: NSURL) -> String? {
if let host = videoURL.host, pathComponents = videoURL.pathComponents where pathComponents.count > 1 && host.hasSuffix("youtu.be") {
return pathComponents[1] as? String
}
return videoURL.queryStringComponents()["v"] as? String
}

Expand Down

0 comments on commit 4a84bfe

Please sign in to comment.