Amazon Vinyl
    Preparing search index...

    Function createLanguageFilter

    Creates a language filter predicate for use with filterTimelineQualities.

    • Creates a filter predicate that keeps the qualities best matching the preferred language(s). The preference is an ordered list (see resolvePreferredLanguages): earlier entries win, and relatedness (exact > parent > sibling > child) breaks ties within a single preference.

      The best match is computed per period (per unique array reference), so periods with different available languages are handled independently. When no available language relates to any preference, all are kept (playback is never stranded). Qualities not matching the content type, or without a language tag, are always kept.

      Parameters

      • preferredLanguage: string | readonly string[] | null

        BCP 47 tag, ordered list of tags, or null (which falls back to navigator.languages).

      • contentType: string

        Only filter qualities matching this content type (e.g. 'audio').

      Returns FilterPredicate<MediaQualityMetadata> | null