EasyDSS流媒体服务器软件,提供一站式的转码、点播、直播、时移回放服务,极大地简化了开发和集成的工作。其中,点播版本主要包含:上传、转码、分发。直播版本,主要包含:直播、录像, 直播支持RTMP输入,RTMP/HLS/HTTP-FLV的分发输出;录像支持自定义保存时长、检索及下载。提供丰富的二次开发接口,基于JSON的封装及HTTP调用。提供播放鉴权、推流鉴权等安全保证。提供用户及相关权限管理配置。

相关资源路径:

【官网】

【点播版本在线演示】

【直播版本在线演示】

【旗舰版本在线演示】

【在线接口】

这篇博文主要介绍如何利用软件提供的接口快速接入开发。

一、 快速安装

  1. 下载地址
  2. 下载对应环境的安装包
  3. 解压安装包
  4. Windows下双击EasyDSS.exe直接启动
  5. Linux下解压目录执行./start.sh

注:路径中不能包含中文

二、 二次开发

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

1. 封闭内网使用

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

2. 业务系统对接

2.1 cookie方式

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

  1. 在后端业务代码中对接,如Java/PHP/Node.js 等
  2. 调用EasyDSS登录接口,接口调用成功后会在请求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://demo.easydss.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.easydss.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");
//这里传递上一步获得sid
conn.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
  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());
}
}

运行如下

获取更多信息

QQ交流群:560148162

WEB:www.easydss.com

Copyright © EasyDSS.com 2012-2018

EasyDSS点播与直播服务器软件-二次开发接口对接说明示列的更多相关文章

  1. EasyDSS高性能RTMP、HLS(m3u8)、HTTP-FLV、RTSP流媒体服务器软件二次开发接口对接说明示列

    EasyDSS相关功能 EasyDSS流媒体服务器软件,提供一站式的转码.点播.直播.时移回放服务,极大地简化了开发和集成的工作.其中,点播版本主要包含:上传.转码.分发.直播版本主要包含:直播.录像 ...

  2. EasyNVR无插件直播服务器软件接口调用返回“Unauthorized”最简单的处理方式

    背景需求 对于EasyNVR的受众群体十分的广泛,不仅仅有将EasyNVR作为视频直播平台直接使用的,更多的是使用EasyNVR的对应功能集成到自身系统.对于前者,只需要将软件的使用功能搞清楚即可,对 ...

  3. EasyNVR摄像机网页H5全平台无插件直播流媒体播放服务二次开发之接口鉴权示例讲解

    背景需求 EasyNVR的使用者应该都清楚的了解到,EasyNVR一个强大的功能就是可以进行全平台的无插件直播.主要原因在于rtsp协议的视频流(默认是需要插件才可以播放的)经由EasyNVR处理可以 ...

  4. EasyNVR无插件直播服务器软件览器低延时播放监控摄像头视频(EasyNVR播放FLV视频流)

    背景描述 EasyNVR的使用者应该都是清楚的了解到,EasyNVR一个强大的功能就是可以进行全平台的无插件直播.主要原因在于rtsp协议的视频流(默认是需要插件才可以播放的)经由EasyNVR处理可 ...

  5. EasyNVR无插件直播服务器软件使用详情功能 - 录像功能说明

    背景介绍 EasyNVR不仅仅拥有无插件的直播功能,更拥有对于直播录像的存储和日期检索功能: 本篇博文主要用于介绍EasyNVR的录像功能. 之前有博文介绍相关的录像功能,本篇主要为了介绍录像的新功能 ...

  6. EasyNVR无插件直播服务器软件使用详情功能-通道配置Excel

    背景需求 使用EasyNVR的用户都有知道,由于EasyNVR是将设备与EasyNVR的通道进行绑定的,因此EasyNVR是通过手动的通道配置来进行设备接入的,这样可以做到将设备的和通道对应的接入.但 ...

  7. EasyNVR无插件直播服务器软件如何自己更改web界面(网页的自定修改)

    背景需求 很多用户都在使用了EasyNVR,看到EasyNVR自身带有的界面后有这样的需求,就是需要更改一下web前端的一些样式,当前EasyhNVR为3.0版本,web前端为了增加前端的运行效率和减 ...

  8. Qt 加载Leap motion 手势识别软件 二次开发 hello world

    研发需要对收拾是被进行精确定位,实现收拾的识别,和在虚拟现实中精确的显示手势在实际世界中的位置. 开始使用的Qt mingw的版本开发,总是函数没有定义,最后发现是leap sdk中需要代育vs的库文 ...

  9. SkylineGlobe 如何使用二次开发接口创建粒子效果

    SkylineGlobe在6.6版本,ICreator66接口新增加了CreateEffect方法,用来创建粒子效果对象: 以及ITerrainEffect66对象接口,可以灵活设置粒子效果对象的相关 ...

随机推荐

  1. 将ascll码转换成数值进行运算

    #include "stdlib.h"#include "stdio.h"int main() { char a[8] = { 49,32,33,61,62,6 ...

  2. Ubuntu14.04终端主机名+用户名修改配色方案

    首先打开终端:输入指令ls -a 然后输入指令:vi .bashrc 先按下字母A,进入编写: 在文档最后一行添加: PS1='${debian_chroot:+($debian_chroot)}\[ ...

  3. ElasticSearch refresh和flush的理解

    在索引数据的时候,要保证被索引的文档能够立即被搜索到,就要涉及到_refresh 和_flush这两个方法. 1.fresh 当索引一个文档,文档先是被存储在内存里面,默认1秒后,会进入文件系统缓存, ...

  4. AJAX2.0

    Ajax2.0 早期的ajax技术不支持异步文件上传 在后面更新了ajax2.0版本  支持文件上传了 但需要借助一个对象----FormData对象 Ajax2.0大体的步骤跟以前是一样的  但也是 ...

  5. Location配置与ReWrite语法

    1 Location语法规则 1.1 Location规则 语法规则: location [=|~|~*|^~] /uri/ {… } 首先匹配 =,其次匹配^~,其次是按文件中顺序的正则匹配,最后是 ...

  6. HDU1789 Doing Homework again 【贪心】

    Doing Homework again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  7. 【VBA】获取模板保存的路径

    使用VBA如何获取模板保存的路径呢?具体代码如下: Sub 获取Excle模板保存路径() MsgBox "获取Excle模板保存路径:" & Application.Te ...

  8. 远程链接mysql数据库

    mysql -P3306 -uroot -proot 显示最大连接数 show variables like '%max_connections%'; 设置最大链接数 ;//默认100--只对当前进程 ...

  9. Android 报错记录

     IOException java.io.IOException: Permission denied: 权限不足.原因可能是: 未加入权限 <uses-permission android ...

  10. ASP.NET CORE RAZOR :将搜索添加到 Razor 页面应用

    https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/razor-pages/search 本文档中,将向索引页面添加搜索功能以实现按“流派”或 ...