From a98b4eac831b7e0476257e28eb08da049f64277f Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 24 Jan 2022 22:23:10 +0100 Subject: [PATCH] Fix selecting best quality stream (fix #54) --- Model/Player/PlayerQueue.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Model/Player/PlayerQueue.swift b/Model/Player/PlayerQueue.swift index 647cb5a1..314d80d8 100644 --- a/Model/Player/PlayerQueue.swift +++ b/Model/Player/PlayerQueue.swift @@ -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 })