API接口文档 V1
huxicong·发表于:2016-08-12 15:22·更新于:2016-11-21 18:14
创建流
请求 hub.createStream(title, publishKey, publishSecurity);
参数 说明
title (string),流名,必须满足 namePattern, err := regexp.Compile(“^[a-zA-Z0-9_-]{4,200}$。
publishKey(string) 验证的key
publishSecurity 鉴权方式”dynamic” 或 “static” ,”dynamic” 为默认的
POST /v1/streams HTTP/1.1
Host: pili.qiniuapi.com
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: application/json
Authorization: Qiniu vI2xPIjOoh7udcRw4GdYNvf3o_gKsCx9wdZaC9u-:oJeCsKJUyv6KCLlnP4vyCheYKnk=
Content-Length: 87
{"hub":"1314xicong","title":"hello","publishKey":"huxicong","publishSecurity":"static"}
响应
{
"id": "z1.1314xicong.hello",
"createdAt": "2016-08-08T11:50:22.09+08:00",
"updatedAt": "2016-08-08T11:50:22.09+08:00",
"title": "hello",
"hub": "1314xicong",
"disabledTill": 0,
"disabled": false,
"publishKey": "huxicong",
"publishSecurity": "static",
"hosts": {
"publish": {
"rtmp": "pili-publish.pili.echohu.top"
},
"live": {
"hdl": "pili-live-hdl.pili.echohu.top",
"hls": "pili-live-hls.pili.echohu.top",
"http": "pili-live-hls.pili.echohu.top",
"rtmp": "pili-live-rtmp.pili.echohu.top",
"snapshot": "100008j.live1-snapshot.z1.pili.qiniucdn.com"
},
"playback": {
"hls": "100008j.playback1.z1.pili.qiniucdn.com",
"http": "100008j.playback1.z1.pili.qiniucdn.com"
},
"play": {
"http": "pili-live-hls.pili.echohu.top",
"rtmp": "pili-live-rtmp.pili.echohu.top"
}
}
}
获取流
请求
hub.getStream(streamId)
streamId(这是流的标示 z1.1314xicong.huxicongp )
GET /v1/streams/z1.1314xicong.hello HTTP/1.1
Host: pili.qiniuapi.com
Accept: */*
Accept-Encoding: deflate, gzip
Content-Type: application/json
User-Agent: pili-sdk-php/1.5.4 curl/7.47.1 PHP/7.0.8
Authorization: Qiniu vI2xPIjOoh7udcRw4GdYNvf3o_gKsCx9wdZaC9u-:yvLyCKiXvBdAWgGGDyLIZUvMCmY=
响应
{
"id": "z1.1314xicong.hello",
"createdAt": "2016-08-08T11:50:22.09+08:00",
"updatedAt": "2016-08-08T11:50:22.09+08:00",
"title": "hello",
"hub": "1314xicong",
"disabledTill": 0,
"disabled": false,
"publishKey": "huxicong",
"publishSecurity": "static",
"hosts": {
"publish": {
"rtmp": "pili-publish.pi