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
All methods that access API resources, such as ustream.video.* or ustream.channel.* will return a Promise.
letUstream=require('ustream-sdk')// Set up instance using password authenticationletustream=newUstream({username: "...",password: "...",client_id: "...",client_secret: "...",token_type: "...",// Optional, default is bearertype: "password"})ustream.video.get(videoId).then((video)=>{// Use video}).catch((err)=>{// Handle error})
Paging Results
Some methods return data that is divided into many pages. These methods will return an object with helper methods
to allow for easy access to both your data and next pages.
// Get list of channelsustream.channel.list().then((pageableResult)=>{// Access the list of channelsletchannels=pageableResult.data// Check if result set has a next pageif(pageableResult.hasNextPage()){// Retrieve the next page of channelspageableResult.next().then((nextPageResults)=>{// Use next page's results})}}).catch((err)=>{console.warn(err)})
Method
Returns
Description
next()
Promise<PageableResult>
Retrieves the next page of results. Returns null if a next page does not exist.
data()
array<Object>
Returns the data for a given page.
hasNextPage()
boolean
If true, next() will return a new page of data. If false, no next page exists.
If you choose to change your authentication workflow or swap out credentials after initializing Ustream, you can utilize the setAuthCredentials method.
Default is "private". If set to true, video will be published upon end of upload.
Video Upload Status
ustream.video.getStatus(channelId,videoId)
Parameter
Type
Description
channelId
int
ID of an existing channel.
videoId
int
ID of an existing video.
List Videos
ustream.video.list(channelId,pageSize,page)
Promise returns a Pageable result. See "Paging Results" section for details.
Parameter
Type
Description
channelId
int
Id of a channel.
pageSize
int
(optional) Default: 100. The number of results to show per page.
page
int
(optional) Default: 1. The page to retrieve.
Get Video Details
ustream.video.get(videoId)
Parameter
Type
Description
videoId
int
ID of an existing video.
Delete Video
ustream.video.remove(videoId)
Parameter
Type
Description
videoId
int
ID of an existing video.
Channel API
Get Channel
ustream.channel.get(channelId,opts)
Parameter
Type
Description
channelId
int
ID of an existing channel.
opts.detail_level
string
Default is null. If set to "minimal", the result set is limited to id, title, picture, owner and locks data. If the channel is protected, only minimal data can be retrieved without valid access token.
Create Channel
ustream.channel.create(channelId,opts)
Parameter
Type
Description
title
string
Channel title.
opts.description
string
Description of channel.
Edit Channel
ustream.channel.edit(channelId,title,opts)
Parameter
Type
Description
channelId
int
ID of an existing channel.
title
string
Title of channel.
opts.description
string
Description of channel.
opts.tags
string
Comma delimited list of channel tags
Delete Channel
ustream.channel.remove(channelId)
Parameter
Type
Description
channelId
int
ID of an existing channel.
List Channels
ustream.channel.list(pageSize,page)
Promise returns a Pageable result. See "Paging Results" section for details.
Parameter
Type
Description
pageSize
int
(optional) Default: 100. The number of results to show per page.