Improve streams quality settings

This commit is contained in:
Arkadiusz Fal
2022-03-27 20:59:22 +02:00
parent 83db550c18
commit 61054862d2
6 changed files with 34 additions and 14 deletions

View File

@@ -52,8 +52,10 @@ final class MPVBackend: PlayerBackend {
clientTimer.eventHandler = getClientUpdates
}
func bestPlayable(_ streams: [Stream]) -> Stream? {
streams.filter { $0.kind == .adaptive }.max { $0.resolution < $1.resolution } ??
func bestPlayable(_ streams: [Stream], maxResolution: ResolutionSetting) -> Stream? {
streams
.filter { $0.kind == .adaptive && $0.resolution <= maxResolution.value }
.max { $0.resolution < $1.resolution } ??
streams.first { $0.kind == .hls } ??
streams.first
}