All Products
Search
Document Center

Intelligent Media Services:Get started with ad insertion

Last Updated:Feb 24, 2025

This topic walks you through getting started with MediaWeaver ad insertion.

Procedure

To use MediaWeaver ad insertion, perform the following steps: 

  1. Activate Intelligent Media Services (IMS).

  2. Prepare live or video-on-demand (VOD) sources.

  3. Prepare an ad decision server (ADS) template URL.

  4. Create an ad insertion configuration.

  5. Send the playback request to MediaWeaver.

Preparations

  • Prepare live or VOD sources.

    The source stream must have both master and media playlists. The media playlist must contain ad markers.

    Sample master playlist:

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=100000,CODECS="mp4a.40.2,avc1.64001e",RESOLUTION=640x302
    video/player-ld.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=200000,CODECS="mp4a.40.2,avc1.64001f",RESOLUTION=848x402
    video/player-sd.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=300000,CODECS="mp4a.40.2,avc1.640020",RESOLUTION=1280x606
    video/player-hd.m3u8
    

    Sample media playlist with ad markers:

    #EXTM3U
    #EXT-X-VERSION:6
    #EXT-X-PLAYLIST-TYPE:EVENT
    #EXT-X-TARGETDURATION:14
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-DISCONTINUITY
    #EXT-X-CUE-OUT:60.00
    ...
    #EXT-X-CUE-IN
    #EXTINF:16.666,
    1723518884_121.ts
    #EXTINF:2.533,
    1723518886_122.ts
    #EXT-X-ENDLIST

    For more information about playlists and ad markers, see Supported protocol.

  • Prepare an ADS template URL.

    Configure ADS request URL and query parameters.

    Sample URL:

    http://ads.aliyundoc.com/getAd?adId=[player_params.ad_id]

    The ADS must adhere to VAST and VMAP specifications, and other industry standards set by the Interactive Advertising Bureau (IAB). For details, see ADS requirements.

Feature configuration

  1. Log on to the IMS console and select a region in the upper-left corner based on your business requirements.

  2. In the left-side navigation pane, select MediaWeaver > Ad Insertion. Click Create Configuration and set up the following parameters:

    image

    image

    Parameter

    Description

    Name

    Enter a unique name for the configuration.

    Content Source

    The URL prefix for the master playlist of the source stream.

    For example, if the master playlist URL is https://player.aliyundoc.com/source/example1.m3u8, enter https://player.aliyundoc.com/source/.

    Ad Decision Server (ADS)

    The ADS request URL, as described in Prepare an ADS template URL.

  3. Click OK to create the configuration.

Feature usage

After you create the configuration, get the Playback Endpoint Prefix on the Ad Insertion page.

image

For playback request, add the master playlist name to the playback endpoint prefix.

For example, if the URL of the source master playlist is https://player.aliyundoc.com/source/example1.m3u8, and the Content Source you entered is https://player.aliyundoc.com/source/, the playback request URL is playback endpoint prefix + example1.m3u8. Use a player that supports HTTP Live Streaming (HLS) to request the playlist with inserted ads.