/live-streams
Get the list of livestreams on the workspace.
streamKey
string
The unique stream key that allows you to stream videos.
name
string
You can filter live streams by their name or a part of their name.
sortBy
string
Enables you to sort live stream results. Allowed attributes: name
, createdAt
, updatedAt
.
name
- the name of the live stream.
createdAt
- the time a live stream was created.
updatedAt
- the time a live stream was last updated.
When using createdAt
or updatedAt
, the API sorts the results based on the ISO-8601 time format.
sortOrder
string
Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending.
currentPage
int
Choose the number of search results to return per page. Minimum value: 1
pageSize
int
Results per page. Allowed values 1-100, default is 25.
// 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/LiveStreamsApi.md#list
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()
req := apivideosdk.LiveStreamsApiListRequest{}
req.StreamKey("30087931-229e-42cf-b5f9-e91bcc1f7332") // string | The unique stream key that allows you to stream videos.
req.Name("My Video") // string | You can filter live streams by their name or a part of their name.
req.SortBy("createdAt") // string | Enables you to sort live stream results. Allowed attributes: `name`, `createdAt`, `updatedAt`.
req.SortOrder("desc") // string | Allowed: asc, desc. Ascending for date and time means that earlier values precede later ones. Descending means that later values preced earlier ones. For title, it is 0-9 and A-Z ascending and Z-A, 9-0 descending.
req.CurrentPage(int32(2)) // int32 | Choose the number of search results to return per page. Minimum value: 1 (default to 1)
req.PageSize(int32(30)) // int32 | Results per page. Allowed values 1-100, default is 25. (default to 25)
res, err := client.LiveStreams.List(req)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `LiveStreams.List``: %v\
", err)
}
// response from `List`: LiveStreamListResponse
fmt.Fprintf(os.Stdout, "Response from `LiveStreams.List`: %v\
", res)
}
Success
{
"data": [
{
"liveStreamId": "li400mYKSgQ6xs7taUeSaEKr",
"createdAt": "2020-01-31T10:17:47.000Z",
"updatedAt": "2020-03-09T13:19:43.000Z",
"streamKey": "30087931-229e-42cf-b5f9-e91bcc1f7332",
"restreams": [
{
"name": "YouTube",
"serverUrl": "rtmp://youtube.broadcast.example.com",
"streamKey": "cc1b4df0-d1c5-4064-a8f9-9f0368385188"
},
{
"name": "Twitch",
"serverUrl": "rtmp://twitch.broadcast.example.com",
"streamKey": "cc1b4df0-d1c5-4064-a8f9-9f0368385188"
}
],
"name": "Live Stream From the browser",
"public": true,
"broadcasting": false,
"assets": {
"iframe": "<iframe src=\"https://embed.api.video/live/li400mYKSgQ6xs7taUeSaEKr\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"\"></iframe>",
"player": "https://embed.api.video/live/li400mYKSgQ6xs7taUeSaEKr",
"hls": "https://live.api.video/li400mYKSgQ6xs7taUeSaEKr.m3u8",
"thumbnail": "https://live.api.video/li400mYKSgQ6xs7taUeSaEKr/thumbnail.jpg"
}
},
{
"liveStreamId": "li4pqNqGUkhKfWcBGpZVLRY5",
"createdAt": "2020-07-29T10:45:35.000Z",
"updatedAt": "2020-07-29T10:45:35.000Z",
"streamKey": "cc1b4df0-d1c5-4064-a8f9-9f0368385135",
"restreams": [
{
"name": "YouTube",
"serverUrl": "rtmp://youtube.broadcast.example.com",
"streamKey": "cc1b4df0-d1c5-4064-a8f9-9f0368385135"
},
{
"name": "Twitch",
"serverUrl": "rtmp://twitch.broadcast.example.com",
"streamKey": "cc1b4df0-d1c5-4064-a8f9-9f0368385135"
}
],
"name": "Live From New York",
"public": true,
"broadcasting": false,
"assets": {
"iframe": "<iframe src=\"https://embed.api.video/live/li4pqNqGUkhKfWcBGpZVLRY5\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"\"></iframe>",
"player": "https://embed.api.video/live/li4pqNqGUkhKfWcBGpZVLRY5",
"hls": "https://live.api.video/li4pqNqGUkhKfWcBGpZVLRY5.m3u8",
"thumbnail": "https://live.api.video/li4pqNqGUkhKfWcBGpZVLRY5/thumbnail.jpg"
}
}
],
"pagination": {
"currentPage": 1,
"currentPageItems": 19,
"pageSize": 25,
"pagesTotal": 1,
"itemsTotal": 19,
"links": [
{
"rel": "self",
"uri": "/live-streams?currentPage=1&pageSize=25"
},
{
"rel": "first",
"uri": "/live-streams?currentPage=1&pageSize=25"
},
{
"rel": "last",
"uri": "/live-streams?currentPage=1&pageSize=25"
}
]
}
}
/live-streams
Creates a livestream object.
name
string
required
Add a name for your live stream here.
public
boolean
Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. Learn more about the Private Video feature here.
playerId
string
The unique identifier for the player.
restreams
array
Use this parameter to add, edit, or remove RTMPS
or RTMP
services where you want to restream a live stream. The list can only contain up to 5 destinations.
{
"name": "Test live",
"playerId": "pl4f4ferf5erfr5zed4fsdd",
"restreams": [
{
"name": "YouTube",
"serverUrl": "rtmp://youtube.broadcast.example.com",
"streamKey": "dw-dew8-q6w9-k67w-1ws8"
},
{
"name": "Twitch",
"serverU