mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Improve streams quality settings
This commit is contained in:
@@ -60,7 +60,7 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
addPlayerTimeControlStatusObserver()
|
||||
}
|
||||
|
||||
func bestPlayable(_ streams: [Stream]) -> Stream? {
|
||||
func bestPlayable(_ streams: [Stream], maxResolution _: ResolutionSetting) -> Stream? {
|
||||
streams.first { $0.kind == .hls } ??
|
||||
streams.filter { $0.kind == .adaptive }.max { $0.resolution < $1.resolution } ??
|
||||
streams.first
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ protocol PlayerBackend {
|
||||
var isPlaying: Bool { get }
|
||||
var playerItemDuration: CMTime? { get }
|
||||
|
||||
func bestPlayable(_ streams: [Stream]) -> Stream?
|
||||
func bestPlayable(_ streams: [Stream], maxResolution: ResolutionSetting) -> Stream?
|
||||
func canPlay(_ stream: Stream) -> Bool
|
||||
|
||||
func playStream(
|
||||
|
Reference in New Issue
Block a user