VoD
Creating a VoD
To enable VoD, you need to create a vod object, specifying a video source where video files are stored. The source can be a domain or an S3 bucket connected to the CDN.
After registering the source, the VoD feature is inactive by default. You need to enable VoD to start using it.
Enabling VoD
After creating a VoD object, you can enable (activate) VoD.
To do this, use the API method enable_vod.
When enabling VoD, a task of type ENABLE_VOD is created and executed in a separate process.
The domain for VoD (vod_domain) issued when creating the VoD object becomes active.
You can then choose a suitable streaming protocol (HLS, DASH, or MSS) and construct a URL for accessing playlists.
Disabling VoD
To disable VoD, use the API method disable_vod.
This creates a task of type DISABLE_VOD, which is also executed in a separate process.
This task is only created if VoD for the domain or S3 bucket is currently active.
Updating VoD
To update VoD settings, use the API method update_vod.
Deleting VoD
To delete a VoD object, use the API method delete_vod.
Make sure VoD is disabled before deletion.
Generating an Access Token
To generate a token, use the API method generate_vod_token.
Revoking Access Tokens
To revoke tokens, use the API method revoke_vod_tokens.
All previously issued tokens will become invalid.
Access Restriction
For domains, you can enable access restriction using the domain.access_params object. The structure is:
{
"disallowed_country_codes": [
"RU",
"BY"
]
}
The disallowed_country_codes field contains a list of country codes. Requests originating from those countries will receive a 403 Forbidden response.
Country codes must follow the two-letter format from ISO 3166 Alpha-2.
Adaptive Bitrate
The vod.enable_adaptive_bitrate field is responsible for enabling the adaptive bitrate feature. Methods are available to view the list of video transcoding tasks and to clear the VoD cache with adaptive bitrate.
Recommended Scenarios
Below are recommendations for managing vod objects.
Initial Activation:
- Choose an active source for VoD (
s3_resourceordomain) - Activate the VoD service
- Provide the client with a list of generated URLs to access the video files
Token Management:
- Enable the
restrict_accessoption for VoD - Generate a token with the required parameters
- Construct a playlist URL like
{vod_url}?token={vod_token}
Adaptive Bitrate
- Enable the
enable_adaptive_bitrateoption for VoD - Make a request to the playlist (for example, GET
https://{vod_domain}/hls/{bucket_name}/{filename}/master.m3u8) - Wait for the video transcoding to complete, monitoring the task progress