Dynamic loading of subtitle

Hi Bitmovin,

With the web player, is there a way of dynamically loading a new subtitle or thumbnail track after the source has been loaded (ie. not provided as part of the source configuration)?
This is for a slightly unusual use case where those tracks would be generated by code, depending on metadata only available in the player after the source as loaded.

Hello Fabre!

thanks for your question. Side loaded Thumbnail tracks are only configurable in the source configuration, so they need to be provided before the source is loaded. Thumbnail information can be retrieved after loaded/ready events.
Do you use Bitmovin UI?
Bitmovin UI makes usage of the Player’s getThumbnail API to obtain thumbnail information.
Customisation on the UI side might be an approach to accomplish your use case, but you would need to handle the logic for getting the thumbnail information.
For reference: bitmovin-player-ui/src/ts/components/seekbarlabel.ts at develop · bitmovin/bitmovin-player-ui · GitHub

  • getThumbnail() used for getting Thumbnail information from player.
  • ImageLoader class used to download thumbnail images/sprites.

As per the subtitles, yes they can be added dynamically after the source load. Th following code will be needed:

player.subtitles.add({
            url: 'https://bitmovin-a.akamaihd.net/content/sintel/hls/subtitles_en.vtt',
            id: 'english_sintel',
            kind: 'subtitle',
            label: 'En',
            lang: 'english',
            enabled: true
        });

Thanks Thomas,

For the subtitle case, can I assume that the player will automatically synchronize the subtitle track (ie. Seek into it) after it’s loaded, to keep it in sync with video/audio timeline?

Yes correct @fabre.lambeau, the player will handle the synchronization :+1: