Edge Acceleration
  • Site Acceleration
    • Overview
    • Access Control
      • Token authentication
        • Token Authentication
        • Authentication Method A
        • Authentication Method B
        • Authentication Method C
        • Authentication Method D
        • Authentication Method V
    • Smart Acceleration
    • Cache configuration
      • Overview
      • EdgeOne caching rules introduction
        • Content Cache Rules
        • Cache Key Introduction
        • Vary Feature
      • Cache Configuration
        • Custom Cache Key
        • Node Cache TTL
        • Status Code Cache TTL
        • Browser Cache TTL
        • Offline Caching
        • Cache Prefresh
      • Clear and Preheat Cach
        • Cache Purge
        • URL Pre-Warming
        • Prefetch M3U8
      • How to improve the Cache Hit Rate of EdgeOne
    • File Optimization
      • Content Compression
      • Smart Compression
    • Network Optimization
      • HTTP/2
      • HTTP/3(QUIC)
        • Overview
        • Enable HTTP/3
        • QUIC SDK
          • SDK Overview
          • SDK Download and Integration
          • Sample Code
            • Android
            • iOS
          • API Documentation
            • Android
            • iOS
      • IPv6 Access
      • Maximum Upload Size
      • WebSocket
      • Client IP Geolocation Header
      • Client IP Geographical Location
      • gRPC
      • Network Error Logging
    • URL Rewrite
      • Access URL Redirection
      • Origin-Pull URL Rewrite
    • Modifying Header
      • Modifying HTTP Response Headers
      • Modifying HTTP Request Headers
    • Modify response content
      • HTTP Response
      • Custom Error Page
    • Rules Engine
      • Overview
      • Rule Management
      • variables
      • Supported Matching Types and Actions
    • Image and video processing
      • Audio and Video Pre-pulling
      • Just-in-Time Image Processing
      • Video Just-In-Time Processing
      • VOD Media Origin
    • Speed limit for single connection download
    • Request and Response Actions
      • HTTP Response
      • Processing order
      • Default HTTP Headers of Origin-Pull Requests
      • Default HTTP Response Headers
      • HTTP Restrictions
    • Media Services
      • Audio and Video Pre-pulling
      • Just-in-Time Image Processing
      • Just-in-Time Media Processing
      • VOD Media Origin
  • L4 Proxy
    • Overview
    • Creating an L4 Proxy Instance
    • Modifying an L4 Proxy Instance
    • Disabling or Deleting an L4 Proxy Instance
    • Batch Configuring Forwarding Rules
    • Obtaining Real Client IPs
      • Obtaining Real TCP Client IPs via TOA
      • Obtaining Real Client IPs Through Protocol V1/V2
        • Overview
        • Method 1: Obtaining Real Client IPs Through Nginx
        • Method 2: Parsing Real Client IPs on Application Server
        • Format of Real Client IPs Obtained Through Proxy Protocol V1/V2
      • Transmitting Client Real IP via SPP Protocol
  • Domain name service and origin server configuration
    • Domain Name Services
      • Overview
      • DNS resolution for managed domains
        • Modifying DNS Servers
        • Configuring DNS Records
        • Batch Importing DNS Records
        • Advanced DNS Configuration
      • Access accelerated domains
        • Adding A Domain Name for Acceleration
        • Ownership Verification
        • Modifying CNAME Records
        • Verify Business Access
      • Traffic scheduling
        • Traffic Scheduling Management
    • HTTPS Certificate
      • Overview
      • Edge HTTPS Certificate
        • Overview
        • Deploying/Updating SSL Certificate for A Domain Name
        • Configuring A Free Certificate for A Domain Name
        • Using Keyless Certificate
      • Edge mTLS Authentication
      • Origin Certificate Validation
      • HTTPS configuration
        • Forced HTTPS Access
        • Enabling HSTS
        • SSL/TLS security configuration
          • Configuring SSL/TLS Security
          • TLS Versions and Cipher Suites
        • Enabling OCSP Stapling
      • Related References
        • Using OpenSSL to Generate Self-Signed Certificates
        • Certificate Format Requirements
        • The Difference Between one-way authentication and Mutual authentication
    • Origin Configuration
      • Load Balancing
        • Overview
        • Quickly Create Load Balancers
        • Health Check Policies
        • Viewing the Health Status of Origin Server
        • Related References
          • Load Balancing-Related Concepts
          • Introduction to Request Retry Strategy
      • Origin Group Configuration
      • Origin configuration
        • Origin-Pull Timeout
        • Configuring Origin-Pull HTTPS
        • Host Header Rewrite
        • Controlling Origin-pull Requests
        • Redirect Following During Origin-Pull
        • HTTP/2 Origin-Pull
        • Range GETs
        • Modify Origin
        • Origin-pull Rate Limiting Policy
      • Origin Protection(Obtaining/Updating Origin IP Address Range)
      • Related References
        • ld Version Origin Group Compatible Related Issues

Prefetch M3U8

This article will provide a detailed introduction on how to achieve M3U8 pre-warming through EdgeOne, systematically bypassing the cache penetration issue during the premiere phase, ensuring that user requests can directly obtain complete resources from the nodes, thereby improving access quality.
Note:
This capability is a whitelisted function. Please contact us if you wish to use it.

Background Introduction

For streaming media services using M3U8 segmentation protocols like HLS/DASH, cache pre-warming can effectively resolve performance bottlenecks during the premiere phase. In traditional distribution models, users must fetch the M3U8 index file and associated TS segment resources from the origin station step by step during their first visit. If there is no cache on the edge nodes, it will lead to significant premiere delays and playback stuttering. The core principle of M3U8 pre-warming is to retrieve all TS segment resources associated with the M3U8 index file for pre-warming.
Core Value
Reduce Access Latency: User requests are directly obtained from the nearest EdgeOne node without returning to the origin station.
Increase Playback Success Rate: Reduce video interruptions caused by network fluctuations.
Optimize Origin Station Costs: Hot resources with high frequency can reduce bandwidth pressure on the origin station through EdgeOne's caching capability.

Steps

Example Scenario

Assuming you are a video vendor who has integrated the site domain www.example.com into EdgeOne acceleration and due to popular series updates, you expect that submitting the M3U8 resource of a film will automatically pre-warm the associated TS resources to EdgeOne.

Step 1: Create a Pre-warming Task for M3U8

Note:
The M3U8 description file must be accessible and describe the segment paths according to industry standards. Supported formats are as follows:
Assuming the request URL is: https://www.example.com/c8679239vodtranssgp1500031474/5fac87c91397757892217228202/adp.1505647.m3u8.
The content format of this URL is relative, such as 1505647_0_0.ts, and EdgeOne will concatenate it into the following TS URL: https://www.example.com/c8679239vodtranssgp1500031474/5fac87c91397757892217228202/1505647_0_0.ts.
The recursive parsing depth of the M3U8 description file should not exceed 3 layers.
The parsed segment count will accumulate the daily pre-warming quota, and once it exceeds the quota, it will be handled silently without further warming.
Call the CreatePrefetchTask API, where:
1. The Targets field: the value is the URL of the M3U8, such as https://www.example.com/c8679239vodtranssgp1500031474/5fac87c91397757892217228202/adp.1505647.m3u8.
2. The PrefetchMediaSegments field, value is on. The value explanation is:
on: Pre-warm the M3U8 description file while recursively parsing and pre-warming the TS resources described in the file.
off: If not filled, the default value is off. Only the submitted M3U8 description file will be pre-warmed.
3. Other parameter fields can be filled as needed.

Step 2: Query the Status of the M3U8 Pre-warming Task

Call the CreatePrefetchTask API, you can check based on the job-id returned when creating the pre-warming task or query through the target. The explanations of the task status are as follows:
processing: In progress.
success: Successful.
failed: Failed.
timeout: Timeout.
invalid: Invalid.

Calling Example

curl
Golang
curl -X POST https://teo.tencentcloudapi.com -H "Authorization: TC3-HMAC-SHA256 Credential=******************************/2025-02-19/teo/tc3_request, SignedHeaders=content-type;host, Signature=9ec53d3ba8d4049c219052b0a2275ff3a30d3429d6295ae4c799c74d32c8f015" -H "Content-Type: application/json" -H "Host: teo.tencentcloudapi.com" -H "X-TC-Action: CreatePrefetchTask" -H "X-TC-Timestamp: 1739965395" -H "X-TC-Version: 2022-09-01" -H "X-TC-Language: zh-CN" -d '{"ZoneId":"zone-xxx","Targets":["https://www.example.com/c8679239vodtranssgp1500031474/5fac87c91397757892217228202/adp.1505647.m3u8"]}'
package main
import (
"fmt"

"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
teo "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901"
)
func main() {
// Instantiate a credential object. You need to pass in the Tencent Cloud account's SecretId and SecretKey. Note the confidentiality of the keys.
// Code leakage may result in the exposure of your SecretId and SecretKey, threatening the security of all resources under the account. The following code example is for reference only; it is recommended to use keys in a more secure manner. Please refer to: https://cloud.tencent.com/document/product/1278/85305
// Keys can be obtained from the official console at https://console.cloud.tencent.com/cam/capi
credential := common.NewCredential(
"SecretId",
"SecretKey",
)
// Instantiate a client option, optional, can be skipped if there are no special needs
cpf := profile.NewClientProfile()
cpf.HttpProfile.Endpoint = "teo.tencentcloudapi.com"
// Instantiate the client object for the requested product. For domestic sites, you can fill in ap-guangzhou as the access region; for international sites, fill in ap-singapore as the access region. clientProfile is optional. client, _ := teo.NewClient(credential, "ap-guangzhou", cpf)
client, _ := teo.NewClient(credential, "ap-guangzhou", cpf)

// Instantiate a request object; each interface corresponds to a request object
request := teo.NewCreatePrefetchTaskRequest()
request.ZoneId = common.StringPtr("zone-364ni75dvzva")
request.Targets = common.StringPtrs([]string{"https://www.example.com/1.m3u8"})
request.PrefetchMediaSegments = common.StringPtr("on")

// The returned resp is an instance of CreatePrefetchTaskResponse, corresponding to the request object
response, err := client.CreatePrefetchTask(request)
if _, ok := err.(*errors.TencentCloudSDKError); ok {
fmt.Printf("An API error has returned: %s", err)
return
}
if err != nil {
panic(err)
}
// Output JSON format string response
fmt.Printf("%s", response.ToJsonString())
}