Policy video

akamai_imaging_policy_video

Specify details for a video policy, like variations in image size and formats. Then reference this data source in the corresponding resource.

To define variables in your policy, see Use variables.

data "akamai_imaging_policy_video" "my-video-policy-definition" {
  policy {
    rollout_duration = 3602
    breakpoints {
      widths = [
        320,
        640,
        1024,
        2048,
        5000
      ]
    }
    output {
      placeholder_video_url  = "https://example-video.net/specs/im_videos/A7123_BC456_v.mp4"
      video_adaptive_quality = "medium"
      perceptual_quality_var = "videoQuality"
    }
    hosts = [
      "www.example-1.com",
      "www.example-2.com"
    ]
    variables {
      name          = "videoQuality"
      type          = "perceptualQuality"
      default_value = "mediumHigh"
    }
  }
}

output "my-video-policy" {
  value = data.akamai_imaging_policy_video.my-video-policy-definition
}

resource "akamai_imaging_policy_image" "my-video-policy" {
  activate_on_production = false
  contract_id            = "12345"
  policy_id              = "my-video-policy-1"
  policyset_id           = akamai_imaging_policy_set.my-policy-set.id
  json                   = data.akamai_imaging_policy_video.my-video-policy-definition.json
}
Changes to Outputs:
  + my-video-policy = {
      + id     = "12abcd34ef5ghi6i78klmn9012op34qrstuv56wx7yz"
      + json   = jsonencode(
            {
              + breakpoints     = {
                  + widths = [
                      + 320,
                      + 640,
                      + 1024,
                      + 2048,
                      + 5000,
                    ]
                }
              + hosts           = [
                  + "www.example-1.com",
                  + "www.example-2.com",
                ]
              + output          = {
                  + perceptualQuality    = {
                      + var = "videoQuality"
                    }
                  + placeholderVideoUrl  = "https://example-video.net/specs/im_videos/A7123_BC456_v.mp4"
                  + videoAdaptiveQuality = "medium"
                }
              + rolloutDuration = 3602
              + variables       = [
                  + {
                      + defaultValue = "mediumHigh"
                      + name         = "videoQuality"
                      + type         = "perceptualQuality"
                    },
                ]
            }
        )
      + policy = [
          + {
              + breakpoints      = [
                  + {
                      + widths = [
                          + 320,
                          + 640,
                          + 1024,
                          + 2048,
                          + 5000,
                        ]
                    },
                ]
              + hosts            = [
                  + "www.example-1.com",
                  + "www.example-2.com",
                ]
              + output           = [
                  + {
                      + perceptual_quality         = ""
                      + perceptual_quality_var     = "videoQuality"
                      + placeholder_video_url      = "https://example-video.net/specs/im_videos/A7123_BC456_v.mp4"
                      + placeholder_video_url_var  = ""
                      + video_adaptive_quality     = "medium"
                      + video_adaptive_quality_var = ""
                    },
                ]
              + rollout_duration = "3602"
              + variables        = [
                  + {
                      + default_value = "mediumHigh"
                      + enum_options  = []
                      + name          = "videoQuality"
                      + postfix       = ""
                      + prefix        = ""
                      + type          = "perceptualQuality"
                    },
                ]
            },
        ]
    }

Arguments

Pass the required policy argument in the body of the declaration to specify settings in it for a video policy.

Argument Required Description
breakpoints The list of breakpoint widths in pixels used to create derivative videos.
hosts The hosts allowed for video URLs within variables.
output The output quality of each resized video. Includes:
  • perceptual_quality. The visual quality of derivative videos after they have been compressed to maximize byte savings. You can select one of five perceptual quality values: high, mediumHigh, medium, mediumLow, or low.

    high results in the highest visual quality with the least byte savings, while low results in lower visual quality with the greatest byte savings.
  • perceptual_quality_var. Use this argument instead of perceptual_quality if setting a variable.
  • placeholder_video_url. The URL for a specific placeholder video that appears when the user first requests a video and Image and Video Manager is still processing the derivative video.

    If no placeholder video is specified, the original video plays while the derivative video is being processed.
  • placeholder_video_url_var. Use this argument instead of placeholder_video_url if setting a variable.
  • video_adaptive_quality. The quality value applied to a video when Image and Video Manager detects a slow connection (RTT > 300 ms). This value overrides the derivative quality value.

    Specifying a lower value can reduce load times for users with slow connections without impacting the quality of videos for users with standard connections.
  • video_adaptive_quality_var. Use this argument instead of video_adaptive_quality if setting a variable.
rollout_duration The amount of time in seconds that it takes for the policy to roll out. It can be between 3600604800 seconds. During the rollout, the proportion of videos with the new policy applied continually increases until cached videos associated with the previous version of the policy are no longer being served.
variables The variables available for the policy. You can reference any variable declared here in output. You can also pass in these variable names and values dynamically as query parameters in the video's request URL. See Use variables for more information. Includes:
  • name. Required. The name of the variable which is also available as the query parameter name to set the variable's value dynamically. Can be up to 50 alphanumeric characters.
  • type. Required. The type of value for the variable. Value is one of:
    • bool
    • number
    • url
    • color
    • gravity
    • placement
    • scaleDimension
    • grayscaleType
    • aspect
    • resizeType
    • dimension
    • perceptualQuality
    • string
    • focus
  • default_value. Required. The default value of the variable if no query parameter is provided. It needs to be one of the enum_options if any are provided.
  • enum_options. Limits the set of possible values for a variable.
    • id. Required. The ID for each enum value. Can be up to 50 alphanumeric characters.
    • value. Required. The value of the variable when the id is provided.
  • postfix. A postfix added to the value provided for the variable, or to the default value.
  • prefix. A prefix added to the value provided for the variable, or to the default value.

Attributes

Returned to you is the JSON-encoded video policy.