(multistream)
Operations related to multistream api
- getAll - Retrieve Multistream Targets
- create - Create a multistream target
- get - Retrieve a multistream target
- update - Update Multistream Target
- delete - Delete a multistream target
Retrieve Multistream Targets
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.multistream.getAll();
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { multistreamGetAll } from "livepeer/funcs/multistreamGetAll.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await multistreamGetAll(livepeer);
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetMultistreamTargetsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Create a multistream target
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.multistream.create({
url: "rtmps://live.my-service.tv/channel/secretKey",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { multistreamCreate } from "livepeer/funcs/multistreamCreate.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await multistreamCreate(livepeer, {
url: "rtmps://live.my-service.tv/channel/secretKey",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.MultistreamTargetInput | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CreateMultistreamTargetResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Retrieve a multistream target
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.multistream.get("<id>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { multistreamGet } from "livepeer/funcs/multistreamGet.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await multistreamGet(livepeer, "<id>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | ID of the multistream target |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetMultistreamTargetResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Update Multistream Target
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.multistream.update({
url: "rtmps://live.my-service.tv/channel/secretKey",
}, "<id>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { multistreamUpdate } from "livepeer/funcs/multistreamUpdate.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await multistreamUpdate(livepeer, {
url: "rtmps://live.my-service.tv/channel/secretKey",
}, "<id>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | ID of the multistream target |
multistreamTargetPatchPayload |
components.MultistreamTargetPatchPayload | ✔️ | N/A |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.UpdateMultistreamTargetResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Make sure to remove any references to the target on existing streams before actually deleting it from the API.
import { Livepeer } from "livepeer";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.multistream.delete("<id>");
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { LivepeerCore } from "livepeer/core.js";
import { multistreamDelete } from "livepeer/funcs/multistreamDelete.js";
// Use `LivepeerCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const livepeer = new LivepeerCore({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await multistreamDelete(livepeer, "<id>");
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | ID of the multistream target |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.DeleteMultistreamTargetResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |