• Fills out placeholders in an ad message.

    Has the placeholders '{remainingTime[formatString]}', '{playedTime[formatString]}', '{adDuration[formatString]}' and {adBreakRemainingTime[formatString]}, which are replaced by the remaining time until the ad can be skipped, the current time or the ad duration. The format string is optional. If not specified, the placeholder is replaced by the time in seconds. If specified, it must be of the following format:

    • %d - Inserts the time as an integer.
    • %0Nd - Inserts the time as an integer with leading zeroes, if the length of the time string is smaller than N.
    • %f - Inserts the time as a float.
    • %0Nf - Inserts the time as a float with leading zeroes.
    • %.Mf - Inserts the time as a float with M decimal places. Can be combined with %0Nf, e.g. %04.2f (the time 10.123 would be printed as 0010.12).
    • %hh:mm:ss
    • %mm:ss

    Examples:

    • { text: 'Ad: {remainingTime%mm:ss} secs' } An input value of 100 would be displayed as: 'Ad: 01:40 secs'
    • { text: 'Ad: {remainingTime%f} secs' } An input value of 100 would be displayed as: 'Ad: 100.0 secs'
    • { text: 'Adbreak: {adBreakRemainingTime%f} secs' } Adbreak with 2 ads each 50 seconds would be displayed as: 'Ad: 100.0 secs'

    Parameters

    • adMessage: string

      an ad message with optional placeholders to fill

    • skipOffset: number

      if specified, {remainingTime} will be filled with the remaining time until the ad can be skipped

    • player: PlayerAPI

      the player to get the time data from

    Returns string

    the ad message with filled placeholders