|
|
第1行: |
第1行: |
− | | + | =视频直播 OPEN API= |
− | '''直播服务OPEN API'''
| + | |
− | | + | |
| | | |
| <div class="wiki_txtJ"> | | <div class="wiki_txtJ"> |
− | 阅读以下文档,帮助了解如何使用微博直播接口。
| + | 微博为广大自媒体作者、机构、具备拍摄功能的硬件厂商等,提供短视频上传接口,可以将视频内容上传、并发布到微博。 |
− | </div>
| + | |
| | | |
| | | |
− | == 授权机制 ==
| + | 根据相关规定,视频服务需具备相关资质,因此接口文档暂不公开。 |
| | | |
− | 目前微博开放平台用户身份鉴权采用的是Oauth2.0,参见 [http://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E 如何登录授权]
| |
| | | |
− | ==访问频次限制==
| + | 如果第三方需要与微博进行视频相关的接入合作,请联系 商务合作:[mailto:weibo_app@vip.sina.com weibo_app@vip.sina.com] 进行洽谈,索取视频上传接口文档。 |
| | | |
− | 访问级别:<span style="color:#FF7D13;">普通接口</span>
| + | <div style="width:100%;display:table;margin-top:20px;"> |
| + | <div style="width:50%;display:table;float:left;"> |
| + | <div style="width:90%;height:50px;padding:10px;border:1px solid #CEE1EE;"> |
| + | <div style="width:50px;height:50px;float:left;"><img src="http://tp2.sinaimg.cn/1904178193/50/5689657598/0" /></div> |
| + | <div style="float:left;margin-left:15px;">[http://weibo.com/openapi 微博开放平台]</div> |
| + | </div> |
| + | </div> |
| + | </div> |
| | | |
− | 频次限制:<span style="color:#FF7D13;">是</span>
| + | </div> |
− | | + | |
− | 关于频次限制,参考[http://open.weibo.com/wiki/Rate-limiting 接口访问权限说明]
| + | |
− | | + | |
− | ==创建直播==
| + | |
− | | + | |
− | URL : https://api.weibo.com/2/proxy/live/create [POST]
| + | |
− | | + | |
− | 说明:新建直播对象,获取直播推流地址,并同时发微博
| + | |
− | | + | |
− | 参数:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段必选
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
| + | |
− | {{api_args|title|true|string|直播描述}}
| + | |
− | {{api_args|width|true|string|直播宽度}}
| + | |
− | {{api_args|height|true|string|直播高度}}
| + | |
− | {{api_args|summary|false|string|微博文本内容,必须做URLencode,内容不超过130个汉字}}
| + | |
− | {{api_args|published|false|string|微博是否发布,0:公开发布,1:仅自己可见,默认为0}}
| + | |
− | {{api_args|image|false|string|封面图地址,注意封面图的宽高和直播的宽高比例要一致。}}
| + | |
− | {{api_args|replay|false|string|是否录制,0:不录制,1:录制,默认为1}}
| + | |
− | {{api_args|is_panolive|false|string|是否全景直播,0:不是,1:是,默认为0}}
| + | |
− | |}
| + | |
− | | + | |
− | 返回:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{rdes_args|id|string|直播ID}}
| + | |
− | {{rdes_args|rtmp_url|string|直播推流地址}}
| + | |
− | {{rdes_args|room_id|string|房间id}}
| + | |
− | |}
| + | |
− | | + | |
− | 示例:
| + | |
− | | + | |
− | <pre class="brush:js">
| + | |
− | {
| + | |
− | "id": "230916c5fc9c48670bf72b9135261865ef35cd",
| + | |
− | "room_id": "1042097:5617ce1cc0f822ebd37f93a0275c8660",
| + | |
− | "url": "rtmp://ps.live.weibo.com/***/c5fc9c48670bf72b9135261865ef35cd?auth_key=***"
| + | |
− | }
| + | |
− | </pre>
| + | |
− | | + | |
− | ==直播推流==
| + | |
− | | + | |
− | 第三方根据直播创建接口返回的推流地址rtmp_url开始推流
| + | |
− | | + | |
− | | + | |
− | ==更新直播==
| + | |
− | | + | |
− | URL : https://api.weibo.com/2/proxy/live/update [POST]
| + | |
− | | + | |
− | 说明:直播对象信息、状态等更新
| + | |
− | | + | |
− | 参数:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段必选
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
| + | |
− | {{api_args|id|true|string|直播ID}}
| + | |
− | {{api_args|title|false|string|直播描述}}
| + | |
− | {{api_args|summary|false|string|微博文本内容,必须做URLencode,内容不超过130个汉字}}
| + | |
− | {{api_args|published|false|string|微博是否发布,0:公开发布,1:仅自己可见,2:不发布 默认为2}}
| + | |
− | {{api_args|image|false|string|直播封面图地址}}
| + | |
− | {{api_args|stop|false|string|直播结束,0:直播中,1:直播结束,默认为0}}
| + | |
− | {{api_args|replay_url|false|string|直播回放地址}}
| + | |
− | |}
| + | |
− | | + | |
− | 返回:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{rdes_args|id|string|直播ID}}
| + | |
− | |}
| + | |
− |
| + | |
− | 示例:
| + | |
− | | + | |
− | <pre class="brush:js">
| + | |
− | {
| + | |
− | "id": "230916c5fc9c48670bf72b9135261865ef35cd"
| + | |
− | }
| + | |
− | </pre>
| + | |
− | | + | |
− | ==删除直播==
| + | |
− | | + | |
− | URL : https://api.weibo.com/2/proxy/live/delete [POST]
| + | |
− | | + | |
− | 说明:直播对象删除,不可逆
| + | |
− | | + | |
− | 参数:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段必选
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
| + | |
− | {{api_args|id|true|string|直播ID}}
| + | |
− | |}
| + | |
− | | + | |
− | 返回:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{rdes_args|id|string|直播ID}}
| + | |
− | |}
| + | |
− | | + | |
− | 示例:
| + | |
− | | + | |
− | <pre class="brush:js">
| + | |
− | {
| + | |
− | "id": "230916c5fc9c48670bf72b9135261865ef35cd"
| + | |
− | }
| + | |
− | </pre>
| + | |
− | | + | |
− | ==获取直播信息==
| + | |
− | | + | |
− | URL : https://api.weibo.com/2/proxy/live/show [POST]
| + | |
− | | + | |
− | 说明:直播对象信息、互动信息等获取
| + | |
− | | + | |
− | 参数:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段必选
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
| + | |
− | {{api_args|id|true|string|直播ID}}
| + | |
− | {{api_args|detail|false|string|直播详情,0:不返回,1:返回,默认为0}}
| + | |
− | |}
| + | |
− | | + | |
− | 返回:
| + | |
− | | + | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| + | |
− | |-
| + | |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|参数字段
| + | |
− | !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段类型
| + | |
− | !width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
| + | |
− | {{rdes_args|id|string|直播ID}}
| + | |
− | {{rdes_args|uid|string|直播作者ID}}
| + | |
− | {{rdes_args|title|string|直播标题}}
| + | |
− | {{rdes_args|summary|string|微博文本内容}}
| + | |
− | {{rdes_args|image|string|封面图地址}}
| + | |
− | {{rdes_args|url|string|直播落地页}}
| + | |
− | {{rdes_args|status|int|直播状态}}
| + | |
− | {{rdes_args|create_time|string|直播创建时间}}
| + | |
− | {{rdes_args|live_views|int|直播实时在线人数,detail为1时返回}}
| + | |
− | {{rdes_args|total_views|int|直播总在线人数,detail为1时返回}}
| + | |
− | {{rdes_args|total_stars|int|直播总点赞数,detail为1时返回}}
| + | |
− | |}
| + | |
− |
| + | |
− | 示例:
| + | |
− | | + | |
− | <pre class="brush:js">
| + | |
− | {
| + | |
− | "id": "230912beaccf45a32ac3a36078b245ad8b5ddf",
| + | |
− | "uid": "2791445053",
| + | |
− | "title": "测试直播修改",
| + | |
− | "summary": "测试直播修改简介",
| + | |
− | "url": "http://live.weibo.com/show?id=1042097:beaccf45a32ac3a36078b245ad8b5ddf",
| + | |
− | "status": 3,
| + | |
− | "create_time": "2016-10-20 16:40:29"
| + | |
− | }
| + | |
− | </pre>
| + | |
− | | + | |
− | ==直播互动接口==
| + | |
− | 请参考[http://open.weibo.com/wiki/Live/im/api 直播互动接口文档]
| + | |
− | | + | |
− | ==错误代码==
| + | |
− | | + | |
− | 错误码
| + | |
| | | |
− | {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
| |
− | |-
| |
− | !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|错误码
| |
− | !width="40%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|错误msg
| |
− | !width="45%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|描述
| |
− | {{rdes_args|20001|live create error|创建直播失败}}
| |
− | {{rdes_args|20002|update weibo error|发微博失败}}
| |
− | {{rdes_args|20003|post param loss|post参数缺失}}
| |
− | {{rdes_args|20004|get param loss|get参数缺失}}
| |
− | {{rdes_args|20005|live delete error|删除直播失败}}
| |
− | {{rdes_args|20006|live update error|更新直播失败}}
| |
− | {{rdes_args|20007|send message error|评论失败}}
| |
− | {{rdes_args|20008|rsync message error|拉取失败}}
| |
− | {{rdes_args|20009|live id unexist|直播ID不存在}}
| |
− | {{rdes_args|20010|weibo content more than 130 word|微博文字超过130字了}}
| |
− | {{rdes_args|20011|msg content more than 100 word,or is null|评论文字超过100字了,或者为空}}
| |
− | {{rdes_args|20012|msg content type error|发言的文本类型错误}}
| |
− | {{rdes_args|20013|authority not allow|权限不够(appkey or uid不一致)}}
| |
− | {{rdes_args|20014|user not allow|uid不符合要求(目前微博直播只支持橙V认证用户、媒体&政务蓝V认证用户开通直播功能,不在此范围内的用户需通过芝麻认证或人工认证才能进行直播)}}
| |
− | |}
| |
| | | |
− | 示例:
| |
| | | |
− | <pre class="brush:js">
| + | __NOTOC__ |
− | { | + | {{#a:nobtns|noheading}} |
− | request :
| + | |
− | error_code :
| + | |
− | error :
| + | |
− | } | + | |
− | </pre>
| + | |