LSS开发指南
更新时间:2024-02-28
音视频直播服务 LSS 采用域名(Domain)、应用(App)、流(Stream)三级直播管理单元,一个域名(Domain)下可包含多个应用(App),一个应用(App)下可包含多个流(Stream)。每个应用(App)继承所属域名(Domain)的所有配置,同理,每个流(Stream)继承所属应用(App)的所有配置。
Stream流管理
新建Stream
在特定Domain下新建推流Stream,用户只需要在域名下指定app、stream名称,就可以拼接推流地址。
用户无需创建推流地址,仅需要在推流时,将推流地址输入在推流工具即可开始推流。
查询特定Domain下的特定Stream
代码示例如下:
//指定Domain, App, Stream
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$response = $client->getStream($domain, $app, $stream);
print json_encode($response);
查询特定Domain下的所有Stream
代码示例如下:
//指定Domain
$domain = '<Domain_Name>';
$response = $client->listStreams($domain);
foreach ($response->streams as $stream) {
print json_encode($stream);
}
封禁特定Domain下的特定stream
代码示例如下:
//指定Domain, App, Stream
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$response = $client->pauseStream($domain, $app, $stream);
print json_encode($response);
解禁特定Domain下的特定Stream
代码示例如下:
//指定Domain, App, Stream
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$response = $client->resumeStream($domain, $app, $stream);
print json_encode($response);
更新特定Stream的水印
代码示例如下:
//指定Domain, 参数params
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$options = array(
'watermarks' => '<Watermarks_Object>',
);
$response = $client->updateWatermarksOfStream($domain, $app, $stream, $options);
print json_encode($response);
查询特定Stream的实时直播源信息
代码示例如下:
//指定Domain, App, Stream
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$response = $client->getRealtimeStreamSourceInfo($domain, $app, $stream);
print json_encode($response);
删除Stream
删除特定Domain下的特定Stream
代码示例如下:
//指定Domain, App, Stream
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$response = $client->deleteStream($domain, $app, $stream);
print json_encode($response);
安全策略
查询安全策略
查询指定安全策略的相关信息,代码示例如下:
//指定安全策略名称
$security_policy = '<SecurityPolicy_Name>';
$response = $client->querySecurityPolicy($security_policy);
print json_encode($response);
统计
查询所有Domain的统计概要
代码示例如下:
//指定参数params
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
);
$response = $client->getDomainSummaryStatistics($params);
print json_encode($response);
查询所有Domain的统计数据
代码示例如下:
//指定参数params
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"orderBy" => "domain",
);
$response = $client->listDomainStatistics($params);
print json_encode($response);
查询特定Domain下特定Stream的统计数据
代码示例如下:
//指定Domain, App, Stream, 参数params
$domain = '<Domain_Name>';
$app = '<App_Name>';
$stream = '<Stream_Name>';
$params = array(
"startDate" => "20160920",
"endDate" => "20160921",
);
$response = $client->getStreamStatistics($domain, $app, $stream, $params);
print json_encode($response);
查询特定Domain下所有Stream的统计数据
代码示例如下:
//指定Domain, 参数params
$domain = '<Domain_Name>';
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
);
$response = $client->listStreamStatistics($domain, $params);
print json_encode($response);
查询所有Domain的总流量
代码示例如下:
//指定参数params
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"timeInterval" => "MID_TERM",
);
$response = $client->getAllDomainTrafficStatistics($params);
print json_encode($response);
查询特定Domain的流量
代码示例如下:
//指定Domain, 参数params
$domain = '<Domain_Name>';
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"timeInterval" => "MID_TERM",
);
$response = $client->getDomainTrafficStatistics($domain, $params);
print json_encode($response);
查询所有Domain的总带宽
代码示例如下:
//指定参数params
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"timeInterval" => "MID_TERM",
);
$response = $client->getAllDomainBandwidthStatistics($params);
print json_encode($response);
查询特定Domain的带宽
代码示例如下:
//指定Domain, 参数params
$domain = '<Domain_Name>';
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"timeInterval" => "MID_TERM",
);
$response = $client->getDomainBandwidthStatistics($domain, $params);
print json_encode($response);
查询所有Domain的总请求数
代码示例如下:
//指定参数params
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"timeInterval" => "MID_TERM",
);
$response = $client->getAllDomainPlayCountStatistics($params);
print json_encode($response);
查询特定Domain的请求数
代码示例如下:
//指定Domain, 参数params
$domain = '<Domain_Name>';
$params = array(
"startTime" => "2016-09-20T08:00:00Z",
"endTime" => "2016-09-21T08:00:00Z",
"timeInterval" => "MID_TERM",
);
$response = $client->getDomainPlayCountStatistics($domain, $params);
print json_encode($response);
查询实时Stream统计数据
查询指定domain、app下所有stream的实时统计数据。仅对streamingStatus=STREAMING的stream有效,否则会报Exception。
代码示例如下:
//指定Domain, App
$domain = '<Domain_Name>';
$app = '<App_Name>';
$response = $client->listRealtimeStreamStatistics($domain, $app);
print json_encode($response);