/videos/{videoId}/captions/{language}
Retrieve a caption for a video in a specific language.
videoId
string
required
The unique identifier for the video you want captions for.
language
string
required
A valid language identifier using IETF language tags. You can use primary subtags like en
(English), extended subtags like fr-CA
(French, Canada), or region subtags like zh-Hans-CN
(Simplified Chinese used in the PRC).
fr-CA
. If you use a different separator in your request, the API returns an error.// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/CaptionsApi.md#get
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want captions for.
language := "en" // string | A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC).
res, err := client.Captions.Get(videoId, language)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Captions.Get``: %v\
", err)
}
// response from `Get`: Caption
fmt.Fprintf(os.Stdout, "Response from `Captions.Get`: %v\
", res)
}
Success
{
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en",
"src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt",
"srclang": "en",
"languageName": "English",
"default": false
}
/videos/{videoId}/captions/{language}
Upload a VTT file to add captions to your video. More information can be found here
file
file
required
The video text track (VTT) you want to upload.
// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/CaptionsApi.md#upload
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want to add a caption to.
language := "en" // string | A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC).
file := os.NewFile(1234, "some_file") // *os.File | The video text track (VTT) you want to upload.
res, err := client.Captions.UploadFile(videoId, language, file)
// you can also use a Reader instead of a File:
// client.Captions.Upload(videoId, language, fileName, fileReader)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Captions.Upload``: %v\
", err)
}
// response from `Upload`: Caption
fmt.Fprintf(os.Stdout, "Response from `Captions.Upload`: %v\
", res)
}
Success
{
"uri": "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en",
"src": "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt",
"srclang": "en",
"languageName": "English",
"default": false
}
/videos/{videoId}/captions/{language}
Delete a caption in a specific language by by video id.
videoId
string
required
The unique identifier for the video you want to delete a caption from.
language
string
required
A valid language identifier using IETF language tags. You can use primary subtags like en
(English), extended subtags like fr-CA
(French, Canada), or region subtags like zh-Hans-CN
(Simplified Chinese used in the PRC).
fr-CA
. If you use a different separator in your request, the API returns an error.