stream管理
更新时间:2024-02-28
createStream
在特定Domain下新建Stream。
CreateStreamRequest request = new CreateStreamRequest();
request.withPlayDomain(yourPlayDomain) // yourPlayDomain是用户提前创建的播放域名
.withApp(yourApp) // yourApp是用户自定义的app名称
.withPublish(new CreateStreamRequest.PublishInfo().withPushStream(yourStream)); // yourStream是用户自定义的Stream名称
CreateStreamResponse response = lssClient.createStream(request);
listStream
查询特定Domain下的所有Stream信息。
ListStreamRequest request = new ListStreamRequest();
String status = "READY";
request.withPlayDomain(yourPlayDomain).withMaxSize(10).withStatus(status); // status表示Stream的状态,有效值有READY、ONGOING、PAUSED
ListStreamResponse response = lssClient.listStream(request);
listDomainApp
查询特定Domain下所有App(不包括默认App)。
ListDomainAppRequest request = new ListDomainAppRequest();
request.setPlayDomain(yourPlayDomain);
ListDomainAppResponse response = lssClient.listDomainApp(request);
getStream
查询特定Domain下的特定Stream信息。
GetStreamRequest request = new GetStreamRequest();
request.withPlayDomain(yourPlayDomain).withApp(yourApp).withStream(yourStream);
GetStreamResponse response = lssClient.getStream(request);
pauseDomainStream
封禁特定domain下的特定stream。
PauseDomainStreamRequest request = new PauseDomainStreamRequest();
request.withDomain(yourDomain).withApp(yourApp).withStream(yourStream);
lssClient.pauseDomainStream(request);
resumeDomainStream
解禁特定Domain下的特定Stream。
ResumeDomainStreamRequest request = new ResumeDomainStreamRequest();
request.withDomain(yourDomain).withApp(yourApp).withStream(yourStream);
lssClient.resumeDomainStream(request);
deleteStream
删除特定stream
DeleteStreamRequest request = new DeleteStreamRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream);
lssClient.deleteStream(request);
updateStreamWatermark
更新特定stream的水印模板
Watermarks watermarks = new Watermarks(); //如果watermarks为null,将继承域名下的水印模板配置。
watermarks.setImage(Collections.singletonList("lss_sdk_java_imw"));
watermarks.setTimestamp(Collections.singletonList("lss_sdk_java_tsw"));
UpdateStreamWatermarkRequest request = new UpdateStreamWatermarkRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream)
.withWatermarks(watermarks);
lssClient.updateStreamWatermark(request);
updateStreamRecording
更新特定stream的录制模板
String recording = "lss_java_sdk_m3u8"; //如果recording为null,将继承域名下的录制模板配置。
UpdateStreamRecordingRequest request = new UpdateStreamRecordingRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream)
.withRecording(recording);
lssClient.updateStreamRecording(request);
updateStreamPresets
更新特定stream的转码模板
Map<String, String> presets = new HashMap<String, String>();
// 这里不能更新L0对应的模板
// 如果presets为null,将继承域名下的转码模板配置。
presets.put("L1", "lss.lss_960x720");
presets.put("L2", "lss.lss_1280x720");
UpdateStreamPresetsRequest request = new UpdateStreamPresetsRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream)
.withPresets(presets);
lssClient.updateStreamPresets(request);
updateDestinationPushUrl
更新特定stream目标推流地址
String destinationPushUrl = "rtmp://push.testsdk.com";
UpdateStreamDestinationPushUrlRequest request = new UpdateStreamDestinationPushUrlRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream)
.withDestinationPushUrl(destinationPushUrl);
lssClient.updateStreamDestinationPushUrl(request);