Skip to content

MediaServer类接口说明

chatop2020 edited this page Apr 25, 2021 · 28 revisions

MediaServer类接口说明


接口索引

序号 接口名称 说明
1 GetMediaServerList 获取MediaServer列表 👍
2 GetMediaServerByMediaServerId 根据MediaSeverId获取MediaServer信息
3 GetWaitForActiveVideoChannelList 获取未激活的音视频流通道列表👍
4 ActiveVideoChannel 激活音视频流通道👍
5 AddVideoChannel 添加一个音视频通道👍
6 ModifyVideoChannel 修改音视频通道参数👍
7 DeleteVideoChannel 删除一个音视频通道👍
8 GetVideoChannelList 获取音视频通道列表👍
9 MediaServerOpenRtpPort 申请开放一个RtpServer
10 GetOnlineStreamInfoList 获取在线流信息👍
11 GetRecordFileList 获取录像文件列表👍
12 SoftDeleteRecordFile 软删除一个录制文件👍
13 RestoreSoftDeleteRecordFile 恢复被软删除的录制文件👍
14 DeleteRecordFile 删除一个录制文件👍
15 DeleteRecordFileList 立即删除一批录制文件
16 SoftDeleteRecordFileList 软删除一批录制文件
17 StartRecord 启动音视频流文件录制
18 StopRecord 停止音视频流文件录制
19 AddStreamProxy 使用内置流代理器拉一个音视频流
20 AddFFmpegStreamProxy 使用FFmpeg流代理器拉一个音视频流
21 StreamLive 推/拉一个音视频流👍
22 StreamStop 停止一个音视频流👍
23 CutOrMergeVideoFile 添加裁剪合并任务👍
24 GetMergeTaskStatus 获取裁剪合并任务的进度👍
25 GetBacklogTaskList 获取裁剪合并任务的积压列表

GetMediaServerList 获取MediaServer列表

  • 作用:获取所有的在线流媒体服务器信息,同时包含ZLMediaKit及AKStreamKeeper的重要信息;AKStreamKeeper启动时,会同时启动ZLMediaKit进程,获取ZLMediaKit的信息加上AKStreamKeeper自己的信息组合成与AKStreamWeb的心跳包,定时发给AKStreamWeb的MediaServerKeepAlive接口,此接口收到数据后,更新内部的MediaServerList列表,本接口数据来源于此内部MediaServerList列表
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:空
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/GetMediaServerList" -H  "accept: text/plain" -H  "AccessKey: 鉴权密钥"

  • 返回参数:
[//请注意,这是列表,以下是单个MediaServer的结构
  {
    "ipV4Address": "192.168.2.27",//流媒体服务器的ip地址,此ip地址是来原于AKStreamKeeper的配置文件中的IpV4地址    "ipV6Address": "fe80::3c88:8fd:60dc:d9a7%2",//流媒体服务器的ip地址,此ip地址是来原于AKStreamKeeper的配置文件中的IpV6地址 
    "keeperPort": 6880,//AKStreamKeeper的webapi监听端口 
    "secret": "035c73f7-bb6b-4889-a715-d9eb2d1925cc",//zlmediakit的webpai鉴权key
    "mediaServerId": "cjyo4hOBXQWARzm2",//zlmediakit的唯一id
    "zlmediakitPid": 8491,//zlmediakit的pid
    "keepAliveTime": "2021-01-12 15:39:20",//心跳时间
    "recordPathList": [//这是一个列表,包含了多个可用于保存录制文件的路径,此列表来源于AKStreamKeeper配置文件里的CustomRecordPathList字段的值,AKStreamKeeper间隔刷新此字段中的相关存储容量,以确定路径所对应存储的可用空间;在调用AKStreamWeb的录制接口时会根据各路径实际可用容量的大少来选择使用哪个路径来保存录制视频
      {
        "key": 513413226496,//可用容量(bytes)
        "value": "/home/cdtnb/disk"//存储路径
      },
      {
        "key": 211322982400,
        "value": "/home/cdtnb/innerDisk"
      }
    ],
    "rtpPortMin": 10001,//指定了ZLMediakit接受rtp流的端口最低位
    "rtpPortMax": 20000,/指定了ZLMediakit接受rtp流的端口最高位
    //rtpPortMin,rtpPortMax是rtp端口范围,由AKStream来管理,AKStream在接到Sip推流接口调用时,会在这个端口范围内顺序的获取一个端口,并确定它没被使用,然后向ZLMediaKit申请开放此端口的RtpServer,ZLMediaKit收到OpenRtpServer请求后,将开启请求的Rtp端口,并等待rtp流的到来,如果长时间无流,就会关闭此RtpServer
    "performanceInfo": {//流媒体服务器(AKStreamKeeper所在机服务器)的性能参数
      "systemType": "Unix",//系统类型
      "architecture": "64-bit",//架构
      "osName": "Linux 3.10.0-1160.11.1.el7.x86_64",//操作系统名称
      "frameworkVersion": "3.1",//.net core版本
      "cpuCores": 4,//cpu核心数量
      "memoryInfo": {//内存信息
        "total": 8201199616,//内存总大小(byte)
        "used": 1132335104,//已使用大小
        "free": 7068864512,//可用大小
        "freePercent": 86.193,//空闲率
        "updateTime": "2021-01-12 15:39:05"//更新时间
      },
      "cpuLoad": 1.5,//cpu占用率 %
      "netWorkStat": {//网络信息
        "mac": "00-0C-29-D3-EE-FA",//活动的mac地址
        "totalSendBytes": 19318415,//总流出(byte)
        "totalRecvBytes": 1600256656,//总流入(byte)
        "currentSendBytes": 1917,//上一秒流出
        "currentRecvBytes": 1303602,//上一秒流入
        "updateTime": "2021-01-12 15:39:10"//更新时间
      },
      "driveInfo": [//磁盘信息
        {
          "name": "/dev",//磁盘名称(路径)
          "isReady": true,//是否就绪
          "total": 4088492032,//总大小(byte)
          "used": 0,//已使用
          "free": 4088492032,//可使用
          "freePercent": 100,//空闲率 %
          "updateTime": "2021-01-12 15:37:35"//更新时间
        },
        {
          "name": "/dev/shm",
          "isReady": true,
          "total": 4100599808,
          "used": 0,
          "free": 4100599808,
          "freePercent": 100,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/run",
          "isReady": true,
          "total": 4100599808,
          "used": 9289728,
          "free": 4091310080,
          "freePercent": 99.773,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/sys/fs/cgroup",
          "isReady": true,
          "total": 4100599808,
          "used": 0,
          "free": 4100599808,
          "freePercent": 100,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/",
          "isReady": true,
          "total": 53660876800,
          "used": 2789580800,
          "free": 50871296000,
          "freePercent": 94.801,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/boot",
          "isReady": true,
          "total": 1063256064,
          "used": 202600448,
          "free": 860655616,
          "freePercent": 80.945,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/home",
          "isReady": true,
          "total": 211549622272,
          "used": 226639872,
          "free": 211322982400,
          "freePercent": 99.893,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/home/cdtnb/disk",
          "isReady": true,
          "total": 540993314816,
          "used": 27580088320,
          "free": 513413226496,
          "freePercent": 94.902,
          "updateTime": "2021-01-12 15:37:35"
        },
        {
          "name": "/run/user/0",
          "isReady": true,
          "total": 820121600,
          "used": 0,
          "free": 820121600,
          "freePercent": 100,
          "updateTime": "2021-01-12 15:37:35"
        }
      ],
      "updateTime": "2021-01-12 15:39:10"//性能信息的总更新时间
    },
    "isKeeperRunning": true,//AKStreamKeeper是否正在运行
    "isMediaServerRunning": true,//ZLMediaKit是否正在运行
    "useSsl": false,//ZLMediaKit是否启用SSL,此参数在AKStreamKeeper的配置文件中配置
    "httpsPort": 443,//ZLMediaKit的https端口(自动从config.ini文件中获取,下同)
    "rtmpsPort": 19350,//rtmps端口
    "rtspsPort": 332,//rtsps端口
    "httpPort": 80,//http端口
    "rtmpPort": 1935,//rtmp端口
    "rtspPort": 554,//rtsp端口
    "zlmRecordFileSec": 3600,//ZLMediaKit的录制文件分片时间
    "accessKey": "6V38R43V-9R6Y14G1-1N6T9EZY-QD4WNCYI-S18U4J20-NJZBMM41",//AKStreamKeeper的AccessKey鉴权密钥
    "serverDateTime": "2021-01-12 15:39:10",//AKStreamKeeper所在服务器的时间
    "config": {//ZLMedaiKit的配置文件,具体见https://github.com/xia-chu/ZLMediaKit/blob/master/conf/config.ini
      "data": [
        {
          "api.apiDebug": "1",
          "api.defaultSnap": "./www/logo.png",
          "api.secret": "035c73f7-bb6b-4889-a715-d9eb2d1925cc",
          "api.snapRoot": "./www/snap/",
          "ffmpeg.bin": "/usr/bin/ffmpeg",
          "ffmpeg.cmd": "%s -re -i %s -vcodec copy -acodec copy -f flv -y  %s",
          "ffmpeg.log": "./ffmpeg/ffmpeg.log",
          "ffmpeg.snap": "%s -i %s -y -f mjpeg -t 0.001 %s",
          "general.addMuteAudio": "1",
          "general.enableVhost": "0",
          "general.flowThreshold": 1,
          "general.fmp4_demand": "0",
          "general.hls_demand": "0",
          "general.maxStreamWaitMS": 15000,
          "general.mediaServerId": "cjyo4hOBXQWARzm2",
          "general.mergeWriteMs": 0,
          "general.modifyStamp": "0",
          "general.publishToHls": "1",
          "general.publishToMp4": "0",
          "general.resetWhenRePlay": "1",
          "general.rtmp_demand": "0",
          "general.rtsp_demand": "0",
          "general.streamNoneReaderDelayMS": 20000,
          "general.ts_demand": "0",
          "hls.broadcastRecordTs": "0",
          "hls.fileBufSize": 65536,
          "hls.filePath": "./www",
          "hls.segDur": 2,
          "hls.segNum": 3,
          "hls.segRetain": 5,
          "hook.admin_params": "secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc",
          "hook.enable": "1",
          "hook.on_flow_report": "http://127.0.0.1:5800/MediaServer/WebHook/OnFlowReport",
          "hook.on_http_access": "",
          "hook.on_play": "http://127.0.0.1:5800/MediaServer/WebHook/OnPlay",
          "hook.on_publish": "http://127.0.0.1:5800/MediaServer/WebHook/OnPublish",
          "hook.on_record_mp4": "http://127.0.0.1:5800/MediaServer/WebHook/OnRecordMp4",
          "hook.on_record_ts": "http://127.0.0.1:5800/MediaServer/WebHook/OnRecordTs",
          "hook.on_rtsp_auth": "",
          "hook.on_rtsp_realm": "",
          "hook.on_server_started": "",
          "hook.on_shell_login": "http://127.0.0.1:5800/MediaServer/WebHook/OnShellLogin",
          "hook.on_stream_changed": "http://127.0.0.1:5800/MediaServer/WebHook/OnStreamChanged",
          "hook.on_stream_none_reader": "http://127.0.0.1:5800/MediaServer/WebHook/OnStreamNoneReader",
          "hook.on_stream_not_found": "",
          "hook.timeoutSec": 5,
          "http.charSet": "utf-8",
          "http.dirMenu": "1",
          "http.keepAliveSecond": 15,
          "http.maxReqSize": 4096,
          "http.notFound": "<html><head><title>404 Not Found</title></head><body bgcolor=\"white\"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit-5.0(build in Jan 12 2021 12:45:58)</center></body></html>",
          "http.port": 80,
          "http.rootPath": "./www",
          "http.sendBufSize": 65536,
          "http.sslport": 443,
          "multicast.addrMax": "239.255.255.255",
          "multicast.addrMin": "239.0.0.0",
          "multicast.udpTTL": 64,
          "record.appName": "record",
          "record.fastStart": "0",
          "record.fileBufSize": 65536,
          "record.filePath": "./www",
          "record.fileRepeat": "0",
          "record.fileSecond": 3600,
          "record.sampleMS": 500,
          "rtmp.handshakeSecond": 15,
          "rtmp.keepAliveSecond": 15,
          "rtmp.modifyStamp": "0",
          "rtmp.port": 1935,
          "rtmp.sslport": 19350,
          "rtp.audioMtuSize": 600,
          "rtp.clearCount": 10,
          "rtp.cycleMS": 46800000,
          "rtp.maxRtpCount": 50,
          "rtp.videoMtuSize": 1400,
          "rtp_proxy.checkSource": "1",
          "rtp_proxy.dumpDir": "",
          "rtp_proxy.port": 10000,
          "rtp_proxy.timeoutSec": 15,
          "rtsp.authBasic": "0",
          "rtsp.directProxy": "1",
          "rtsp.handshakeSecond": 15,
          "rtsp.keepAliveSecond": 15,
          "rtsp.port": 554,
          "rtsp.sslport": 332,
          "shell.maxReqSize": 1024,
          "shell.port": 9000
        }
      ],
      "code": 0
    },
    "mediaServerPlayerList": []//播放者列表,现在没有作用
  }
]

GetMediaServerByMediaServerId 根据MediaSeverId获取MediaServer信息

  • 作用:此接口获取数据与GetMediaServerList一样,按MediaServerId来获取MediaServerList列表中的一个MediaServer实例信息
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
    mediaServerId //此ID是MediaServerId
    
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/GetMediaServerByMediaServerId?mediaServerId=cjyo4hOBXQWARzm2" -H  "accept: text/plain" -H  "AccessKey: 鉴权密钥"

  • 返回参数:
{//返回数据详细解释见GetMediaServerList接口
  "ipV4Address": "192.168.2.27",
  "ipV6Address": "fe80::3c88:8fd:60dc:d9a7%2",
  "keeperPort": 6880,
  "secret": "035c73f7-bb6b-4889-a715-d9eb2d1925cc",
  "mediaServerId": "cjyo4hOBXQWARzm2",
  "zlmediakitPid": 8491,
  "keepAliveTime": "2021-01-12 16:26:20",
  "recordPathList": [
    {
      "key": 513413242880,
      "value": "/home/cdtnb/disk"
    },
    {
      "key": 211322765312,
      "value": "/home/cdtnb/innerDisk"
    }
  ],
  "rtpPortMin": 10001,
  "rtpPortMax": 20000,
  "performanceInfo": {
    "systemType": "Unix",
    "architecture": "64-bit",
    "osName": "Linux 3.10.0-1160.11.1.el7.x86_64",
    "frameworkVersion": "3.1",
    "cpuCores": 4,
    "memoryInfo": {
      "total": 8201199616,
      "used": 1192587264,
      "free": 7008612352,
      "freePercent": 85.458,
      "updateTime": "2021-01-12 16:26:16"
    },
    "cpuLoad": 1.8,
    "netWorkStat": {
      "mac": "00-0C-29-D3-EE-FA",
      "totalSendBytes": 32767210,
      "totalRecvBytes": 6436952972,
      "currentSendBytes": 1186,
      "currentRecvBytes": 1865969,
      "updateTime": "2021-01-12 16:26:19"
    },
    "driveInfo": [
      {
        "name": "/dev",
        "isReady": true,
        "total": 4088492032,
        "used": 0,
        "free": 4088492032,
        "freePercent": 100,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/dev/shm",
        "isReady": true,
        "total": 4100599808,
        "used": 0,
        "free": 4100599808,
        "freePercent": 100,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/run",
        "isReady": true,
        "total": 4100599808,
        "used": 17678336,
        "free": 4082921472,
        "freePercent": 99.569,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/sys/fs/cgroup",
        "isReady": true,
        "total": 4100599808,
        "used": 0,
        "free": 4100599808,
        "freePercent": 100,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/",
        "isReady": true,
        "total": 53660876800,
        "used": 2789580800,
        "free": 50871296000,
        "freePercent": 94.801,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/boot",
        "isReady": true,
        "total": 1063256064,
        "used": 202600448,
        "free": 860655616,
        "freePercent": 80.945,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/home",
        "isReady": true,
        "total": 211549622272,
        "used": 227319808,
        "free": 211322302464,
        "freePercent": 99.893,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/home/cdtnb/disk",
        "isReady": true,
        "total": 540993314816,
        "used": 27580071936,
        "free": 513413242880,
        "freePercent": 94.902,
        "updateTime": "2021-01-12 16:25:36"
      },
      {
        "name": "/run/user/0",
        "isReady": true,
        "total": 820121600,
        "used": 0,
        "free": 820121600,
        "freePercent": 100,
        "updateTime": "2021-01-12 16:25:36"
      }
    ],
    "updateTime": "2021-01-12 16:26:19"
  },
  "isKeeperRunning": true,
  "isMediaServerRunning": true,
  "useSsl": false,
  "httpsPort": 443,
  "rtmpsPort": 19350,
  "rtspsPort": 332,
  "httpPort": 80,
  "rtmpPort": 1935,
  "rtspPort": 554,
  "zlmRecordFileSec": 3600,
  "accessKey": "6V38R43V-9R6Y14G1-1N6T9EZY-QD4WNCYI-S18U4J20-NJZBMM41",
  "serverDateTime": "2021-01-12 16:26:20",
  "config": {
    "data": [
      {
        "api.apiDebug": "1",
        "api.defaultSnap": "./www/logo.png",
        "api.secret": "035c73f7-bb6b-4889-a715-d9eb2d1925cc",
        "api.snapRoot": "./www/snap/",
        "ffmpeg.bin": "/usr/bin/ffmpeg",
        "ffmpeg.cmd": "%s -re -i %s -vcodec copy -acodec copy -f flv -y  %s",
        "ffmpeg.log": "./ffmpeg/ffmpeg.log",
        "ffmpeg.snap": "%s -i %s -y -f mjpeg -t 0.001 %s",
        "general.addMuteAudio": "1",
        "general.enableVhost": "0",
        "general.flowThreshold": 1,
        "general.fmp4_demand": "0",
        "general.hls_demand": "0",
        "general.maxStreamWaitMS": 15000,
        "general.mediaServerId": "cjyo4hOBXQWARzm2",
        "general.mergeWriteMs": 0,
        "general.modifyStamp": "0",
        "general.publishToHls": "1",
        "general.publishToMp4": "0",
        "general.resetWhenRePlay": "1",
        "general.rtmp_demand": "0",
        "general.rtsp_demand": "0",
        "general.streamNoneReaderDelayMS": 20000,
        "general.ts_demand": "0",
        "hls.broadcastRecordTs": "0",
        "hls.fileBufSize": 65536,
        "hls.filePath": "./www",
        "hls.segDur": 2,
        "hls.segNum": 3,
        "hls.segRetain": 5,
        "hook.admin_params": "secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc",
        "hook.enable": "1",
        "hook.on_flow_report": "http://127.0.0.1:5800/MediaServer/WebHook/OnFlowReport",
        "hook.on_http_access": "",
        "hook.on_play": "http://127.0.0.1:5800/MediaServer/WebHook/OnPlay",
        "hook.on_publish": "http://127.0.0.1:5800/MediaServer/WebHook/OnPublish",
        "hook.on_record_mp4": "http://127.0.0.1:5800/MediaServer/WebHook/OnRecordMp4",
        "hook.on_record_ts": "http://127.0.0.1:5800/MediaServer/WebHook/OnRecordTs",
        "hook.on_rtsp_auth": "",
        "hook.on_rtsp_realm": "",
        "hook.on_server_started": "",
        "hook.on_shell_login": "http://127.0.0.1:5800/MediaServer/WebHook/OnShellLogin",
        "hook.on_stream_changed": "http://127.0.0.1:5800/MediaServer/WebHook/OnStreamChanged",
        "hook.on_stream_none_reader": "http://127.0.0.1:5800/MediaServer/WebHook/OnStreamNoneReader",
        "hook.on_stream_not_found": "",
        "hook.timeoutSec": 5,
        "http.charSet": "utf-8",
        "http.dirMenu": "1",
        "http.keepAliveSecond": 15,
        "http.maxReqSize": 4096,
        "http.notFound": "<html><head><title>404 Not Found</title></head><body bgcolor=\"white\"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit-5.0(build in Jan 12 2021 12:45:58)</center></body></html>",
        "http.port": 80,
        "http.rootPath": "./www",
        "http.sendBufSize": 65536,
        "http.sslport": 443,
        "multicast.addrMax": "239.255.255.255",
        "multicast.addrMin": "239.0.0.0",
        "multicast.udpTTL": 64,
        "record.appName": "record",
        "record.fastStart": "0",
        "record.fileBufSize": 65536,
        "record.filePath": "./www",
        "record.fileRepeat": "0",
        "record.fileSecond": 3600,
        "record.sampleMS": 500,
        "rtmp.handshakeSecond": 15,
        "rtmp.keepAliveSecond": 15,
        "rtmp.modifyStamp": "0",
        "rtmp.port": 1935,
        "rtmp.sslport": 19350,
        "rtp.audioMtuSize": 600,
        "rtp.clearCount": 10,
        "rtp.cycleMS": 46800000,
        "rtp.maxRtpCount": 50,
        "rtp.videoMtuSize": 1400,
        "rtp_proxy.checkSource": "1",
        "rtp_proxy.dumpDir": "",
        "rtp_proxy.port": 10000,
        "rtp_proxy.timeoutSec": 15,
        "rtsp.authBasic": "0",
        "rtsp.directProxy": "1",
        "rtsp.handshakeSecond": 15,
        "rtsp.keepAliveSecond": 15,
        "rtsp.port": 554,
        "rtsp.sslport": 332,
        "shell.maxReqSize": 1024,
        "shell.port": 9000
      }
    ],
    "code": 0
  },
  "mediaServerPlayerList": []
}

GetWaitForActiveVideoChannelList 获取未激活的音视频流通道列表

  • 作用:用于获取还未激活的音视频通道列表,GB28181设备注册上线时,AKStream的Sip网关会通过GB28181国标信令协议向设备发起目录查询,设备在收到目录查询请求后将设备的目录返馈给Sip网关,Sip网关根据目录类型自动找出适合音视频推流的通道,并将其加入到数据库中。而这类自动加入到数据库中的音视频通道属于未激活通道,需要人工干预激活它们,才可以进行后续的各种功能与流程操作。此接口支持分页,分页页码从1开始
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
 {
  "pageIndex": 1,//分页页码,从1开始
  "pageSize": 10,//每页数量
  "orderBy": [//排序规则列表,可以多个排序规则
    {
      "fieldName": "id",//排序字段,具体字段详见数据库说明章节
      "orderByDir": 0//排序方法 0=ASC 1=DESC
    }
  ]
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/GetWaitForActiveVideoChannelList" -H  "accept: text/plain" -H  "AccessKey: key" -H  "Content-Type: application/json-patch+json" -d "{\"pageIndex\":1,\"pageSize\":10,\"orderBy\":[{\"fieldName\":\"id\",\"orderByDir\":0}]}"

  • 返回参数:
{
  "videoChannelList": [//注意这是一个列表,以下是对象结构
    {
      "id": 3,//数据库id(主键)
      "mainId": "23755585",//此音视频通道的唯一id,这个由内部算法决定,不能修改它
      "mediaServerId": "unknown_server_9918222123311",//服务器id,未激活的通道此字段将以unknown_server开头,表示未知的MediaServerId,在激活此通道时需要指定一个MediaServerId,以确定此音视频流通道归属于哪个流媒体服务器
      "vhost": "__defaultVhost__",//vhost值,在没有引入域名时,请保持__defaultVhost__
      "app": "rtp",//gb28181国标流,必须是rtp
      "channelName": "Camera 02",//音视频通道的名称,可以自己指定
      "departmentId": "330200",//部门代码(可空)
      "departmentName": "宁波",//部门名称(可空)
      "pDepartmentId": "330200",//上级部门代码(可空)
      "pDepartmentName": "宁波",//上级部门名称,如果无上级部门,pDepartmentId与pDepartmentName请保持与部门代码,部门名称一致(可空)
      "deviceNetworkType": "Fixed",//设备的网络类型,Fixed=固定的,Mobile=移动的
      "deviceStreamType": "GB28181",//设备的流类型 GB28181, Rtsp, Http,Rtmp 可选 
      "methodByGetStream": "None",//非GB28181设备拉流方法,GB28181下必须是None
      "videoDeviceType": "NVR",//设备类型,NVR,IPC,DVR,UNKNOW可选 
      "autoVideo": true,//是否自动推拉流标记
      "autoRecord": true,//是否自动录制标记
      "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
      "ipV4Address": "192.168.2.75",//设备ipv4地址
      "ipV6Address": "::ffff:192.168.2.75",设备ipv6地址
      "hasPtz": false,//设备是否有云台
      "deviceId": "34020000001110000001",//gb28181设备的设备id
      "channelId": "34020000001320000010",//gb28181设备的通道id
      "rtpWithTcp": false,//是否采用tcp方式推rtp流
      "defaultRtpPort": false,//是否采用默认rtp端口(zlmediakit的10000端口)来接收rtp流,一般为否
      "createTime": "2021-01-12 15:05:57",//通道的创建时间
      "updateTime": "2021-01-12 15:23:47",//通道的更新时间
      "enabled": false,//通道是否被激活(启用)
      "noPlayerBreak": false//无人观看这个通道时是否断开通道推拉流
    }
  ],
  "request": {//你请求时的结构,用于分页
    "pageIndex": 1,
    "pageSize": 10,
    "orderBy": [
      {
        "fieldName": "id",
        "orderByDir": "ASC"
      }
    ]
  },
  "total": 1//查到记录的总数,用于分页
}

ActiveVideoChannel 激活音视频流通道

  • 作用:用于激活某个音视频流通道,只有激活的音视频通道才能获得AKStream赋予的各类功能。激活的目的主要是因为确定某个音视频流归属于哪个流媒体服务器,在此同时也可以初始化这个音视频通道的相关信息
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • mainId //数据库中通道的mainId
  • 对象结构
 {
  "mediaServerId": "cjyo4hOBXQWARzm2",//指定流媒体服务器id
  "app": "rtp",//指定rtp
  "vhost": "__defaultVhost__",//指定__defaultVhost__
  "channelName": "我是一个激活状态的通道",//写一个自己认识的名字
  "departmentId": "string",//AKStream中,可空参数时,字符串参数为string,或null,或“”时都表示不更新此字段,因此写string则不会更新此字段
  "departmentName": "string",//不做更新
  "pDepartmentId": "string",//不做更新
  "pDepartmentName": "string",//不做更新
  "deviceNetworkType": "Fixed",
  "videoDeviceType": "NVR",//AKStream中枚举类型的字段可以传枚举的String也可以传枚举的值,比如这个字段传NVR或传0的效果是一样的
  "autoVideo": true,//要求自动推拉流,系统会自动推拉这个流
  "autoRecord": true,//要求自动录制流视频文件,系统会自动对它进行录制
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "recordPlanName": "string",//不做更新
  "ipV4Address": "string",//不做更新
  "ipV6Address": "string",//不做更新
  "hasPtz": false,//没有云台,不需要控制
  "rtpWithTcp": false,//不使用tcp方式推拉流
  "defaultRtpPort": false,//不使用默认rtp端口,使用端口范围内的某个端口进行推拉流
  "noPlayerBreak": false//没人观看时不断流
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/ActiveVideoChannel?mainId=23755585" -H  "accept: text/plain" -H  "AccessKey: key" -H  "Content-Type: application/json-patch+json" -d "{\"mediaServerId\":\"cjyo4hOBXQWARzm2\",\"app\":\"rtp\",\"vhost\":\"__defaultVhost__\",\"channelName\":\"我是一个激活状态的通道\",\"departmentId\":\"string\",\"departmentName\":\"string\",\"pDepartmentId\":\"string\",\"pDepartmentName\":\"string\",\"deviceNetworkType\":\"Fixed\",\"videoDeviceType\":\"NVR\",\"autoVideo\":true,\"autoRecord\":true,\"recordPlanName\":\"string\",\"ipV4Address\":\"string\",\"ipV6Address\":\"string\",\"hasPtz\":false,\"rtpWithTcp\":false,\"defaultRtpPort\":false,\"noPlayerBreak\":false}"


  • 返回参数:
{
  "id": 3,
  "mainId": "23755585",
  "mediaServerId": "cjyo4hOBXQWARzm2",
  "vhost": "__defaultVhost__",
  "app": "rtp",
  "channelName": "我是一个激活状态的通道",
  "departmentId": "330200",
  "departmentName": "宁波",
  "pDepartmentId": "330200",
  "pDepartmentName": "宁波",
  "deviceNetworkType": "Fixed",
  "deviceStreamType": "GB28181",
  "methodByGetStream": "None",
  "videoDeviceType": "NVR",
  "autoVideo": true,
  "autoRecord": true,
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "ipV4Address": "192.168.2.75",
  "ipV6Address": "::ffff:192.168.2.75",
  "hasPtz": false,
  "deviceId": "34020000001110000001",
  "channelId": "34020000001320000010",
  "rtpWithTcp": false,
  "defaultRtpPort": false,
  "createTime": "2021-01-12 15:05:57",
  "updateTime": "2021-01-12 17:05:37",
  "enabled": true,
  "noPlayerBreak": false
}

/MediaServer/AddVideoChannel

AddVideoChannel 添加一个音视频通道

  • 作用:添加一个音视频通道,可以是GB28181也可以是其他形式的音视频通道,由于GB28181的音视频通道会在设备注册上线时自动添加,因此此接口主要用于添加非GB28181音视频通道
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • 对象结构
 {
  "mediaServerId": "cjyo4hOBXQWARzm2",//指定流媒体服务器id
  "app": "rtsp",//指定app,随意指定即可
  "vhost": "__vhostDefault__",//没有域名引入的情况下,保持__vhostDefault__
  "channelName": "我是rtsp流",//定一个自己认识的名字
  "departmentId": "330206",//部门代码
  "departmentName": "北仑",
  "pDepartmentId": "330200",//上级部门代码
  "pDepartmentName": "宁波",
  "deviceNetworkType": "Fixed",
  "deviceStreamType": "RTSP",//流类型是rtsp
  "methodByGetStream": "SelfMethod",//使用内置流代理器来拉这个流
  "videoDeviceType": "IPC",//设备类型是ipc
  "autoVideo": false,//不要自动拉流,通过StreamLive接口手动发起
  "autoRecord": false,//不要自动录制,通过RecordStart接口手动发起
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "recordPlanName": "string",//录制计划没有,留空或写null或写string都是不设置不更新的意思
  "ipV4Address": "192.168.2.164",//ipc的ip地址
  "ipV6Address": "string",//ipv6,不知道不设置,写string即可
  "hasPtz": false,//没有云台
  "deviceId": "string",//不是gb28181通道,这个不用写,写string即可
  "channelId": "string",//不是gb28181通道,这个不用写,写string即可
  "rtpWithTcp": false,//这个很关键,设置成true,对使用内置拉流器拉rtsp流更友好,设置成flase则使用udp拉流
  "videoSrcUrl": "rtsp://192.168.2.164/LiveMedia/ch1/Media1",//流的源地址,拉流器从这个地址拉取音视频流
  "defaultRtpPort": false,//对于非gb28181设备,这个字段没有意义 
  "enabled": true,//是否激活(启用)状态
  "noPlayerBreak": true//没人看时断流
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/AddVideoChannel" -H  "accept: text/plain" -H  "AccessKey: key" -H  "Content-Type: application/json-patch+json" -d "{\"mediaServerId\":\"cjyo4hOBXQWARzm2\",\"app\":\"rtsp\",\"vhost\":\"__vhostDefault__\",\"channelName\":\"我是rtsp流\",\"departmentId\":\"330206\",\"departmentName\":\"北仑\",\"pDepartmentId\":\"330200\",\"pDepartmentName\":\"宁波\",\"deviceNetworkType\":\"Fixed\",\"deviceStreamType\":\"RTSP\",\"methodByGetStream\":\"SelfMethod\",\"videoDeviceType\":\"IPC\",\"autoVideo\":false,\"autoRecord\":false,\"recordPlanName\":\"string\",\"ipV4Address\":\"192.168.2.164\",\"ipV6Address\":\"string\",\"hasPtz\":false,\"deviceId\":\"string\",\"channelId\":\"string\",\"rtpWithTcp\":false,\"videoSrcUrl\":\"rtsp://192.168.2.164/LiveMedia/ch1/Media1\",\"defaultRtpPort\":false,\"enabled\":true,\"noPlayerBreak\":true}"

  • 返回参数:
{
  "id": 6,
  "mainId": "373D9AEA",
  "mediaServerId": "cjyo4hOBXQWARzm2",
  "vhost": "__vhostDefault__",
  "app": "rtsp",
  "channelName": "我是rtsp流",
  "departmentId": "330206",
  "departmentName": "北仑",
  "pDepartmentId": "330200",
  "pDepartmentName": "宁波",
  "deviceNetworkType": "Fixed",
  "deviceStreamType": "Rtsp",
  "methodByGetStream": "SelfMethod",
  "videoDeviceType": "IPC",
  "autoVideo": false,
  "autoRecord": false,
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "ipV4Address": "192.168.2.164",
  "hasPtz": false,
  "rtpWithTcp": false,
  "videoSrcUrl": "rtsp://192.168.2.164/LiveMedia/ch1/Media1",
  "defaultRtpPort": false,
  "createTime": "2021-01-12 17:20:07",
  "updateTime": "2021-01-12 17:20:07",
  "enabled": true,
  "noPlayerBreak": true
}

ModifyVideoChannel 修改音视频通道参数

  • 作用:修改一个音视频通道的参数,字符串类型字段设备为空,null,或者string为不更新此字段,其他限制条件与AddVideoChannel接口一样
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • mainId, 指定的是要对哪个音视频通道进行修改,mainId为音视频通道在数据库中的唯一id
  • 对象结构
 {
  "app": "rtsp_app", //修改了这个参数为rtsp_app
  "vhost": "string", //设置为string表示不修改,保持原值
  "channelName": "string",
  "departmentId": "string",
  "departmentName": "string",
  "pDepartmentId": "string",
  "pDepartmentName": "string",
  "deviceNetworkType": 0,
  "videoDeviceType": 0,
  "autoVideo": true,
  "autoRecord": true,
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "recordPlanName": "string",
  "ipV4Address": "string",
  "ipV6Address": "string",
  "hasPtz": true,
  "rtpWithTcp": true,
  "defaultRtpPort": true,
  "noPlayerBreak": true,
  "enable": false,
  "mediaServerId": "string",
  "deviceStreamType": "Http",//修改了deviceStreamType值
  "methodByGetStream": 0,
  "videoSrcUrl": "http://127.0.0.1:8899/live/f.flv", //修改了videoSrcUrl值
  "deviceId": "string",
  "channelId": "string"
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/ModifyVideoChannel?mainId=9220C26B" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "{\"app\":\"rtsp_app\",\"vhost\":\"string\",\"channelName\":\"string\",\"departmentId\":\"string\",\"departmentName\":\"string\",\"pDepartmentId\":\"string\",\"pDepartmentName\":\"string\",\"deviceNetworkType\":0,\"videoDeviceType\":0,\"autoVideo\":true,\"autoRecord\":true,\"recordPlanName\":\"string\",\"ipV4Address\":\"string\",\"ipV6Address\":\"string\",\"hasPtz\":true,\"rtpWithTcp\":true,\"defaultRtpPort\":true,\"noPlayerBreak\":true,\"enable\":false,\"mediaServerId\":\"string\",\"deviceStreamType\":\"Http\",\"methodByGetStream\":0,\"videoSrcUrl\":\"http://127.0.0.1:8899/live/f.flv\",\"deviceId\":\"string\",\"channelId\":\"string\"}"

  • 返回参数:
{
  "id": 7,
  "mainId": "9220C26B",
  "mediaServerId": "cjyo4hOBXQWARzm2",
  "vhost": "__defaultVhost__",
  "app": "rtsp_app", //此字段已经修改
  "channelName": "我会被删除",
  "deviceNetworkType": "Mobile",
  "deviceStreamType": "Http",
  "methodByGetStream": "SelfMethod",
  "videoDeviceType": "IPC",
  "autoVideo": true,
  "autoRecord": true,
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "ipV4Address": "127.0.0.1",
  "hasPtz": true,
  "rtpWithTcp": true,
  "videoSrcUrl": "http://127.0.0.1:8899/live/f.flv", //此字段已经修改
  "defaultRtpPort": true,
  "createTime": "2021-01-16 22:32:59",
  "updateTime": "2021-01-16 22:34:21",
  "enabled": false,
  "noPlayerBreak": true
}

DeleteVideoChannel 删除一个音视频通道

  • 作用:删除一个音视频通道的参数,删除成功后此通道的所有数据将从数据库中删除
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mainId, 指定的是要对哪个音视频通道进行删除,mainId为音视频通道在数据库中的唯一id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/DeleteVideoChannel?mianId=9220C26B" -H  "accept: text/plain"

  • 返回参数:

bool:true/false true表示成功,false表示失败

GetVideoChannelList 获取音视频通道列表

  • 作用:获取数据库中的音视频通道列表,支持分页,支持多列排序,条件字段为全表字段,可自由组合查询,同时对可能用到的模糊条件提供模糊匹配条件,支持下级部门数据查询
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • 对象结构
{
  "pageIndex": 0,//分页参数,页码从1开始,不需要分页,则不要传pageIndex,pageSize
  "pageSize": 0,//每页行数
  "orderBy": [//排序列,可以多个列
    {
      "fieldName": "string",//排序字段
      "orderByDir": 0//排序方法 0=ASC 1=DESC
    }
  ],
  "id": 0, //条件字段,传则根据这个字段条件查询,不传则不拼接查询此条件
  "mainId": "string", //如果字符串字段,传空,null,string或不传则都不会拼接此条件,传值则说明根据此字段内容进行条件拼接并查询
  "app": "string",
  "vhost": "string",
  "mediaServerId": "string",
  "channelName": "string",
  "departmentId": "string",
  "departmentName": "string",
  "pDepartmentId": "string",
  "pDepartmentName": "string",
  "deviceNetworkType": 0,
  "deviceStreamType": 0,
  "methodByGetStream": 0,
  "videoDeviceType": 0,
  "autoVideo": true,
  "autoRecord": true,
  "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
  "recordPlanName": "string",
  "ipV4Address": "string",
  "ipV6Address": "string",
  "hasPtz": true,
  "deviceId": "string",
  "channelId": "string",
  "rtpWithTcp": true,
  "videoSrcUrl": "string",
  "defaultRtpPort": true,
  "createTime": "2021-01-16T14:45:08.593Z", //注意,要格式化成yyyy-MM-dd HH:mm:ss,才能正常查询
  "updateTime": "2021-01-16T14:45:08.593Z",//注意,要格式化成yyyy-MM-dd HH:mm:ss,才能正常查询
  "enabled": true,
  "noPlayerBreak": true,
  "channelNameLike": "string",//带Like字样的,拼接查询条件时是模糊匹配条件,如果有Like字样条件存在,则对应的非Like字样字段条件则失效了,以Like字样条件优先
  "departmentNameLike": "string",
  "ipV4AddressLike": "string",
  "ipV6AddressLike": "string",
  "videoSrcUrlLike": "string",
  "deviceIdLike": "string",
  "channelIdLike": "string",
  "includeSubDeptartment": true //如果通过部门代码进行查询,此字段表示是否包含本部门及本部门下属部门的数据一起查出
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/GetVideoChannelList" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "{\"pageIndex\":1,\"pageSize\":2,\"orderBy\":[{\"fieldName\":\"id\",\"orderByDir\":0}],\"mainId\":\"string\",\"app\":\"string\",\"vhost\":\"string\",\"mediaServerId\":\"string\",\"channelName\":\"string\",\"departmentId\":\"330200\",\"departmentName\":\"string\",\"pDepartmentId\":\"string\",\"pDepartmentName\":\"string\",\"recordPlanName\":\"string\",\"ipV4Address\":\"string\",\"channelNameLike\":\"string\",\"departmentNameLike\":\"string\",\"ipV4AddressLike\":\"string\",\"ipV6AddressLike\":\"string\",\"videoSrcUrlLike\":\"string\",\"deviceIdLike\":\"string\",\"channelIdLike\":\"string\",\"includeSubDeptartment\":true}"

  • 返回参数:
{
  "videoChannelList": [//返回的是一个列表,可能有多条数据
    {
      "id": 1,
      "mainId": "24941BE1",
      "mediaServerId": "cjyo4hOBXQWARzm2",
      "vhost": "__defaultVhost__",
      "app": "rtp",
      "channelName": "HuaweiIPC Via NVR75",
      "departmentId": "330200",
      "departmentName": "宁波",
      "pDepartmentId": "330200",
      "pDepartmentName": "宁波",
      "deviceNetworkType": "Fixed",
      "deviceStreamType": "GB28181",
      "methodByGetStream": "None",
      "videoDeviceType": "NVR",
      "autoVideo": true,
      "autoRecord": true,
      "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
      "ipV4Address": "192.168.2.75",
      "ipV6Address": "::ffff:192.168.2.75",
      "hasPtz": true,
      "deviceId": "34020000001110000001",
      "channelId": "34020000001320000008",
      "rtpWithTcp": false,
      "defaultRtpPort": false,
      "createTime": "2021-01-12 15:05:56",
      "updateTime": "2021-01-12 15:22:17",
      "enabled": true,
      "noPlayerBreak": false
    },
    {
      "id": 2,
      "mainId": "20D50656",
      "mediaServerId": "cjyo4hOBXQWARzm2",
      "vhost": "__defaultVhost__",
      "app": "rtp",
      "channelName": "Camera 01",
      "departmentId": "330200",
      "departmentName": "宁波",
      "pDepartmentId": "330200",
      "pDepartmentName": "宁波",
      "deviceNetworkType": "Fixed",
      "deviceStreamType": "GB28181",
      "methodByGetStream": "None",
      "videoDeviceType": "NVR",
      "autoVideo": true,
      "autoRecord": true,
      "recordSecs": 0, //小于等于0或者为null时,将不会启用自定义录制切片时间,大于0时将应用此录制切片时间,单位为秒
      "ipV4Address": "192.168.2.75",
      "ipV6Address": "::ffff:192.168.2.75",
      "hasPtz": false,
      "deviceId": "34020000001110000001",
      "channelId": "34020000001320000009",
      "rtpWithTcp": false,
      "defaultRtpPort": false,
      "createTime": "2021-01-12 15:05:57",
      "updateTime": "2021-01-12 15:23:16",
      "enabled": true,
      "noPlayerBreak": false
    }
  ],
  "request": { //本次查询结束的查询请求参数
    "mainId": "string",
    "app": "string",
    "vhost": "string",
    "mediaServerId": "string",
    "channelName": "string",
    "departmentId": "330200",
    "departmentName": "",
    "pDepartmentId": "",
    "pDepartmentName": "",
    "recordPlanName": "string",
    "ipV4Address": "string",
    "channelNameLike": "string",
    "departmentNameLike": "",
    "ipV4AddressLike": "string",
    "ipV6AddressLike": "string",
    "videoSrcUrlLike": "string",
    "deviceIdLike": "string",
    "channelIdLike": "string",
    "includeSubDeptartment": true,
    "pageIndex": 1,
    "pageSize": 2,
    "orderBy": [
      {
        "fieldName": "id",
        "orderByDir": "ASC"
      }
    ]
  },
  "total": 6 //查询得到总共6条记录
}

MediaServerOpenRtpPort 申请开放一个RtpServer

  • 作用:开放一个Rtp服务器,开放Rtp服务器用于接受GB28181的rtp流,AKStream可以为每个Rtp流开放一个专门的Rtp接收服务器,此Rtp接收服务器的固定端口为此Rtp流唯一服务;一般情况下,在AKStream的体系中,不需要使用到此接口,只有在高级应用时,应用开发者希望能够全权管理rtpServer,StreamId,RtpPort时才会使用到此接口。
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId, 指定向哪个流媒体服务器申请开放Rtp服务器
  • stream,指定此Rtp服务器绑定的streamid
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/MediaServerOpenRtpPort?mediaServerId=cjyo4hOBXQWARzm2&stream=aaa" -H  "accept: text/plain"

  • 返回参数:
{
  "port": 10022, //绑定端口为10022,这个端口同时支持udp和tcp形式的rtp流
  "stream": "aaa" //绑定了aaa这个流id
}

GetOnlineStreamInfoList 获取在线流信息

  • 作用:此接口获取当前在线的流信息,所有已经推拉到AKStream中的音视频流信息都可以通过此接口进行获取,此接口中包含了流的播放地址,流播放者信息,流本身信息等重要信息,此接口支持分页,但不支持排序,因此排序字段无意义,但需要保留请求结构
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • 对象结构
{
  "pageIndex": 1, //页码,从1开始
  "pageSize": 2,//每页几行数据
  "orderBy": [//这个无意义 ,但要保留
    {
      "fieldName": "mainId",
      "orderByDir": 0
    }
  ],
  "mediaServerId": "string",//指定获取某个流媒体服务器的在线流信息,传string,null,空或不传都表示不应用此条件
  "mainId": "string",//指定获取某个音视频流的在线流信息,传string,null,空或不传都表示不应用此条件
  "videoChannelIp": "string"//指定某个ip地址的音视频流在线信息,,传string,null,空或不传都表示不应用此条件
  "StreamSourceType": 0 //指定流来源类型  Live直播,PlayBack回放,ALL全部
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/GetOnlineStreamInfoList" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "{\"pageIndex\":1,\"pageSize\":2,\"orderBy\":[{\"fieldName\":\"mainId\",\"orderByDir\":0}],\"mediaServerId\":\"string\",\"mainId\":\"string\",\"videoChannelIp\":\"string\",\"streamSourceType\":0}"

  • 返回参数:
{
  "videoChannelMediaInfo": [//返回的是列表
    {
      "mediaServerStreamInfo": {//流信息结构
        "streamSourceType": 0,//直播流
        "mediaServerId": "cjyo4hOBXQWARzm2",//流媒体服务器id
        "mediaServerIp": "192.168.2.27",//流媒体服务器ip地址
        "streamIp": "192.168.2.75",//流的ip地址
        "params": "",//参数
        "rptPort": 10012,//rtp流的rtpserver服务端口
        "streamPort": 62042,//rtp流的流端口
        "startTime": "2021-01-15 16:40:49",//此流开始时间
        "vhost": "__defaultVhost__",//vhost
        "app": "rtp",//app
        "stream": "24941BE1",//streamid
        "playUrl": [//这是播放地址列表,如果流媒体服务器开放ssl,则会存在https,wws,rtmps,rtsps地址,这些地址可以被各类播放器播放,应用开发可自行选择以下地址进行流播放
          "ws://192.168.2.27:80/rtp/24941BE1.flv",
          "http://192.168.2.27:80/rtp/24941BE1.flv",
          "rtsp://192.168.2.27:554/rtp/24941BE1",
          "rtmp://192.168.2.27:1935/rtp/24941BE1",
          "http://192.168.2.27:80/rtp/24941BE1/hls.m3u8",
          "http://192.168.2.27:80/rtp/24941BE1.live.ts",
          "ws://192.168.2.27:80/rtp/24941BE1.live.ts",
          "http://192.168.2.27:80/rtp/24941BE1.live.mp4",
          "ws://192.168.2.27:80/rtp/24941BE1.live.mp4"
        ],
        "ssrc": 613686241,//gb28181 的sdp中的ssrc值
        "isRecorded": false,//是否正在录制音视频通
        "pushSocketType": "UDP",//rtp流的推流端口方式,udp/tcp
        "playerList": [//此流的播放者列表
          {
            "playerId": "140000435052600",//播放者的tcp唯一id
            "ipAddress": "192.168.2.77",//播放者的ip地址
            "port": 54716,//播放者的端口
            "params": "",//参数
            "startTime": "2021-01-15 16:58:37"//播放时间
          },
          {
            "playerId": "140000566193768",
            "ipAddress": "10.8.0.2",
            "port": 58048,
            "params": "",
            "startTime": "2021-01-16 23:32:47"
          }
        ]
      },//以下是音视频流通道在数据库中的信息
      "id": 1,//数据库中的id
      "mainId": "24941BE1",//mainid
      "mediaServerId": "cjyo4hOBXQWARzm2",//所属流媒体服务器
      "vhost": "__defaultVhost__",
      "app": "rtp",
      "channelName": "HuaweiIPC Via NVR75",
      "departmentId": "330200",
      "departmentName": "宁波",
      "pDepartmentId": "330200",
      "pDepartmentName": "宁波",
      "deviceNetworkType": "Fixed",
      "deviceStreamType": "GB28181",
      "methodByGetStream": "None",
      "videoDeviceType": "NVR",
      "autoVideo": true,
      "autoRecord": true,
      "ipV4Address": "192.168.2.75",
      "ipV6Address": "::ffff:192.168.2.75",
      "hasPtz": true,
      "deviceId": "34020000001110000001",
      "channelId": "34020000001320000008",
      "rtpWithTcp": false,
      "defaultRtpPort": false,
      "createTime": "2021-01-12 15:05:56",
      "updateTime": "2021-01-12 15:22:17",
      "enabled": true,
      "noPlayerBreak": false
    },
    {//以下是下一个音视频流媒体信息
      "mediaServerStreamInfo": {
        "mediaServerId": "cjyo4hOBXQWARzm2",
        "mediaServerIp": "192.168.2.27",
        "streamIp": "192.168.2.75",
        "params": "",
        "rptPort": 10014,
        "streamPort": 62044,
        "startTime": "2021-01-15 16:40:49",
        "vhost": "__defaultVhost__",
        "app": "rtp",
        "stream": "20D50656",
        "playUrl": [
          "ws://192.168.2.27:80/rtp/20D50656.flv",
          "http://192.168.2.27:80/rtp/20D50656.flv",
          "rtsp://192.168.2.27:554/rtp/20D50656",
          "rtmp://192.168.2.27:1935/rtp/20D50656",
          "http://192.168.2.27:80/rtp/20D50656/hls.m3u8",
          "http://192.168.2.27:80/rtp/20D50656.live.ts",
          "ws://192.168.2.27:80/rtp/20D50656.live.ts",
          "http://192.168.2.27:80/rtp/20D50656.live.mp4",
          "ws://192.168.2.27:80/rtp/20D50656.live.mp4"
        ],
        "ssrc": 550831702,
        "isRecorded": false,
        "pushSocketType": "UDP",
        "playerList": []
      },
      "id": 2,
      "mainId": "20D50656",
      "mediaServerId": "cjyo4hOBXQWARzm2",
      "vhost": "__defaultVhost__",
      "app": "rtp",
      "channelName": "Camera 01",
      "departmentId": "330200",
      "departmentName": "宁波",
      "pDepartmentId": "330200",
      "pDepartmentName": "宁波",
      "deviceNetworkType": "Fixed",
      "deviceStreamType": "GB28181",
      "methodByGetStream": "None",
      "videoDeviceType": "NVR",
      "autoVideo": true,
      "autoRecord": true,
      "ipV4Address": "192.168.2.75",
      "ipV6Address": "::ffff:192.168.2.75",
      "hasPtz": false,
      "deviceId": "34020000001110000001",
      "channelId": "34020000001320000009",
      "rtpWithTcp": false,
      "defaultRtpPort": false,
      "createTime": "2021-01-12 15:05:57",
      "updateTime": "2021-01-12 15:23:16",
      "enabled": true,
      "noPlayerBreak": false
    }
  ],
  "request": {//这是本次结果的请求内容
    "mediaServerId": "string",
    "mainId": "string",
    "videoChannelIp": "string",
    "pageIndex": 1,
    "pageSize": 2,
    "orderBy": [
      {
        "fieldName": "mainId",
        "orderByDir": "ASC"
      }
    ]
  },
  "total": 5//总数是5个,可以根据分页条件进行分页查询
}

GetRecordFileList 获取录像文件列表(支持分页,全表条件)

  • 作用:此接口获取录制的音视频文件列表,支持分页,排序,全表条件查询
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • 对象结构
{
  "pageIndex": 1, //页码,从1开始
  "pageSize": 10, //每页多少行记录
  "orderBy": [//可以多个排序字段
    {
      "fieldName": "endTime", //数据库中的字段
      "orderByDir": "DESC" //排序方法
    }
  ],
  "id": null,//设置为null,表示不把此字段作为查询条件
  "mainId": null,
  "mediaServerId": "string",//字符串字段设置为string,表示不把此字段作为查询条件
  "mediaServerIp": "string",
  "channelName": "string",
  "departmentId": "string",
  "departmentName": "string",
  "pDepartmentId": "string",
  "pDepartmentName": "string",
  "deviceId": "string",
  "channelId": "string",
  "videoSrcUrl": "string",
  "ipV4Address": "string",
  "ipV6Address": "string",
  "startTime": null,//时间字段设置为null,表示不把此字段做为查询条件
  "endTime": null,
  "duration": null,
  "videoPath": "string",
  "fileSize": null,
  "vhost": "string",
  "streamid": "string",
  "app": "string",
  "downloadUrl": "string",
  "createTime": null,
  "updateTime": null,
  "recordDate": "string",
  "undo": null,//bool型字段设置成null,表示不把此字段做为查询条件
  "deleted": null
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/GetRecordFileList" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "{\"pageIndex\":1,\"pageSize\":10,\"orderBy\":[{\"fieldName\":\"endTime\",\"orderByDir\":\"DESC\"}],\"id\":null,\"mainId\":null,\"mediaServerId\":\"string\",\"mediaServerIp\":\"string\",\"channelName\":\"string\",\"departmentId\":\"string\",\"departmentName\":\"string\",\"pDepartmentId\":\"string\",\"pDepartmentName\":\"string\",\"deviceId\":\"string\",\"channelId\":\"string\",\"videoSrcUrl\":\"string\",\"ipV4Address\":\"string\",\"ipV6Address\":\"string\",\"startTime\":null,\"endTime\":null,\"duration\":null,\"videoPath\":\"string\",\"fileSize\":null,\"vhost\":\"string\",\"streamid\":\"string\",\"app\":\"string\",\"downloadUrl\":\"string\",\"createTime\":null,\"updateTime\":null,\"recordDate\":\"string\",\"undo\":null,\"deleted\":null}"

  • 返回参数:
{
  "recordFileList": [//返回的是列表,并以请求中的排序要求进行排序
    {
      "id": 11,
      "mainId": "27B44832",
      "mediaServerId": "cjyo4hOBXQWARzm2",
      "mediaServerIp": "192.168.2.27",
      "channelName": "测试",
      "departmentId": "330200",
      "departmentName": "宁波",
      "pDepartmentId": "330200",
      "pDepartmentName": "宁波",
      "deviceId": "34020000001110000001",
      "channelId": "34020000001320000011",
      "startTime": "2021-01-18 11:16:43",
      "endTime": "2021-01-18 11:18:43",
      "duration": 120,//此文件时长(秒)
      "videoPath": "/home/cdtnb/innerDisk/record/rtp/27B44832/2021-01-18/11-16-43.mp4",//文件存储的位置 
      "fileSize": 15104610,//文件大小(byte)
      "vhost": "__defaultVhost__",
      "streamid": "27B44832",
      "app": "rtp",
      "downloadUrl": "http://192.168.2.27:6880/home/cdtnb/innerDisk/record/rtp/27B44832/2021-01-18/11-16-43.mp4",//文件下载与播放地址
      "createTime": "2021-01-18 11:18:43",
      "updateTime": "2021-01-18 11:18:43",
      "recordDate": "2021-01-18",
      "undo": false,//是否可恢复删除
      "deleted": false//是否已删除状态
    },
    {
      "id": 10,
      "mainId": "27B44832",
      "mediaServerId": "cjyo4hOBXQWARzm2",
      "mediaServerIp": "192.168.2.27",
      "channelName": "测试",
      "departmentId": "330200",
      "departmentName": "宁波",
      "pDepartmentId": "330200",
      "pDepartmentName": "宁波",
      "deviceId": "34020000001110000001",
      "channelId": "34020000001320000011",
      "startTime": "2021-01-18 11:14:43",
      "endTime": "2021-01-18 11:16:43",
      "duration": 120,
      "videoPath": "/home/cdtnb/innerDisk/record/rtp/27B44832/2021-01-18/11-14-43.mp4",
      "fileSize": 15090767,
      "vhost": "__defaultVhost__",
      "streamid": "27B44832",
      "app": "rtp",
      "downloadUrl": "http://192.168.2.27:6880/home/cdtnb/innerDisk/record/rtp/27B44832/2021-01-18/11-14-43.mp4",
      "createTime": "2021-01-18 11:16:43",
      "updateTime": "2021-01-18 11:16:43",
      "recordDate": "2021-01-18",
      "undo": false,
      "deleted": false
    }
      ],
  "request": {//请求结构
    "mediaServerId": "string",
    "mediaServerIp": "string",
    "channelName": "string",
    "departmentId": "string",
    "departmentName": "string",
    "pDepartmentId": "string",
    "pDepartmentName": "string",
    "deviceId": "string",
    "channelId": "string",
    "videoSrcUrl": "string",
    "ipV4Address": "string",
    "ipV6Address": "string",
    "videoPath": "string",
    "vhost": "string",
    "streamid": "string",
    "app": "string",
    "downloadUrl": "string",
    "recordDate": "string",
    "pageIndex": 1,
    "pageSize": 2,
    "orderBy": [
      {
        "fieldName": "endTime",
        "orderByDir": "DESC"
      }
    ]
  },
  "total": 11
}

SoftDeleteRecordFile 软删除一个录制文件

  • 作用:对一个录制文件进行软删除,此接口删除的文件不会立即真正删除,只是在数据库中做Deleted的标记,并且使数据库中UnDo字段为1,表示这个删除可以被恢复;在被删除后的24小时内可以通过恢复软删除接口对其进行恢复;24小时以后没有恢复的将真正被删除,真正删除后数据库中Deleted字段依然是1,而Undo字段将设置成0,表示没有机会再对其进行删除恢复,因为此字段对应的音视频文件被彻底从磁盘上删除。
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • dbId ,数据库中音视频文件的Id(主键)
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/SoftDeleteRecordFile?dbId=1" -H  "accept: text/plain"

  • 返回参数:

bool:true/false 成功或失败

RestoreSoftDeleteRecordFile 恢复被软删除的录制文件

  • 作用:恢复一个被软删除的录制文件,被软删除后的文件在小24小时内有机会被恢复,恢复后数据库Deleted字段被设置为0,UnDo字段被设置成0。
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • dbId ,数据库中音视频文件的Id(主键)
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/SoftDeleteRecordFile?dbId=14" -H  "accept: text/plain"

  • 返回参数:

bool:true/false 成功或失败

DeleteRecordFile 删除一个录制文件

  • 作用:真正立即删除一个录制文件,文件被删除后数据库中Deleted字段为1,UnDo字段为0,磁盘对应文件被删除
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • dbId ,数据库中音视频文件的Id(主键)
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/DeleteRecordFile?dbId=20" -H  "accept: text/plain"

  • 返回参数:

bool:true/false 成功或失败

DeleteRecordFileList 立即删除一批录制文件

  • 作用:真正立即删除一批录制文件,文件被删除后数据库中Deleted字段为1,UnDo字段为0,磁盘对应文件被删除
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • dbId列表(List),数据库中音视频文件的Id(主键)
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/DeleteRecordFileList" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "[9,10]"

  • 返回参数:
{
  "pathList": []//部分未被删除的文件列表(删除有异常的话),返回列表为空时表示所有文件删除成功
}

SoftDeleteRecordFileList 软删除一批录制文件

  • 作用:不会真正立即删除这批录制文件,文件被删除后数据库中Deleted字段为1,UnDo字段为1,24小时以后再作真正的磁盘对应文件被删除
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • dbId列表(List),数据库中音视频文件的Id(主键)
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/SoftDeleteRecordFileList" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "[20,21]"

  • 返回参数:
{
  "pathList": []//部分未被删除的文件列表(删除有异常的话),返回列表为空表示全部删除成功
}

StartRecord 启动音视频流文件录制

  • 作用:对某个音视频通道进行音视频文件录制,在AKStream的正常体系内,此接口不需要使用,AKStream的录制计划已经涵盖了这个接口的功能,只有应用程序希望自己控制相关录制音视频文件功能时才会被用到
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/StartRecord?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数:
{
  "code": 0, //0 为成功,其他为失败
  "result": true //具体的状态
}

StopRecord 停止音视频流文件录制

  • 作用:停止某个音视频通道进行音视频文件录制,在AKStream的正常体系内,此接口不需要使用,AKStream的录制计划已经涵盖了这个接口的功能,只有应用程序希望自己控制相关录制音视频文件功能时才会被用到
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/StopRecord?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数:
{
  "code": 0, //0 为成功,其他为失败
  "result": true //具体的状态
}

AddStreamProxy 使用内置流代理器拉一个音视频流

  • 作用:使用内置拉流器拉一个非GB28181类型的音视频流,可以拉取rtsp,http,rtmp等方式提供的流,在AKStream正常体系中此接口不需要被用到,AKStream的推拉流相关功能已经涵盖此接口功能,只有应用程序希望自己控制某些通道的推拉流时才会被用到,使用此接口时,请保证数据库中AutoLive字段为0
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/AddStreamProxy?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数:
{
  "mediaServerId": "string",//流媒体服务器id
  "mediaServerIp": "string",//流媒体服务器ip
  "streamIp": "string",//流ip
  "streamTcpId": "string",//流tcpid
  "params": "string",//流参数
  "rptPort": 0,//rtp端口
  "streamPort": 0,//stream端口
  "startTime": "2021-01-18T04:00:39.291Z",//录制开始时间
  "vhost": "string",//vhost
  "app": "string",//app
  "stream": "string",//streamid=mainid
  "playUrl": [//播放地址
    "string"
  ],
  "ssrc": 0,//ssrc
  "isRecorded": true,//是否正在录制
  "pushSocketType": 0,//拉流socket类型
  "playerList": [//播放者列表
    {
      "playerId": "string",//播放者tcpid
      "ipAddress": "string",//播放者ip地址
      "port": 0,//播放者端口
      "params": "string",//参数
      "startTime": "2021-01-18T04:00:39.291Z"//播放开始时间
    }
  ]
}

AddFFmpegStreamProxy 使用FFmpeg流代理器拉一个音视频流

  • 作用:使用FFmpeg拉流器拉一个非GB28181类型的音视频流,可以拉取rtsp,http,rtmp等所有ffmpeg支持方式提供的流,在AKStream正常体系中此接口不需要被用到,AKStream的推拉流相关功能已经涵盖此接口功能,只有应用程序希望自己控制某些通道的推拉流时才会被用到,使用此接口时,请保证数据库中AutoLive字段为0
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/AddFFmpegStreamProxy?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数:
{
  "mediaServerId": "string",//流媒体服务器id
  "mediaServerIp": "string",//流媒体服务器ip
  "streamIp": "string",//流ip
  "streamTcpId": "string",//流tcpid
  "params": "string",//流参数
  "rptPort": 0,//rtp端口
  "streamPort": 0,//stream端口
  "startTime": "2021-01-18T04:00:39.291Z",//录制开始时间
  "vhost": "string",//vhost
  "app": "string",//app
  "stream": "string",//streamid=mainid
  "playUrl": [//播放地址
    "string"
  ],
  "ssrc": 0,//ssrc
  "isRecorded": true,//是否正在录制
  "pushSocketType": 0,//拉流socket类型
  "playerList": [//播放者列表
    {
      "playerId": "string",//播放者tcpid
      "ipAddress": "string",//播放者ip地址
      "port": 0,//播放者端口
      "params": "string",//参数
      "startTime": "2021-01-18T04:00:39.291Z"//播放开始时间
    }
  ]
}

StreamLive 推/拉一个音视频流

  • 作用:这个接口是AKStream中正统的推/拉一个音视频流的方法,此方法根据数据库字段情况自动选择使用GB28181方式推流或使用内置拉流器或使用FFMpeg拉流器进行流的推入或拉取工作,这个接口会自动判断什么流该用什么方式推入或拉取,所以应用程序应尽量使用此接口进行推拉流
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/StreamLive?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数:
{
  "mediaServerId": "string",//流媒体服务器id
  "mediaServerIp": "string",//流媒体服务器ip
  "streamIp": "string",//流ip
  "streamTcpId": "string",//流tcpid
  "params": "string",//流参数
  "rptPort": 0,//rtp端口
  "streamPort": 0,//stream端口
  "startTime": "2021-01-18T04:00:39.291Z",//录制开始时间
  "vhost": "string",//vhost
  "app": "string",//app
  "stream": "string",//streamid=mainid
  "playUrl": [//播放地址
    "string"
  ],
  "ssrc": 0,//ssrc
  "isRecorded": true,//是否正在录制
  "pushSocketType": 0,//拉流socket类型
  "playerList": [//播放者列表
    {
      "playerId": "string",//播放者tcpid
      "ipAddress": "string",//播放者ip地址
      "port": 0,//播放者端口
      "params": "string",//参数
      "startTime": "2021-01-18T04:00:39.291Z"//播放开始时间
    }
  ]
}

StreamStop 停止一个音视频流

  • 作用:这个接口是AKStream中正统的停止音视频流的方法,应用程序应尽量使用此接口进行推拉流;此接口会自动正确判断该使用什么方式进行断流
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/StreamStop?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数: bool:true/false 成功或失败

StreamStop 停止一个音视频流

  • 作用:这个接口是AKStream中正统的停止音视频流的方法,应用程序应尽量使用此接口进行推拉流;此接口会自动正确判断该使用什么方式进行断流
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId 流媒体服务器的id
  • mainId 音视频流通道id
  • 调用实例:
curl -X GET "http://192.168.2.27:5800/MediaServer/StreamStop?mediaServerId=cjyo4hOBXQWARzm2&mainId=streamId" -H  "accept: text/plain"

  • 返回参数: bool:true/false 成功或失败

CutOrMergeVideoFile 添加裁剪合并任务

  • 作用:此接口用于从一段(一个或多个)音视频录制文件中提取出来(合并或裁剪或合并裁剪)你所需要的那部分视频文件,可以认为这是一种按需切片的功能
  • 方法:HttpPost
  • 是否鉴权:是
  • 输入参数:
  • 对象结构:
{
  "startTime": "2021-01-18 14:02:53",//指定你需要切片视频的开始时间
  "endTime": "2021-01-18 15:02:53",//指定你需要切片视频的结束时间,注意开始与结束确定了一个时间段,该时间段不能超过120分钟,否则系统将拒绝服务
  "mediaServerId": "cjyo4hOBXQWARzm2", //指定流媒体服务器
  "app": "rtp", //指定app
  "vhost": "__defaultVhost__",//指定vhost
  "mainId": "29552F14", //指定音视频通道的mainId,表示对此音视频通道进行切片
  "callbackUrl": "http://192.168.2.33:8878/callmeByTaskEnding"//指定在裁剪合并任务结束后调用此链接告知其任务完成,这个地址由第三方应用自行提供
}
  • 调用实例:
curl -X POST "http://192.168.2.27:5800/MediaServer/CutOrMergeVideoFile" -H  "accept: text/plain" -H  "Content-Type: application/json-patch+json" -d "{\"startTime\":\"2021-01-18 14:20:31\",\"endTime\":\"2021-01-18 14:24:31\",\"mediaServerId\":\"cjyo4hOBXQWARzm2\",\"app\":\"rtp\",\"vhost\":\"__defaultVhost__\",\"mainId\":\"27B44832\",\"callbackUrl\":\"http://192.168.2.78:8080\"}"

  • 返回参数:
{
    "taskId":"09b4b950-e304-49ca-b370-f499880d6422", //返回的任务id,这个id要存起来,因为完成任务回调或者任务中进度查询都需要此id
    "callbakUrl":"http://192.168.2.33:8878/callmeByTaskEnding",//你指定的任务完成回调http链接
    "createTime":"2021-01-18 22:08:43",//任务创建时间
    "taskStatus":1,//任务状态
    "processPercentage":0,//任务百分比
    "playUrl":""//播放地址
}

任务回调

  • 任务完成时系统会回调callbakUrl地址,告知调用方任务已完成,具体结构如下:
{
  "task": {
    "cutMergeFileList": [ //任务涉及的录制文件列表
      {
        "dbId": 0,//数据库id
        "filePath": "string",//文件路径
        "startTime": "2021-01-18T14:05:05.624Z",//录制文件开始时间
        "endTime": "2021-01-18T14:05:05.624Z",//录制文件结束时间
        "fileSize": 0,//文件大小
        "duration": 0,//视频时长
        "cutStartPos": "string",//头部裁剪时间
        "cutEndPos": "string"//尾部裁剪时间
      }
    ],
    "taskId": "string",//任务id
    "callbakUrl": "string",//回调地址
    "createTime": "2021-01-18T14:05:05.624Z",//任务创建时间
    "taskStatus": 0,//任务状态
    "processPercentage": 0,//任务完成百分比
    "playUrl": "string"//播放地址
  },
  "filePath": "string",//任务完成后的切片文件路径
  "uri": "string",//任务完成后的切片文件访问地址
  "fileSize": 0,//切片文件的大小
  "duration": 0,//切片文件的时长
  "status": 0,//切片文件状态
  "timeConsuming": 0,//本次任务耗时时间(秒)
  "request": {//请求结构
    "startTime": "2021-01-18T14:05:05.624Z",
    "endTime": "2021-01-18T14:05:05.624Z",
    "mediaServerId": "string",
    "app": "string",
    "vhost": "string",
    "mainId": "string",
    "callbackUrl": "string"
  }
}

GetMergeTaskStatus 获取裁剪合并任务的进度

  • 作用:当裁剪合并任务涉及文件较多,文件时长较长时,此任务运行时间也会比较久,为了实时了解任务执行状态,特提供获取任务进度的接口

  • 方法:HttpPost

  • 是否鉴权:是

  • 输入参数:

  • mediaServerId , 指定流媒体服务器

  • taskId , 创建添加任务时返回的任务id

  • 调用实例

curl -X GET "http://192.168.2.27:5800/MediaServer/GetMergeTaskStatus?mediaServerId=mediaServerId&taskId=mytaskId" -H  "accept: text/plain"
  • 返回参数
{
  "taskId": "09b4b950-e304-49ca-b370-f499880d6422", //任务id
  "callbakUrl": "http://192.168.2.33:8878/callmeByTaskEnding",//任务结束回调地址
  "createTime": "2021-01-18 14:26:42",//任务创建时间
  "taskStatus": 0,//任务状态
  "processPercentage": 66,//任务进度
  "playUrl": ""//播放地址
}

GetBacklogTaskList 获取裁剪合并任务的积压列表

  • 作用:裁剪合并任务同一时间不能过多,系统内置一个队列,按先进先出的顺序进行任务排序与执行,长时间没有执行任务时可以通过此接口查看任务是否正在积压状态
  • 方法:HttpGet
  • 是否鉴权:是
  • 输入参数:
  • mediaServerId , 流媒体服务器id
  • 调用实例
curl -X GET "http://192.168.2.27:5800/MediaServer/GetBacklogTaskList?mediaServerId=cjyo4hOBXQWARzm2" -H  "accept: text/plain"

  • 返回参数
{
  "cutMergeTaskStatusResponseList": [//返回任务积压列表
    {
      "taskId": "string",
      "callbakUrl": "string",
      "createTime": "2021-01-18T14:31:07.416Z",
      "taskStatus": 0,
      "processPercentage": 0,
      "playUrl": "string"
    }
  ]
}
Clone this wiki locally