## 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. ### Parameters - `params ClipNewParams` - `AccountID param.Field[string]` Path param: The account identifier tag. - `ClippedFromVideoUID param.Field[string]` Body param: The unique video identifier (UID). - `EndTimeSeconds param.Field[int64]` Body param: Specifies the end time for the video clip in seconds. - `StartTimeSeconds param.Field[int64]` Body param: Specifies the start time for the video clip in seconds. - `AllowedOrigins param.Field[[]AllowedOrigins]` Body param: Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin. - `Creator param.Field[string]` Body param: A user-defined identifier for the media creator. - `MaxDurationSeconds param.Field[int64]` Body param: The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown. - `RequireSignedURLs param.Field[bool]` Body param: Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video. - `ThumbnailTimestampPct param.Field[float64]` Body param: The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video. - `Watermark param.Field[ClipNewParamsWatermark]` Body param - `UID string` The unique identifier for the watermark profile. ### Returns - `type Clip struct{…}` - `AllowedOrigins []AllowedOrigins` Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin. - `ClippedFromVideoUID string` The unique video identifier (UID). - `Created Time` The date and time the clip was created. - `Creator string` A user-defined identifier for the media creator. - `EndTimeSeconds int64` Specifies the end time for the video clip in seconds. - `MaxDurationSeconds int64` The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of `-1` means the value is unknown. - `Meta unknown` A user modifiable key-value store used to reference other systems of record for managing videos. - `Modified Time` The date and time the live input was last modified. - `Playback ClipPlayback` - `Dash string` DASH Media Presentation Description for the video. - `Hls string` The HLS manifest for the video. - `Preview string` The video's preview page URI. This field is omitted until encoding is complete. - `RequireSignedURLs bool` Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video. - `StartTimeSeconds int64` Specifies the start time for the video clip in seconds. - `Status ClipStatus` Specifies the processing status for all quality levels for a video. - `const ClipStatusPendingupload ClipStatus = "pendingupload"` - `const ClipStatusDownloading ClipStatus = "downloading"` - `const ClipStatusQueued ClipStatus = "queued"` - `const ClipStatusInprogress ClipStatus = "inprogress"` - `const ClipStatusReady ClipStatus = "ready"` - `const ClipStatusError ClipStatus = "error"` - `const ClipStatusLiveInprogress ClipStatus = "live-inprogress"` - `ThumbnailTimestampPct float64` The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video. - `Watermark ClipWatermark` - `UID string` The unique identifier for the watermark profile. ### Example ```go 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) } ``` #### Response ```json { "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" } } } ```