(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
package hello.world;
import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.GetMultistreamTargetsResponse;
public class Application {
public static void main(String[] args) throws Exception {
try {
Livepeer sdk = Livepeer.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.build();
GetMultistreamTargetsResponse res = sdk.multistream().getAll()
.call();
if (res.data().isPresent()) {
// handle response
}
} catch (SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
Error Object | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4xx-5xx | */* |
Create a multistream target
package hello.world;
import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.components.MultistreamTargetInput;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.CreateMultistreamTargetResponse;
public class Application {
public static void main(String[] args) throws Exception {
try {
Livepeer sdk = Livepeer.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.build();
MultistreamTargetInput req = MultistreamTargetInput.builder()
.url("rtmps://live.my-service.tv/channel/secretKey")
.build();
CreateMultistreamTargetResponse res = sdk.multistream().create()
.request(req)
.call();
if (res.multistreamTarget().isPresent()) {
// handle response
}
} catch (SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
request |
MultistreamTargetInput | ✔️ | The request object to use for the request. |
CreateMultistreamTargetResponse
Error Object | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4xx-5xx | */* |
Retrieve a multistream target
package hello.world;
import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.GetMultistreamTargetResponse;
public class Application {
public static void main(String[] args) throws Exception {
try {
Livepeer sdk = Livepeer.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.build();
GetMultistreamTargetResponse res = sdk.multistream().get()
.id("<value>")
.call();
if (res.multistreamTarget().isPresent()) {
// handle response
}
} catch (SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
String | ✔️ | ID of the multistream target |
Error Object | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4xx-5xx | */* |
Update Multistream Target
package hello.world;
import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetResponse;
public class Application {
public static void main(String[] args) throws Exception {
try {
Livepeer sdk = Livepeer.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.build();
UpdateMultistreamTargetResponse res = sdk.multistream().update()
.id("<value>")
.multistreamTargetPatchPayload(MultistreamTargetPatchPayload.builder()
.url("rtmps://live.my-service.tv/channel/secretKey")
.build())
.call();
// handle response
} catch (SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
String | ✔️ | ID of the multistream target |
multistreamTargetPatchPayload |
MultistreamTargetPatchPayload | ✔️ | N/A |
UpdateMultistreamTargetResponse
Error Object | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4xx-5xx | */* |
Make sure to remove any references to the target on existing streams before actually deleting it from the API.
package hello.world;
import java.lang.Exception;
import studio.livepeer.livepeer.Livepeer;
import studio.livepeer.livepeer.models.errors.SDKError;
import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetResponse;
public class Application {
public static void main(String[] args) throws Exception {
try {
Livepeer sdk = Livepeer.builder()
.apiKey("<YOUR_BEARER_TOKEN_HERE>")
.build();
DeleteMultistreamTargetResponse res = sdk.multistream().delete()
.id("<value>")
.call();
// handle response
} catch (SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
String | ✔️ | ID of the multistream target |
DeleteMultistreamTargetResponse
Error Object | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4xx-5xx | */* |