Skip to content

Commit fdebe49

Browse files
committed
Implemented default case to extract second path component as video identifier
#75
1 parent 1fe4c8b commit fdebe49

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

Sources/Models/YouTubePlayer+Source.swift

+1-12
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ public extension YouTubePlayer.Source {
9090
startSeconds: startSeconds
9191
)
9292
}
93-
case "embed":
94-
// Check if a video identifier is available
95-
if let videoId = url?.pathComponents[safe: 2] {
96-
// Return video source
97-
return .video(
98-
id: videoId,
99-
startSeconds: startSeconds
100-
)
101-
}
10293
case "c", "user":
10394
// Check if a channel name is available
10495
if let channelName = url?.pathComponents[safe: 2] {
@@ -107,7 +98,7 @@ public extension YouTubePlayer.Source {
10798
name: channelName
10899
)
109100
}
110-
case "v":
101+
default:
111102
// Check if a video identifier is available
112103
if let videoId = url?.pathComponents[safe: 2] {
113104
// Return video source
@@ -116,8 +107,6 @@ public extension YouTubePlayer.Source {
116107
startSeconds: startSeconds
117108
)
118109
}
119-
default:
120-
break
121110
}
122111
}
123112
// Otherwise return nil

0 commit comments

Comments
 (0)