File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,11 @@ object StreamVideoThumbnailGenerator {
112112
113113 when {
114114 scheme.isNullOrEmpty() -> retriever.setDataSource(url)
115- scheme == " http" || scheme == " https" -> retriever.setDataSource(url, emptyMap())
116- else -> retriever.setDataSource(context, uri)
115+ scheme == " content" || scheme == " file" -> retriever.setDataSource(context, uri)
116+ else ->
117+ throw IllegalArgumentException (
118+ " Unsupported video URI scheme for thumbnail generation: $scheme . Local assets only." ,
119+ )
117120 }
118121 }
119122
Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ public final class StreamVideoThumbnailGenerator: NSObject {
165165 return resolvePhotoLibraryAsset ( url: url)
166166 }
167167
168- if let normalizedURL = normalizeURL ( url) {
168+ if let normalizedURL = normalizeLocalURL ( url) {
169169 return AVURLAsset ( url: normalizedURL)
170170 }
171171
@@ -220,9 +220,13 @@ public final class StreamVideoThumbnailGenerator: NSObject {
220220 . trimmingCharacters ( in: CharacterSet ( charactersIn: " / " ) ) ?? " "
221221 }
222222
223- private static func normalizeURL( _ url: String ) -> URL ? {
224- if let parsedURL = URL ( string: url) , parsedURL. scheme != nil {
225- return parsedURL
223+ private static func normalizeLocalURL( _ url: String ) -> URL ? {
224+ if let parsedURL = URL ( string: url) , let scheme = parsedURL. scheme? . lowercased ( ) {
225+ if scheme == " file " {
226+ return parsedURL
227+ }
228+
229+ return nil
226230 }
227231
228232 return URL ( fileURLWithPath: url)
You can’t perform that action at this time.
0 commit comments