Improve HLS video thumbnail generation

This commit is contained in:
Isaac 2025-03-30 02:05:09 +04:00
parent 2739a839ed
commit cebe18e6d6
3 changed files with 250 additions and 5 deletions

View file

@ -76,6 +76,31 @@ public final class CachedVideoFirstFrameRepresentation: CachedMediaResourceRepre
}
}
public final class CachedVideoPrefixFirstFrameRepresentation: CachedMediaResourceRepresentation {
public let keepDuration: CachedMediaRepresentationKeepDuration = .general
public var uniqueId: String {
return "prefix-first-frame"
}
public let prefixLength: Int32
public init(prefixLength: Int32) {
self.prefixLength = prefixLength
}
public func isEqual(to: CachedMediaResourceRepresentation) -> Bool {
if let to = to as? CachedVideoPrefixFirstFrameRepresentation {
if self.prefixLength != to.prefixLength {
return false
}
return true
} else {
return false
}
}
}
public final class CachedScaledVideoFirstFrameRepresentation: CachedMediaResourceRepresentation {
public let keepDuration: CachedMediaRepresentationKeepDuration = .general