MACaptionAppearanceAddSelectedLanguage

Function MACaptionAppearanceAddSelectedLanguage 

Source
pub unsafe extern "C-unwind" fn MACaptionAppearanceAddSelectedLanguage(
    domain: MACaptionAppearanceDomain,
    language: &CFString,
) -> bool
Available on crate feature MACaptionAppearance only.
Expand description

Adds a user’s selected caption language to stack of languages.

Parameter domain: Preference domain, see

 MACaptionAppearanceDomain

Parameter language: Canonical language identifier (see

 CFLocale

) of the user’s preferred caption language.

Returns: true if addition was successful. Unsuccessful additions are most liketly the result of invalid language codes.

After a language is added it will appear first in the array returned by MACaptionAppearanceCopySelectedLanguages. Applications should call this anytime a user selects a specific languages for captioning tracks.

For example, an AVFoundation clients may execute the following code in response to a user selecting a captioning track: // in response to a user selection (from a pop-up menu or any other UI affordance), make the selection effective -[AVPlayerItem selectMediaOption:legibleOption inMediaSelectionGroup:legibleGroup];

// now update system-wide captioning preferences by registering the language of the option selected by the user MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, (CFStringRef)[[legibleOption locale] localeIdentifier]);