Browse Source

优化保活功能,客户端不再需要调用ping保活。转码为rtmp和hls的操作流程统一为:注册->播放

huangfei 2 năm trước cách đây
mục cha
commit
bf988d68d7

+ 7 - 10
README.md

@@ -6,24 +6,21 @@
 
 #### 二. 将视频流转为HLS并播放
 
-1. 调用 http://{server}:{port}/stream/url/encode 接口将直播地址编码处理为key
-2. 调用 http://{server}:{port}/stream/live/openHls/{key} 接口开始流转换
-3. 使用hls.js播放 http://{server}:{port}/stream/live/{key}/play.m3u8
-4. 定时访问 http://{server}:{port}/stream/live/ping/{key} 保持转换任务运行
-
-启动后访问:  http://{server}:{port}/stream/static/hls.html 可查看示例
+1. 调用 http://{server}:{port}/converter/register 接口,输入${直播源地址url}和"hls",将直播地址编码处理为key
+2. 使用hls.js播放 http://{server}:{port}/stream/live/{key}/play.m3u8
 
 #### 三. 将视频流转为FLV并播放
 
-1. 调用 http://{server}:{port}/stream/url/encode 接口将直播地址编码处理为key
+1. 调用 http://{server}:{port}/converter/register 接口,输入${直播源地址url}和"flv",将直播地址编码处理为key
 2. 使用flv.js播放 http://{server}:{port}/stream/live/{key}.flv
-3. 定时访问 http://{server}:{port}/stream/live/ping/{key} 保持转换任务运行
 
 启动后访问:  
-http://{server}:{port}/stream/static/rtmp.html 可查看rtsp转rtmp示例
-
 http://{server}:{port}/stream/static/hls.html 可查看rtsp转hls示例
 
+http://{server}:{port}/stream/static/flv.html 可查看rtsp转rtmp示例
+
+
+
 
 
 

+ 4 - 2
src/main/java/com/coyee/stream/StreamApplication.java

@@ -10,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.cache.annotation.EnableCaching;
 
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.io.File;
 import java.util.List;
@@ -42,6 +43,7 @@ public class StreamApplication implements ApplicationRunner {
 
     /**
      * 从文件中初始化转换器
+     *
      * @param args
      * @param variableName
      * @param format
@@ -55,8 +57,8 @@ public class StreamApplication implements ApplicationRunner {
         File sourceFile = new File(filename);
         if (sourceFile.exists()) {
             ConverterFactory.registerFromFile(sourceFile, format);
-        }else{
-            log.error("批量初始化的文件{}不存在!",sourceFileList);
+        } else {
+            log.error("批量初始化的文件{}不存在!", sourceFileList);
         }
     }
 }

+ 0 - 4
src/main/java/com/coyee/stream/config/StreamServerConfig.java

@@ -25,10 +25,6 @@ import java.util.List;
 @ConfigurationProperties("streamserver")
 @Slf4j
 public class StreamServerConfig {
-    /**
-     * 加密key
-     */
-    private String desKey;
     /**
      * 转为hls协议时m3u8、TS文件的存储目录
      */

+ 1 - 2
src/main/resources/application.yml

@@ -22,10 +22,9 @@ server:
   servlet:
     context-path: /stream
 streamserver:
-  desKey: hxfein@2
+  expireMills: -1
   hlsStoreDir: /home/hls
   hlsTime: 5
   hlsWrap: 10
   hlsListSize: 8
-  expireMills: -1
   m3u8ExpireMills: 6000