@@ -322,67 +322,6 @@ class AndroidMediaController(
322322
323323
324324 // ===== Track Selection =====
325-
326- @OptIn(UnstableApi ::class )
327- override fun getAvailableResolutions (): List <ResolutionInfo > {
328- val tracks = mediaController.currentTracks
329- val resolutions = mutableListOf<ResolutionInfo >()
330-
331- for (trackGroup in tracks.groups) {
332- if (trackGroup.type == C .TRACK_TYPE_VIDEO ) {
333- trackGroup.forEachIndexed { trackIndex, format ->
334- if (! isCodecAllowed(format.codecs)) {
335- return @forEachIndexed
336- }
337- val isSelected = trackGroup.isTrackSelected(trackIndex)
338- val isHDR = isHDRFromCodec(format.codecs)
339-
340- resolutions.add(
341- ResolutionInfo (
342- height = format.height,
343- width = format.width,
344- codec = format.codecs,
345- frameRate = format.frameRate,
346- isSelected = isSelected,
347- isHDR = isHDR
348- )
349- )
350- }
351- }
352- }
353-
354- // Sort by codec priority descending, then by height descending
355- return resolutions.sortedWith(
356- compareByDescending<ResolutionInfo > { it.codecPriority }
357- .thenByDescending { it.height }
358- )
359- }
360-
361- @OptIn(UnstableApi ::class )
362- override fun getAvailableSubtitles (): List <SubtitleInfo > {
363- val tracks = mediaController.currentTracks
364- val subtitles = mutableListOf<SubtitleInfo >()
365-
366- for (trackGroup in tracks.groups) {
367- if (trackGroup.type == TRACK_TYPE_TEXT ) {
368- trackGroup.forEachIndexed { trackIndex, format ->
369- val isSelected = trackGroup.isTrackSelected(trackIndex)
370- val isAutoGenerated = format.label?.contains(" auto-generated" , ignoreCase = true ) == true
371-
372- subtitles.add(
373- SubtitleInfo (
374- language = format.language ? : " Unknown" ,
375- isSelected = isSelected,
376- isAutoGenerated = isAutoGenerated
377- )
378- )
379- }
380- }
381- }
382-
383- return subtitles
384- }
385-
386325 @OptIn(UnstableApi ::class )
387326 override fun selectResolution (resolution : ResolutionInfo ) {
388327 val tracks = mediaController.currentTracks
0 commit comments