mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
1、getMediaList接入添加tracks、readerCount字段
2、添加getMediaInfo接口
This commit is contained in:
parent
89b8d461db
commit
fbf0f63503
@ -411,6 +411,14 @@ void installWebApi() {
|
||||
item["vhost"] = media->getVhost();
|
||||
item["app"] = media->getApp();
|
||||
item["stream"] = media->getId();
|
||||
item["readerCount"] = media->readerCount();
|
||||
for(auto &track : media->getTracks()){
|
||||
Value obj;
|
||||
obj["codec_id"] = track->getCodecId();
|
||||
obj["codec_type"] = track->getTrackType();
|
||||
obj["ready"] = track->ready();
|
||||
item["tracks"].append(obj);
|
||||
}
|
||||
val["data"].append(item);
|
||||
});
|
||||
});
|
||||
@ -422,6 +430,26 @@ void installWebApi() {
|
||||
val["online"] = (bool) (MediaSource::find(allArgs["schema"],allArgs["vhost"],allArgs["app"],allArgs["stream"],false));
|
||||
});
|
||||
|
||||
//测试url http://127.0.0.1/index/api/getMediaInfo?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs
|
||||
API_REGIST(api,getMediaInfo,{
|
||||
CHECK_SECRET();
|
||||
CHECK_ARGS("schema","vhost","app","stream");
|
||||
auto src = MediaSource::find(allArgs["schema"],allArgs["vhost"],allArgs["app"],allArgs["stream"],false);
|
||||
if(!src){
|
||||
val["online"] = false;
|
||||
return;
|
||||
}
|
||||
val["online"] = true;
|
||||
val["readerCount"] = src->readerCount();
|
||||
for(auto &track : src->getTracks()){
|
||||
Value obj;
|
||||
obj["codec_id"] = track->getCodecId();
|
||||
obj["codec_type"] = track->getTrackType();
|
||||
obj["ready"] = track->ready();
|
||||
val["tracks"].append(obj);
|
||||
}
|
||||
});
|
||||
|
||||
//主动关断流,包括关断拉流、推流
|
||||
//测试url http://127.0.0.1/index/api/close_stream?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs&force=1
|
||||
API_REGIST(api,close_stream,{
|
||||
|
Loading…
Reference in New Issue
Block a user