Prefer fast-loading formats when switching to AVPlayer

When switching from MPV to AVPlayer, prioritize HLS and stream formats over non-streamable MP4/AVC1 formats to avoid long loading times.

Changes:
- Added isFastLoadingFormat() helper to AVPlayerBackend
- Modified streamByQualityProfile to prefer fast-loading formats for AVPlayer
- Falls back to non-streamable formats only if no fast-loading option exists
- Ensures quick backend switching without waiting for metadata download
This commit is contained in:
Arkadiusz Fal
2025-11-23 14:20:28 +01:00
parent 9177abb0ec
commit c5137a8af8
2 changed files with 26 additions and 0 deletions

View File

@@ -178,6 +178,12 @@ final class AVPlayerBackend: PlayerBackend {
return stream.kind == .hls || stream.kind == .stream
}
func isFastLoadingFormat(_ stream: Stream) -> Bool {
// HLS and stream formats load quickly
// Non-streamable MP4/AVC1 formats may take a long time
return stream.kind == .hls || stream.kind == .stream
}
func playStream(
_ stream: Stream,
of video: Video,