七、功能接口章节--视频推流拉流接口调用

七、功能接口章节--视频推流拉流接口调用


d、设备开始上传媒体流

接口功能 本接口主要提供httpAPI接口通知流媒体服务器开始上传视频媒体流。

Request URL: http://192.168.0.105:18080/api/play/startPushStream
域名访问URL: http://iotbox.iotrelay.cn:8080/api/api/play/startPushStream

Request Method: GET

数据提交格式 Query String Parameters

请求头参数 Authorization

请求头参数说明:

参数名类型必须描述
AuthorizationHeader固定值:字符串"Bearer" +"token"组成, "token"为上述登录接口获取的属性值,如:请求头中


“Authorization” : “Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJiNjE3OGVlN2ZhNWM0OWU2ODlmMGEzNjIxNzkxYzk2OCIsInN1YiI6IntcInVzZXJJZFwiOlwiNDlcIixcInVzZXJOYW1lXCI6XCIxMzQzNzE1NjU2OVwiLFwibmlja05hbWVcIjpcIjQ0MDgwMDAwMDAxMTExMDAwMDE3XCJ9IiwiaXNzIjoic2oiLCJpYXQiOjE2OTcxNTk2NjgsImV4cCI6MTY5NzE2MTQ2OH0.4C3GJIF5ejmySHy9l_LmheoCs5jknq17h9tPsZB3dIM”

请求体参数说明:

参数名类型必须描述
deviceIdstring接入视频设备ID标识,对应位置在 视频设备–我的接入配置–监控设备接入配置信息–SIP用户认证ID 如:黄色 "44080000001111000001"为接入视频设备SIP用户认证ID值
channelIdstringIOT接入视频设备视频监控通道编号ID,对应位置在 视频设备–我的接入配置–监控设备接入配置信息–视频监控通道编号ID 如:黄色 “44090000001321000002

*正确响应结果示例:

      "code": "0",
      "msg": "success",
      "data": {
                  "app": "rtp",
                  "stream": "44090000001111000001_44090000001321000002",
                  "deviceID": "44090000001111000001",
                  "channelId": "44090000001321000002",
                  "flv": "http://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002.live.flv",
                  "https_flv": "https://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002.live.flv",
                  "ws_flv": "ws://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002.live.flv",
                  "wss_flv": "wss://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002.live.flv",
                  "fmp4": "http://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002.live.mp4",
                  "https_fmp4": ""https://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002.live.mp4",
                  "ws_fmp4": "ws://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002.live.mp4",
                  "hls": "http://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002/hls.m3u8",
                  "https_hls": "https://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002/hls.m3u8",
                  "ws_hls": "ws://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002/hls.m3u8",
                  "wss_hls": "wss://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002/hls.m3u8",
                  "ts": "http://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002.live.ts",
                  "https_ts": "https://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002.live.ts",
                  "ws_ts": "ws://192.168.0.105:8088/rtp/44090000001111000001_44090000001321000002.live.ts",
                  "wss_ts": "wss://192.168.0.105:443/rtp/44090000001111000001_44090000001321000002.live.ts",
                  "rtmp": "rtmp://192.168.0.105:1935/rtp/44090000001111000001_44090000001321000002",
                  "rtmps": "rtmps://192.168.0.105:19350/rtp/44090000001111000001_44090000001321000002",
                  "rtsp": "rtsp://192.168.0.105:554/rtp/44090000001111000001_44090000001321000002",
                  "rtsps": "rtsps://192.168.0.105:332/rtp/44090000001111000001_44090000001321000002",
                  "rtc": "https://192.168.0.105:443/index/api/webrtc?app=rtp&stream=44090000001111000001_44090000001321000002&type=play",
                  "mediaServerId": "bHYYBssB9jtwVkca",
                  "tracks": [
                   {
                      "codecIdName": "null",
                      "codecId": "0",
                      "channels": "1",
                      "sampleBit": "0",
                      "ready": "true",
                      "fps": "0",
                      "width": "0",
                      "codecType": "0",
                      "sampleRate": "0",
                      "height": "0",
                   },
                   {
                      "codecIdName": "null",
                      "codecId": "0",
                      "channels": "0",
                      "sampleBit": "0",
                      "ready": "true",
                      "fps": "25",
                      "width": "1280",
                      "codecType": "0",
                      "sampleRate": "0",
                      "height": "720",
                   }
             ],
             "transactionInfo": "null"
}

响应体参数说明:

参数名类型描述
deviceIDstring接入视频设备ID标识,对应位置在 视频设备–我的接入配置–监控设备接入配置信息–SIP用户认证ID 如:黄色 "44080000001111000001"为接入视频设备SIP用户认证ID值
channelIdstringIOT接入视频设备视频监控通道编号ID,对应位置在 视频设备–我的接入配置–监控设备接入配置信息–视频监控通道编号ID 如:黄色 “44090000001321000002”
appstring名称
streamstring视频媒体流ID
flvstring视频FLV格式拉流地址
hlsstring视频.m3u8格式拉流地址
tsstring视频ts格式拉流地址
rtmpstring视频rtmp协议拉流地址
rtspstring视频rtsp协议拉流地址
mediaServerIdstring视频流媒体服务器ID

错误响应结果示例:

{
      "code": "-1",
      "msg": "fail:数据查询失败"
}
e、设备停止上传媒体流

接口功能 本接口主要提供httpAPI接口通知流媒体服务器停止上传视频媒体流。

Request URL: http://192.168.0.188:18080/api/play/stopPushStream
域名访问URL: http://iotbox.iotrelay.cn:8080/api/api/play/stopPushStream

Request Method: GET

数据提交格式 Query String Parameters

请求头参数** Authorization**

请求头参数说明:

参数名类型必须描述
AuthorizationHeader固定值:字符串"Bearer" +"token"组成, "token"为上述登录接口获取的属性值,如:请求头中


“Authorization” : “Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJiNjE3OGVlN2ZhNWM0OWU2ODlmMGEzNjIxNzkxYzk2OCIsInN1YiI6IntcInVzZXJJZFwiOlwiNDlcIixcInVzZXJOYW1lXCI6XCIxMzQzNzE1NjU2OVwiLFwibmlja05hbWVcIjpcIjQ0MDgwMDAwMDAxMTExMDAwMDE3XCJ9IiwiaXNzIjoic2oiLCJpYXQiOjE2OTcxNTk2NjgsImV4cCI6MTY5NzE2MTQ2OH0.4C3GJIF5ejmySHy9l_LmheoCs5jknq17h9tPsZB3dIM”

请求体参数说明:

参数名类型必须描述
deviceIdstring接入视频设备ID标识,对应位置在 视频设备–我的接入配置–监控设备接入配置信息–SIP用户认证ID 如:黄色 "44080000001111000001"为接入视频设备SIP用户认证ID值
channelIdstringIOT接入视频设备视频监控通道编号ID,对应位置在 视频设备–我的接入配置–监控设备接入配置信息–视频监控通道编号ID 如:黄色 “44090000001321000002

正确响应结果示例:

{
      "code": "0",
      "msg": "success",
      "data": "true",
}

错误响应结果示例:

{
      "code": "-1",
      "msg": "fail:视频点播未找到"
}
f、视频拉流接口

接口功能 本iot视频平台提供的接入NVR设备或摄像头设备拉流地址如下。

视频播放 URL: http://192.168.0.188:8088/rtp/44090000001111000001_44090000001321000002.live.flv     (http协议flv播放格式)

http://192.168.0.188:8088/rtp/44090000001111000001_44090000001321000002/hls.m3u8     (http协议hls播放格式)

http://192.168.0.188:8088/rtp/44090000001111000001_44090000001321000002.live.ts     (http协议ts播放格式)

rtmp://192.168.0.188:1935/rtp/44090000001111000001_44090000001321000002     (rtmp协议播放地址)

rtsp://192.168.0.188:554/rtp/44090000001111000001_44090000001321000002     (rtsp协议播放地址)

视频播放 域名访问URL:
             
http://video.iotbox.iotrelay.cn:8080/rtp/44090000001111000001_44090000001321000002.live.flv     
(http协议flv播放格式)

http://video.iotbox.iotrelay.cn:8080/rtp/44090000001111000001_44090000001321000002/hls.m3u8     (http协议hls播放格式)

http://video.iotbox.iotrelay.cn:8080/rtp/44090000001111000001_44090000001321000002.live.ts     (http协议ts播放格式)

rtmp://iotbox.iotrelay.cn:1935/rtp/44090000001111000001_44090000001321000002     (rtmp协议播放地址)

rtsp://iotbox.iotrelay.cn:554/rtp/44090000001111000001_44090000001321000002     (rtsp协议播放地址)


视频播放URL组成说明:

参数名描述
192.168.0.105:8088固定值:拉流访问的流媒体ip和端口
44090000001111000001_44090000001321000002固定值:字符串44090000001111000001_44090000001321000002由“接入的视频设备SIP_id” +“_”+“设备国标通道ID”组成, "44090000001111000001"为接入的视频设备SIP_id, "44090000001321000002"为接入的视频设备国标通道ID
说明在调用本拉流接口前需先调用《a、设备开始上传媒体流》接口,否则拉不到媒体流。

上述播放地址根据所选用的协议和拉流格式使用,通常基于HTML5开发项目采用http协议的.flv  .m3u8  .ts 播放格式地址,基于应用程序的项目使用rtmp、rtsp协议播放地址。
http  rtmp  rtsp 为协议头
192.168.0.105 为拉流访问的流媒体ip
8088   1935    554 为拉流访问的流媒体端口

前端拉流地址的使用,只需把上述对应视频通道的播放地址加入视频播放器的URL即可。


IOT中继宝盒 长按关注宜联科技公众号

QQ在线咨询

点击这里给我发消息 咨询客服专员

QQ咨询

专业咨询

199-4502-1328

电话咨询

微信扫一扫

IOT中继宝盒

微信咨询
返回顶部