From fdebe4947d30fc669ef610b754bd3c0f8c15fb2b Mon Sep 17 00:00:00 2001 From: Sven Tiigi Date: Thu, 26 Oct 2023 17:44:24 +0200 Subject: [PATCH] Implemented default case to extract second path component as video identifier https://github.com/SvenTiigi/YouTubePlayerKit/issues/75 --- Sources/Models/YouTubePlayer+Source.swift | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Sources/Models/YouTubePlayer+Source.swift b/Sources/Models/YouTubePlayer+Source.swift index 2d3cbf8..907af96 100644 --- a/Sources/Models/YouTubePlayer+Source.swift +++ b/Sources/Models/YouTubePlayer+Source.swift @@ -90,15 +90,6 @@ public extension YouTubePlayer.Source { startSeconds: startSeconds ) } - case "embed": - // Check if a video identifier is available - if let videoId = url?.pathComponents[safe: 2] { - // Return video source - return .video( - id: videoId, - startSeconds: startSeconds - ) - } case "c", "user": // Check if a channel name is available if let channelName = url?.pathComponents[safe: 2] { @@ -107,7 +98,7 @@ public extension YouTubePlayer.Source { name: channelName ) } - case "v": + default: // Check if a video identifier is available if let videoId = url?.pathComponents[safe: 2] { // Return video source @@ -116,8 +107,6 @@ public extension YouTubePlayer.Source { startSeconds: startSeconds ) } - default: - break } } // Otherwise return nil