mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Channels search, add SDWebImage framework
This commit is contained in:
@@ -148,29 +148,4 @@ class Stream: Equatable, Hashable, Identifiable {
|
||||
hasher.combine(audioAsset?.url)
|
||||
hasher.combine(hlsURL)
|
||||
}
|
||||
|
||||
func withAssetsFrom(_ instance: Instance) -> Stream {
|
||||
if kind == .hls {
|
||||
return Stream(instance: instance, hlsURL: hlsURL)
|
||||
} else {
|
||||
return Stream(
|
||||
instance: instance,
|
||||
audioAsset: AVURLAsset(url: assetURLFrom(instance: instance, url: (audioAsset ?? videoAsset).url)!),
|
||||
videoAsset: AVURLAsset(url: assetURLFrom(instance: instance, url: videoAsset.url)!),
|
||||
resolution: resolution,
|
||||
kind: kind,
|
||||
encoding: encoding
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private func assetURLFrom(instance: Instance, url: URL) -> URL? {
|
||||
guard let instanceURLComponents = URLComponents(string: instance.url),
|
||||
var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return nil }
|
||||
|
||||
urlComponents.scheme = instanceURLComponents.scheme
|
||||
urlComponents.host = instanceURLComponents.host
|
||||
|
||||
return urlComponents.url
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user