Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lapi: clip #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions api.go
Expand Up @@ -166,6 +166,15 @@ type (
Encoder string `json:"encoder,omitempty"` // enum: - h264, h265, vp8, vp9
}

Clip struct {
Name string `json:"name,omitempty"`
StartTime int64 `json:"startTime,omitempty"`
EndTime int64 `json:"endTime,omitempty"`
PlaybackID string `json:"playbackId,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Offset int64 `json:"offset,omitempty"`
}

MultistreamTargetRef struct {
Profile string `json:"profile,omitempty"`
VideoOnly bool `json:"videoOnly,omitempty"`
Expand Down Expand Up @@ -1062,6 +1071,21 @@ func (lapi *Client) ExportAsset(assetId string) (*Task, error) {
return &output.Task, nil
}

func (lapi *Client) Clip(params Clip) (*Asset, *Task, error) {
var (
url = fmt.Sprintf("%s/api/clip", lapi.chosenServer)
input = &params
output TaskAndAsset
)

err := lapi.doRequest("POST", url, "clip", "", input, &output)
if err != nil {
return nil, nil, err
}
glog.V(logs.DEBUG).Infof("Created clip task id=%s assetId=%s status=%s type=%s", output.Task.ID, output.Asset.ID, output.Task.Status.Phase, output.Task.Type)
return &output.Asset, &output.Task, nil
}

func (lapi *Client) GetMultistreamTarget(id string) (*MultistreamTarget, error) {
var target MultistreamTarget
url := fmt.Sprintf("%s/api/multistream/target/%s", lapi.chosenServer, id)
Expand Down