logo

MediaTailor

MediaTailor is a service that provides scalable ad insertion and channel assembly. It is able to serve targeted ad content to viewers and create linear streams while maintaining broadcast quality in over-the-top (OTT) video applications. It supports HLS and DASH for both VOD and live workflows.

At the moment of writing only linear ads are supported, but it is possible to expand it to non-linear and companion ads as well.

Web SDK

Configuration

There are three requirements to use a MediaTailor stream with THEOplayer:

  • Have a THEOplayer build with the mediatailor feature flag set.
  • The src is set to the session initialization URL.
  • The integration parameter is set with the value mediatailor.

If everything is set up correctly, THEOplayer will play the stream and send the necessary tracking beacons.

const player = new THEOplayer.Player(element, {
    libraryLocation: 'path/to/theoplayer',
    license: 'your-license-here',
    ...
});

player.source = {
    sources: [
        {
            src: '<mediatailorURL>/v1/session/<hashed-account-id>/<origin-id>/<asset-id>',
            integration: 'mediatailor'
        }
    ]
}

Limitations

The scope of the MediaTailor integration for now is limited to sending the tracking beacons. This encapsulates only the events that can be sent with the default implementation of THEOplayer. For example skipping an ad is not yet supported so the events that correspond to skipping an ad will never occur.

At the moment there is a limitation to HLS where the tracking beacons are sometimes sent with small offsets. We are aware of this issue and will be fixing this in the future. DASH does work as expected.

Seeking is only disabled during an ad, no logic is in place for playing an ad if the user seeked past it.

Android SDK

Unified Android SDK

To use a MediaTailor stream with THEOplayer on Unified Android SDK, first import our MediaTailor module dependency in your build.gradle file.

implementation 'com.theoplayer.theoplayer-sdk-android:unified:+'
implementation 'com.theoplayer.theoplayer-sdk-android:unified-ads-mediatailor:+' // add MediaTailor dependency

Then, add the MediaTailor integration to the Player

MediaTailorIntegration mediaTailor = MediaTailorIntegrationFactory.createMediaTailorIntegration(theoPlayerView);
theoPlayerView.getPlayer().addIntegration(mediaTailor);

Finally, set a MediaTailorSource to play.

MediaTailorSource mediaTailorSource = new MediaTailorSource.Builder()
    .src("<mediatailorURL>/v1/session/<hashed-account-id>/<origin-id>/<asset-id>")
    .build();

SourceDescription sourceDescription = new SourceDescription.Builder()
    .sources(mediaTailorSource)
    .build();

theoPlayerView.getPlayer().setSource(sourceDescription);

Webview based SDK

For the Webview based SDK, make sure to have a THEOplayer build with the mediatailor feature flag set. And then set a MediaTailorSource to play similar to the Unified Android SDK shown above.

iOS SDK

To use a MediaTailor stream with THEOplayer on the iOS SDK, you have to:

  • make sure that your SDK build has the mediatailor flag enabled (similarly to the other SDKs)
  • set a MediaTailorSource to play, as follows
 player.source = SourceDescription(
    source: MediaTailorSource(
        src: "<mediatailorURL>/v1/session/<hashed-account-id>/<origin-id>/<asset-id>",
        type: "application/x-mpegurl"
    )
 )

Note that the MediaTailor URL must have the same structure as described above (Web SDK). Different URL structures may result in playback errors.

github
Make sure to follow us on GitHub!
THEO-logo-white
twitter
facebook
linkedin
Copyright © 2022. All Rights Reserved.
Leuven
New York
Singapore
Barcelona