You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
api.video's Go client streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens.
Getting started
Installation
go get github.com/apivideo/api.video-go-client
Code sample
For a more advanced usage you can checkout the rest of the documentation in the docs directory
package main
import (
"fmt""os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
funcmain() {
//Connect to production environmentclient:=apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
// if you rather like to use the sandbox environment:// client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_KEY").Build()//List Videos//First create the url options for searchingopts:= apivideosdk.VideosApiListRequest{}.
CurrentPage(1).
PageSize(25).
SortBy("publishedAt").
SortOrder("desc")
//Then call the List endpoint with the optionsresult, err:=client.Videos.List(opts)
iferr!=nil {
fmt.Println(err)
}
for_, video:=rangeresult.Data {
fmt.Printf("%s\n", video.VideoId)
fmt.Printf("%s\n", *video.Title)
}
//Upload a video//First create a containercreate, err:=client.Videos.Create(apivideosdk.VideoCreationPayload{Title: "My video title"})
iferr!=nil {
fmt.Println(err)
}
//Then open the video filevideoFile, err:=os.Open("path/to/video.mp4")
iferr!=nil {
fmt.Println(err)
}
//Finally upload your video to the container with the videoIduploadedVideo, err:=client.Videos.UploadFile(create.VideoId, videoFile)
iferr!=nil {
fmt.Println(err)
}
//And get the assetsfmt.Printf("%s\n", *uploadedVideo.Assets.Hls)
fmt.Printf("%s\n", *uploadedVideo.Assets.Iframe)
}
Please take a moment to leave a star on the client ⭐
This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!
Contribution
Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our client generator. Otherwise, you can also simply open an issue detailing your need on this repository.