MACaptionAppearanceAddSelectedLanguage(_:_:)
Adds a preference for caption language to the stack of languages.
Declaration
func MACaptionAppearanceAddSelectedLanguage(_ domain: MACaptionAppearanceDomain, _ language: CFString) -> BoolParameters
- domain:
The domain to retrieve the preference value from. See Macaptionappearancedomain. Pass User unless the system defaults are needed for comparison.
- language:
A canonical language identifier (see Cflocale) of the preferred caption language.
Return Value
Returns true if addition was successful; false if an error occurred. Errors are most likely the result of invalid language codes.
Discussion
The added language will appear in the array returned by MACaptionAppearanceCopySelectedLanguages(_:). Call the MACaptionAppearanceAddSelectedLanguage function anytime a user selects a specific captioning language from a pop-up menu or other UI affordance. For example, an AVFoundation client may execute the following code:
// in response to a user selection, make the selection effective
-[AVPlayerItem selectMediaOption:legibleOption inMediaSelectionGroup:legibleGroup];
// now update system-wide captioning preferences by registering the added language
MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, (CFStringRef)[[legibleOption locale] localeIdentifier]);