LiveQing流媒体服务器软件,提供一站式的转码、点播、直播、时移回放服务,极大地简化了开发和集成的工作。

其中,点播功能主要包含:上传、转码、分发。直播功能,主要包含:直播、录像, 直播支持RTMP输入,RTMP/HLS/HTTP-FLV的分发输出;录像支持自定义保存时长、检索及下载。提供丰富的二次开发接口,基于JSON的封装及HTTP调用。提供播放鉴权、推流鉴权等安全保证。提供用户及相关权限管理配置。

一、 接口列表

http://demo.liveqing.com:10080/apidoc/

二、 集成二次开发

二次开发中,方式是在自己业务系统后端登录接口中,调用流媒体的登录接口,获取所需的sid或是token

1. 封闭内网使用

在业务使用,如果只是使用LiveQing提供视频分发能力,且不会对外公开接口端口10080(默认端口),可以直接将接口鉴权关闭,具体服务器登录 http://localhost:10080 默认用户名/密码 admin/admin, 在 基础配置 页面,【接口鉴权】开关。

2. 业务系统对接(两种方式)

2.1 cookie方式

注: HttpOnly = true 客户端API(例如JavaScript)无法访问仅限http的cookie。 此限制通过跨站点脚本(XSS)消除了cookie被盗的威胁。

  1. 在后端业务代码中对接,如Java/PHP/Node.js 等

  2. 调用LiveQing登录接口,接口调用成功后会在请求Headers的cookie中写入sid

  3. 取出cookie里的sid

  4. 其它接口调用时在请求头cookies中传递sid

  5. Content-Type:application/x-www-form-urlencoded

  6. 接口请求路径示例:http://localhost:10080/login

代码示例:Java

2.1.1 获取sid

  import java.io.DataOutputStream;import java.net.HttpURLConnection;import java.net.URL;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.Set;public class GetLoginSid {public static void main(String[] args) throws Exception {URL url = new URL("http://cloud.liveqing.com:10080/login");//发起POST请求,并传递username,password参数(需要md5加密)HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);conn.setDoInput(true);conn.setRequestMethod("POST");     conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");DataOutputStream out = new DataOutputStream(conn.getOutputStream()); String content = "username=admin&password=21232f297a57a5a743894a0e4a801fc3";out.writeBytes(content);out.flush(); out.close();Map<String, List<String>> headerFields = conn.getHeaderFields();Set<String> headerFieldsSet = headerFields.keySet();Iterator<String> hearerFieldsIter = headerFieldsSet.iterator();while (hearerFieldsIter.hasNext()) {String headerFieldKey = hearerFieldsIter.next();if ("Set-Cookie".equalsIgnoreCase(headerFieldKey)) {List<String> headerFieldValue = headerFields.get(headerFieldKey);for (String headerValue : headerFieldValue) {String[] fields = headerValue.split(";\\s*");for (int j = 0; j < fields.length; j++) {if (fields[j].indexOf('=') > 0) {String[] f = fields[j].split("=");if ("Expires".equalsIgnoreCase(f[0])) {                       System.out.println("Expires:" + f[1]);}else if ("Max-Age".equalsIgnoreCase(f[0])) {                 System.out.println("Max-Age:" + f[1]);}else if ("sid".equalsIgnoreCase(f[0])) {  //获取sid   System.out.println("sid:" + f[1]);}}}}}}}}

运行如下

2.1.2 携带sid调用其它接口

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;public class RequestOtherAPI {public static void main(String[] args) throws Exception {URL url = new URL("http://demo.liveqing.com:10080/live/list");HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);conn.setDoInput(true);conn.setRequestMethod("POST");     conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");//这里传递上一步获得sidconn.setRequestProperty("Cookie","sid=s%3Ark-TEuVtm.WnWoXuDY%2FldJuEc64I6TXjd0Fq1eqByEd4ng1UwNb2I;");DataOutputStream out = new DataOutputStream(conn.getOutputStream()); String content = "start=0&limit=10";out.writeBytes(content);out.flush(); out.close();conn.connect();StringBuffer sbf = new StringBuffer();InputStream is = conn.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));String strRead = null;while ((strRead = reader.readLine()) != null) {sbf.append(strRead);sbf.append("\r\n");}reader.close();System.out.println(sbf.toString());}}

2.2 token方式

  1. 调用登录接口获取token,调用时传递 onlytoken=true
    如: http://demo.liveqing.com:10080/login?username=admin&password=21232f29757a5a&onlytoken=true

  2. Content-Type:application/x-www-form-urlencoded

  3. 其它接口调用时传递附加token入参

代码示例:Java

2.2.1 获取token

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;public class GetLoginToken {public static void main(String[] args) throws Exception {URL url = new URL("http://localhost:10080/login");HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);conn.setDoInput(true);conn.setRequestMethod("POST");     conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");DataOutputStream out = new DataOutputStream(conn.getOutputStream()); String content = "username=admin&password=21232f297a57a5a743894a0e4a801fc3";out.writeBytes(content);out.flush(); out.close();conn.connect();StringBuffer sbf = new StringBuffer();InputStream is = conn.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));String strRead = null;while ((strRead = reader.readLine()) != null) {sbf.append(strRead);sbf.append("\r\n");}reader.close();System.out.println(sbf.toString());}}

运行如下

2.2.2 携带token调用其它接口

其他接口调用时,附加token入参

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;public class RequestOtherAPIByToken {
public static void main(String[] args) throws Exception {URL url = new URL("http://localhost:10080/live/list");HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);conn.setDoInput(true);conn.setRequestMethod("POST");     conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");DataOutputStream out = new DataOutputStream(conn.getOutputStream()); String content = "start=0&limit=10&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Mzc3NzExNTAsInB3IjoiMjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzMiLCJ0bSI6MTUzNzY4NDc1MCwidW4iOiJhZG1pbiJ9.b1U-R-_HVKV9reWRD50327B1ztUqs3gowUGi_lDzlmU";out.writeBytes(content);out.flush(); out.close();conn.connect();StringBuffer sbf = new StringBuffer();InputStream is = conn.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));String strRead = null;while ((strRead = reader.readLine()) != null) {sbf.append(strRead);sbf.append("\r\n");}reader.close();System.out.println(sbf.toString());}
}

运行如下

视频点播RTMP推流直播流媒体服务二次开发集成接口相关推荐

  1. LiveQing视频点播RTMP推流直播服务支持H5无插件WebRTC超低延时视频直播

    LiveQing视频点播RTMP推流直播服务支持H5无插件WebRTC超低延时视频直播 1.WebRTC超低延时视频直播 2.WebRTC延时对比 3.LiveQing播放WebRTC流 4.分屏页面 ...

  2. java 直播rtmp推流_如何设置rtmp推流直播(斗鱼,腾讯云,yy等直播)?

    如何设置rtmp推流直播(斗鱼,腾讯云,yy,虎牙,花椒等直播)? 一:打开软件-->开启任意通道, 打开源后,运行,预览窗口可以看到画面.有信号转播推流. 二:左下角主菜单-->系统配置 ...

  3. RTMP推流直播流媒体平台LiveQing鉴权直播拉转直播开放直播支持推送总流量和播放总流量统计

    RTMP推流直播流媒体平台LiveQing鉴权直播拉转直播开放直播支持推送总流量和播放总流量统计 1.鉴权直播中的相关统计 2.拉转直播中的相关统计 3.RTMP推流视频直播和点播流媒体服务 1.鉴权 ...

  4. 心得:大疆无人机RTMP推流直播(Windows版本已成功)

    大疆无人机rtmp推流直播到电脑(Windows版本已成功) 一.所需资源 二.安装 三.ffmpeg推流 四.无人机rtmp推流 五.Python获取无人机实时视频 一.所需资源 1.nginx的G ...

  5. 干货:H.265编码RTMP推流直播摄像头

    了解直播行业的同仁们都知道,前端采集的摄像机码率越小,整个直播链路成本就越小,而且给客户的直播体验更好,因为码率越小,占用的上行带宽越少,服务器存储成本越小,客户端播放的视频就越流畅. 叁陆伍视讯,成 ...

  6. onlyoffice二次开发集成、onlyoffic集成

    onlyoffice二次开发集成.onlyoffic集成 支持功能 新增word,excel,ppt文档 在线多用户协同编辑文档 实时通讯 批注等功能 下面是demo的功能截图(架构:springbo ...

  7. 泛微OA二次开发后处理接口编写

    泛微OA二次开发后处理接口编写 一.所需的依赖文件 二.demo代码解析 三.小技巧 四.注意事项 一.所需的依赖文件 weaver.soa.workflow.request.RequestInfo ...

  8. 基于EasyNVR摄像机网页无插件直播服务二次开发实现H5播放页面的简单集成方案...

    我们通常在构架一套视频SaaS应用的过程中,将平台设计为3层:视频硬件层(视频源).视频能力平台(vPaaS).视频应用平台(vSaaS),视频硬件包括各种IPC.NVR.编码器等视频生成设备,vPa ...

  9. 基于EasyNVR摄像机无插件直播方案二次开发实现自己的摄像机IPC-NVR无插件化直播解决方案

    背景介绍 在之前的博客中<基于EasyNVR实现RTSP/Onvif监控摄像头Web无插件化直播监控>,对EasyNVR所实现的功能我们已经有较多描述,这些也在方案地址:http://ww ...

最新文章

  1. Perforce使用之创建DEPOT流程
  2. 关于VS2005不能更改字体的问题
  3. Bootstrap4+MySQL前后端综合实训-Day03-AM【折叠、模态框】
  4. android 屏幕切换监听
  5. 中国石油大学计算机控制实验,《计算机控制》实验讲义.doc
  6. 我的100篇随笔纪念,关于JScript开发
  7. wxt_hillwill的知识脉络
  8. NPM酷库:uuid,生成随机ID
  9. 绝对定位的图 说明初始包含块是viewport 而不是body/html
  10. [UML]UML系列——类图class的实现关系Realization
  11. 看故事也能长知识,CPU的工作原理原来这么简单!
  12. 数据库系统的体系结构
  13. 图解物联网---物联网基础知识
  14. 【AD15绘制原理图编译的一些警告的处理】
  15. ReactNative进阶(五十三):Keystore file ‘..android.keystore‘ not found for signing config ‘debug‘问题解决
  16. 山寨机java游戏下载_Q版水浒-山寨英雄
  17. 浅谈Java对接阿里IOT
  18. 腾讯数据分析师认证!
  19. python红楼梦绘制词云形状图_python数据挖掘实战笔记——文本挖掘(5):词云美化之绘制《红楼梦》词云图...
  20. unity3d学习之镜头耀斑

热门文章

  1. Win10下安装Spark的尝试总结(尚未出坑)
  2. [课程复习] 软件工程导论之经典题目回顾 (一)选择题、填空题1
  3. 中小学教师计算机水平考试及答案,中小学教师计算机水平考试题.doc
  4. Spring春风拂面系列---SpringBoot之@EnableAutoConfiguration注解
  5. Cisco路由器上配置3A认证的故障调试
  6. 难道真的忘记放洗衣粉了??
  7. 亚马逊全球开店戴竫斐:2021中国出口跨境电商的蜕变与破局
  8. 使用 nginx 做加速
  9. 魔兽美服服务器维护,魔兽世界怀旧服:美服TAQ开门失败!服务器承受不了如今的热度!...
  10. 前端---HTML设置圆角边框