Let's set up live video in a policy

Here, we cover the specifics required to update a subcustomer policy to add support for live video.

Create or update a policy

General instructions on this operation can be found in the Akamai Cloud Embed API v2 documentation. (See Create or update a policy.)

Define the appropriate match criteria in the delivery policy

Like all other rules in a delivery policy, you must set a match criteria (matches) that must be met to apply the associated behaviors. In the example presented here, the url-wildcard match is used. This match compares the incoming request path (excluding query string) to what is defined as the value for the match "/*" is set here, which indicates all incoming request paths.

Include the "content-characteristics" behavior in the policy

To set up this support, you need to include the content-characteristics behavior, and the following members must be included:

  • type: This must be set to streaming-video-live.
  • value: This must be included and always be set to a hyphen (-).

With just these members set, live video is enabled for the subcustomer, using default settings. Additional specifics on the use of this behavior in a policy can be found in the ACE API v2 documentation.

You can set optional parameters

You have access to additional parameters ("params") with the content-characteristics behavior, when configuring support for live streaming video. They allow you to define specific settings for this subcustomer.

If you apply a segmentDuration<media format> parameter, what you set overrides the Akamai default duration values for this specific subcustomer.

Name Type Description Default
segmentDurationHLS Number This is the duration, in seconds for HLS media segments. The supported range is 0.1 to 10.0. See Apple Technical Note 2224 for their recommended best practices: https://developer.apple.com/library/content/technotes/tn2224/_index.html 10.0 sec.
segmentDurationHDS Number This is the duration in seconds for HDS media segments. The supported range is 0.1 to 10.0. 6.0 sec.
segmentDurationDASH Number This is the duration in seconds for DASH media segments. The supported range is 0.1 to 10.0. 6.0 sec.
segmentDurationSmooth Number This is the duration in seconds for Smooth media segments. The supported range is 0.1 to 10.0. 2.0 sec.
overrideDefaultManifestTTL Boolean By default, Akamai sets the time to live (TTL) for the manifest file based on the segment size specified for that format. However, you can also set a TTL using the Caching behavior in your base configuration. You can include this parameter to specifically define which TTL to use.
  • true: The TTL set in the Caching behavior is used.
  • false: Akamai defines the TTL based on the segment size.
false
prefetch Object Use this object to enable and configure origin-assisted segment prefetching for live video for this subcustomer.
Complete details and requirements are covered in How to add prefetching support for video.
Note: HDS format video is currently not supported for use with prefetching.
false *

* Individual members are included in this object to define the segment prefetch method to use. Each member is boolean and defaults to “false.”

The Akamai platform identifies the media format by examining the URI file extension or the structure of the URI path, and automatically optimizes various settings relating to cache efficiency, cache time-to-live, automated failover/retry, downstream “Content-Type” headers, and network timeout conditions for on-demand video content.

JSON Examples

  • Example 1: This example omits all of the optional parameters. (The params object is included, but left empty.) Default segment/fragment durations for all supported media formats will be used.
    {
        "rules":[
            {  
                "matches": [
                    {
                        "name": "url-wildcard",
                        "value": "/*"
                    }
                ],
                "behaviors": [
                    {
                        "name": "content-characteristics",
                        "type": "streaming-video-live",
                        "value": "-",
                        "params": {}
                    }
                ]
            }
        ]
    }
  • Example 2: This example shows how to include live video streaming. It also shows how to set custom segment/fragment durations for a subcustomer, and also enable prefetching.
    {
        "rules":[
            {  
                "matches": [
                    {
                        "name": "url-wildcard",
                        "value": "/*"
                    }
                ],
                "behaviors": [
                    {
                        "name": "content-characteristics",
                        "type": "streaming-video-live",
                        "value": "-",
                        "params": {
                            "segmentDurationHLS": 6,
                            "segmentDurationHDS": 5.5,
                            "segmentDurationDASH": 2.5,
                            "segmentDurationSmooth": 2.5,
                            "overrideDefaultManifestTTL": true,
                            "prefetch": {
                                "originAssist": true
                            }
                        }
                    }
                ]
            }
        ]
    }