Content Replacement with a CDN

How to configure your CDN to work with your Content Replacement service

The following sections show how to use broadpeak.io with your own content distribution network (CDN) in the context of Content Replacement or Virtual Channel applications. For clarity, we use generic terms that may not always apply to the CDN you are operating, but the principles should remain the same.

1. Defining routing rules for manifest requests

964

Manifest requests need to be directed to the broadpeak.io platform. To do so, you need to create new routing rules (also called behaviors), one for each streaming format.

MPEG-DASH

  • Path(s) to match: *.MPD/*.mpd
    You can be more specific here if you do not want to have a wildcard with ``.
  • Origin FQDN: stream.broadpeak.io
  • Protocol: HTTPS

HLS

  • Path(s) to match: *.M3U8/*.m3u8
    _You can be more specific here if you do not want to have a wildcard with *.
  • Origin FQDN: stream.broadpeak.io
  • Protocol: HTTPS

🚧

Important!

The URL endpoint generated by broadpeak.io always contains a hashed value within the path.
E.g.: https://stream.broadpeak.io/d3d9446802a/myStream/myOutput/index.mpd.

On the first request, broadpeak.io returns a 307 with a location value where the hashed value is removed from the path, and added into the bpkio_serviceid query param.
E.g.: HTTP 307 location: /myStream/myOutput/index.mpd?serviceid=d3d9446802a&sessionid=x

When defining your CDN routing rules, it is best practice not to add the hashed value to be matched against, or you would potentially have to create two rules, one for the first request with the hashed value, and a second for the redirection request without the hashed value.
E.g.: the path to match here would be /myStream/myOutput/index.mpd .

2. Defining routing policies for media segment requests

Media Segment requests need to be directed to the component which originates the content, in this case the origin within your ecosystem. To do so, you need to create new routing rules (also called behaviors) per media container extension.

  • Path(s) to match:
    Depending on the flexibility of your CDN, you can target all requests which come with a specific media segment extension, such as .ts/.fmp4/.dash/.m4s/.aac etc.
    You can be more specific by specifying the full path of the original and replacement content, for example:
    /myOriginalContent/myOutput/*.ts / /myOriginalContent/myOutput/*.m4s / .....
    /myReplacementContent/myOutput/*.ts / /myReplacementContent/myOutput/*.m4s / .....
    In both cases, do not forget to add routing policies for all media types: Video, Audio, Subtitles, Images (I-Frames, etc.).
  • Origin FQDN: It needs to be your own Origin FQDN.
  • Protocol: You can follow the request scheme or specify HTTPS and/or HTTP.

📘

Note

If you use several origins for original and replacement content, you need to create different routing policies which route original media segment requests to one origin, and replacement media segment requests to the second origin.

📘

Note about demo streams

If you are using broadpeak.io demo streams, use HTTPS protocol and origin.broadpeak.io as origin FQDN.

3. Defining caching policies for manifest requests

Content Replacement Applications

Because content is contextualized, manifests delivered by broadpeak.io for different Audiences do not contain the same reference. It is mandatory to disable caching on manifest requests for your application to properly operate.

🚧

Disable caching on manifest requests

With broadpeak.io, media content is personalized, so are the generated manifests. Configure your CDN so that it does not cache m3u8s and mpds.

4. Defining caching policies for media segments

Media segments are not originated by broadpeak.io, but by your own origins. Define your own caching policies based on your preferences for all media segment requests.

5. Forwarding query parameters.

🚧

Allow your CDN to forward query parameters from the client requests to broadpeak.io

  • Compulsory system query parameters are mm_sp, bpkio_serviceid and bpkio_sessionid. The CDN must forward them.
  • When working with a conditional Content Replacement application, zip or category must be forwarded.

General system query parameters

For broadpeak.io to operate successfully, some query parameters must be forwarded by the CDN from the client request to broadpeak.io, and carried all the way through the session. See Manifest manipulation section for more information.
The following query parameters and their value must be allowed to be forwarded from the client request to broadpeak.io:

  • mm_sp
  • bpkio_sessionid=${value}
  • bpkio_serviceid=${value}

📘

Note

If you need to forward specific query parameters to the origin for some reason, please contact us at [email protected] or via the web app chat.

query parameters to identify the Audience

If your application does require contextualization based on Audience, your client (player) have to pass some information for broadpeak.io to identify which Audience is requesting the content.

When working with zip code, the CDN must allow forwarding the query parameter zip from the client request to broadpeak.io.
When working with category, the CDN must allow forwarding the query parameter category from the client request to broadpeak.io.


What’s Next

Here are some playbooks on how to do all this with specific CDN products