How do I style subtitles on iOS AirPlay?

I’m playing a stream with subtitles on my iOS app using Bitmovin Player. When I cast the video to an Apple TV using AirPlay, I would like to apply different font size and color to the subtitles. How do I accomplish this?


Since you’re using using the Bitmovin Player UI for local play, you have to set it via the API on the BitmovinPlayerView after a source was loaded (onReady on v3).

Sample code snippet here:

func onReady(_ event: ReadyEvent, player: Player) {
        AVTextStyleRule(textMarkupAttributes: [
             kCMTextMarkupAttribute_CharacterEdgeStyle as String: kCMTextMarkupCharacterEdgeStyle_DropShadow,
             kCMTextMarkupAttribute_BackgroundColorARGB as String: [1.0, 0.0, 0.0, 1.0],
             kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight as String: 5.5,

Additionally worth noting that SUBTITLES are styled correctly whilst CLOSED-CAPTIONS aren’t. According to the Apple Doc the styling property works only for SUBTITLES too.

This property has an effect only for tracks with media subtype kCMSubtitleFormatType_WebVTT.

1 Like