How to get the information stored in the hls playlist CHARACTERISTICS field from avplayer

I'm trying to guess if some subtitles have accessibility options to show this information at the user interface level I'm working on.

I am using Apple dual stream thread stream:

https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8 

There are several subtitles in this playlist, some of which have accessibility characteristics, for example:

 EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound",URI="subtitles/eng/prog_index.m3u8" 

You can see that it has the following characteristics:

 CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound" 

From the point of view of the application, I extract all the subtitles using this piece of code:

 AVMediaSelectionGroup * subtitleSelectionGroup = [asset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicLegible]; for (AVMediaSelectionOption * subtitleOption in subtitleSelectionGroup.options) { NSLog(@"%@", subtitleOption); } 

This is the result of the output of AVMediaSelectionOption, created from the subtitle that we talked about:

 <AVMediaSelectionKeyValueOption: 0x14785320, locale = en, mediaType = 'sbtl', tagged media characteristics = {public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound}, title = English, default = YES> 

As you can see, AVPlayer tells me that the information in the field

tagged media characteristics = {Public.accessibility.transcribes-spoken dialogue, public.accessibility.describes-music and sound}

since i can see it on the output of NSLog

The question is, how can I request them from the code? Is there any specific field in the AVMediaSelectionOption class? can't find one

Thanks!

+5
source share

Source: https://habr.com/ru/post/1207203/


All Articles