1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30

Fix selecting best quality stream (fix #54)

This commit is contained in:
Arkadiusz Fal 2022-01-24 22:23:10 +01:00
parent 975b8fe5c3
commit a98b4eac83

View File

@ -95,7 +95,9 @@ extension PlayerModel {
switch quality {
case .best:
return streams.first { $0.kind == .hls } ?? streams.first
return streams.first { $0.kind == .hls } ??
streams.filter { $0.kind == .stream }.max { $0.resolution < $1.resolution } ??
streams.first
default:
let sorted = streams.filter { $0.kind != .hls }.sorted { $0.resolution > $1.resolution }
return sorted.first(where: { $0.resolution.height <= quality.value.height })