diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/VideoPageFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/VideoPageFragment.kt index c95009483..c28270a6a 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/VideoPageFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/VideoPageFragment.kt @@ -343,9 +343,9 @@ class VideoPageFragment : CacheDownloadMediaViewerFragment(), IBaseFragment(media.media_url, null) } - val firstMatch = media.video_info.variants.first { variant -> + val firstMatch = media.video_info.variants.filter { variant -> supportedTypes.any { it.equals(variant.content_type, ignoreCase = true) } - } ?: return null + }.sortedByDescending(ParcelableMedia.VideoInfo.Variant::bitrate).firstOrNull() ?: return null return Pair.create(firstMatch.url, firstMatch.content_type) } ParcelableMedia.Type.CARD_ANIMATED_GIF -> {