Clip videos given a start and end time
client.Stream.Clip.New(ctx, params) (*Clip, error)
POST/accounts/{account_id}/stream/clip
Clips a video based on the specified start and end times provided in seconds.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Clip videos given a start and end time
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/stream"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
clip, err := client.Stream.Clip.New(context.TODO(), stream.ClipNewParams{
AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
ClippedFromVideoUID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
EndTimeSeconds: cloudflare.F(int64(0)),
StartTimeSeconds: cloudflare.F(int64(0)),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", clip.ClippedFromVideoUID)
}
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"allowedOrigins": [
"example.com"
],
"clippedFromVideoUID": "023e105f4ecef8ad9ca31a8372d0c353",
"created": "2014-01-02T02:20:00Z",
"creator": "creator-id_abcde12345",
"endTimeSeconds": 0,
"maxDurationSeconds": 1,
"meta": {
"name": "video12345.mp4"
},
"modified": "2014-01-02T02:20:00Z",
"playback": {
"dash": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.mpd",
"hls": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.m3u8"
},
"preview": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/watch",
"requireSignedURLs": true,
"startTimeSeconds": 0,
"status": "inprogress",
"thumbnailTimestampPct": 0.529241,
"watermark": {
"uid": "ea95132c15732412d22c1476fa83f27a"
}
}
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"allowedOrigins": [
"example.com"
],
"clippedFromVideoUID": "023e105f4ecef8ad9ca31a8372d0c353",
"created": "2014-01-02T02:20:00Z",
"creator": "creator-id_abcde12345",
"endTimeSeconds": 0,
"maxDurationSeconds": 1,
"meta": {
"name": "video12345.mp4"
},
"modified": "2014-01-02T02:20:00Z",
"playback": {
"dash": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.mpd",
"hls": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.m3u8"
},
"preview": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/watch",
"requireSignedURLs": true,
"startTimeSeconds": 0,
"status": "inprogress",
"thumbnailTimestampPct": 0.529241,
"watermark": {
"uid": "ea95132c15732412d22c1476fa83f27a"
}
}
}