Skip to content

Commit

Permalink
Use correct path components index
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenTiigi committed Apr 21, 2022
1 parent 2839207 commit d861131
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Models/YouTubePlayer+Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public extension YouTubePlayer.Source {
}
case "embed":
// Check if a video identifier is available
if let videoId = url?.pathComponents[safe: 1] {
if let videoId = url?.pathComponents[safe: 2] {
// Return video source
return .video(
id: videoId,
Expand All @@ -101,7 +101,7 @@ public extension YouTubePlayer.Source {
}
case "c", "user":
// Check if a channel name is available
if let channelName = url?.pathComponents[safe: 1] {
if let channelName = url?.pathComponents[safe: 2] {
// Return channel source
return .channel(
name: channelName
Expand Down

0 comments on commit d861131

Please sign in to comment.