As in the Live - DASH example the HLS example follows five steps to completely implement VAST tracking client side.
There are two ways to integrate Live - HLS VAST tracking depending on the capabilities of the video player.
If you have no access to the segments that the player is currently playing back use:
If you have access to the segments use:
If you are in doubt that you have access or just want to get quickly started use the first option. It will always work but can be slightly inaccurate under some circumstances.
Differences to DASH
For HLS-Live, VAST tracking is supported through Serverside.ai, where the VAST document can be fetched by the client to request the tracking URLs. Different from DASH there are no ad-ids in the HLS-standard manifests. Therefore you need to request the vast endpoint at the right point in time to get the vast response related to the ad that is going to run.
To signal the appearance of an ad there will be a EXT-X-PROGRAMM tag in the HLS manifest: EXT-X-PROGRAM-DATE-TIME:<date-time-msec>. It is now possible to call the vastURL at the moment when an ad is playing and receive the VAST data for this ad.
The rest of the process stays the same. We will nevertheless run through every single step below.
Option 1: Player has no API to retrieve segments
The parameter needed below can be viewed at Serverside.ai or via the https://admin.serverside.ai/api/v2/channels/:channelId API endpoint.
1. Manifest API Request
To retrieve a URL to the HLS master manifest and open a user session on the server use the following endpoint:
To get the VAST document relating to the ad break that is currently playing use the vastURL from above. It will provide the original VAST response document together with the timing information for the synchronization on the player side.
The vastURL will mostly respond with a 204 (No Content). This happens because a request to the ad server is made one segment before the ad break. The VAST response from the ad server is stored and the stitching process takes place in the background. At this time the related VAST document is available to the front end as well (response with 200 OK), but as soon as the ad block is over the API will switch back to 204.
In the case the player has an API to retrieve the currently playing segment use the following option.
1. Manifest API Request
The URL to the ad-insertion enabled channel is called outputUrl and can be viewed at Serverside.ai or via the https://admin.serverside.ai/api/v2/channels/:channelId API endpoint.
An outputUrl for HLS will have the following schema:
The URIs pointing to the media manifests will contain the session id. Appending /vast to any of the media manifest URI will provide the original VAST response document together with the timing information for the synchronization on the player side.