| README.md | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/hbbh/adapter/config/Swagger2Conf.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/hbbh/adapter/controller/MonibucaController.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/hbbh/adapter/controller/api/MonibucaAPI.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/hbbh/adapter/enums/TableEnum.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/hbbh/adapter/manager/MonibucaManager.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/hbbh/adapter/manager/impl/MonibucaManagerImpl.java | ●●●●● patch | view | raw | blame | history | |
| src/main/resources/application.properties | ●●●●● patch | view | raw | blame | history | |
| src/main/resources/public/index.html | ●●●●● patch | view | raw | blame | history |
README.md
@@ -6,7 +6,7 @@ ## V1.0 #### 准备工作 - 运行Monica实例机器IP - application.properties 必须配置: monica.ip , monica.port #### 已有功能 - 将rtsp流转换成 HLS,WebRTC,FLV.js,Jessibuca 并进行H5播放 src/main/java/com/hbbh/adapter/config/Swagger2Conf.java
@@ -12,8 +12,8 @@ import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; //@Configuration //@EnableSwagger2 @Configuration @EnableSwagger2 public class Swagger2Conf extends WebMvcConfigurationSupport { @Bean @@ -41,7 +41,7 @@ registry.addResourceHandler("/**").addResourceLocations( "classpath:/static/"); registry.addResourceHandler("swagger-ui.html").addResourceLocations( "classpath:/META-INF/resources/public/"); "classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**").addResourceLocations( "classpath:/META-INF/resources/webjars/"); super.addResourceHandlers(registry); src/main/java/com/hbbh/adapter/controller/MonibucaController.java
@@ -26,7 +26,7 @@ @Override @RequestMapping(value = "/test/video", method = RequestMethod.GET) @ApiOperation("test") @ApiOperation("parse") public String parseVideoRTSP() { try { String result = monibucaManager.parseVideo(); @@ -39,7 +39,14 @@ } @Override public void stopStream(String param) { @RequestMapping(value = "/video/stop", method = RequestMethod.GET) @ApiOperation("stop") public void stopStream(@RequestParam("param")String param) { try { monibucaManager.stopStream(param); } catch (Exception e) { log.error("接口:com.hbbh.adapter.controller.api.MonibucaAPIController.parseVideoRTSP 调用失败"); e.printStackTrace(); } } } src/main/java/com/hbbh/adapter/controller/api/MonibucaAPI.java
@@ -15,8 +15,8 @@ public String parseVideoRTSP(); /** * 中止已经产生的视频流 * @param param streamPath地址 * 示例: http://localhost:8081/api/stop?stream=live/test */ public void stopStream(String param); } src/main/java/com/hbbh/adapter/enums/TableEnum.java
File was deleted src/main/java/com/hbbh/adapter/manager/MonibucaManager.java
@@ -21,4 +21,9 @@ * */ String parseVideo(); /** * @param param StreamPath 是发布流的唯一标识 */ void stopStream(String param); } src/main/java/com/hbbh/adapter/manager/impl/MonibucaManagerImpl.java
@@ -7,6 +7,9 @@ import com.hbbh.adapter.vo.CallResult; import com.hbbh.adapter.vo.MessageVO; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.LinkedHashMap; @@ -16,12 +19,23 @@ @Service public class MonibucaManagerImpl implements MonibucaManager { private static final Logger log = LoggerFactory.getLogger(Class.class); @Value("${monica.ip}") private String monicaIP; @Value("${monica.port}") private String monicaPort; //入参 rtsp视频流 private String rtspDemo="rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"; //返回结果,通过配置文件即可反推得到 前提是调用 rtsp/pull 接口成功 private String jessibucaDemo="ws://localhost:8080/live/test.flv"; //StreamPath 是发布流的唯一标识 private String streamPath="live/test"; // =========== monica监控 =========== @@ -37,7 +51,7 @@ String url="http://localhost:8081/rtsp/pull"; Map<String, String> params = Maps.newLinkedHashMap(); params.put("target",rtspDemo); params.put("streamPath","live/test"); params.put("streamPath",streamPath); String result = HttpClientUtil.doGet(url, params); @@ -50,4 +64,18 @@ } return jessibucaDemo; } /** * * @param param StreamPath 是发布流的唯一标识 * 示例: http://localhost:8081/api/stop?stream=live/test */ @Override public void stopStream(String param) { String url="http://"+monicaIP+":"+monicaPort+"/api/stop"; Map<String, String> params = Maps.newLinkedHashMap(); params.put("stream",param); String result = HttpClientUtil.doGet(url, params); log.info("调用 Monibuca 执行结果 : {}",result); } } src/main/resources/application.properties
@@ -42,3 +42,7 @@ #springmvc访问静态页 spring.mvc.static-path-pattern=/public/* #Monibuca info monica.ip=localhost monica.port=8081 src/main/resources/public/index.html
@@ -142,7 +142,12 @@ } isPlaying = false; stop(); $.get("http://127.0.0.1:8088/monica/video/stop?param=live/test", function () { alert("视频流已关闭"); h5lc.close() } ); //stop(); $playDom.style.display = 'block'; $stopDom.style.display = 'none'; @@ -153,7 +158,7 @@ //h5lc.play("ws://" + (firstResponseIp || source) + ":8080/live/" + stream) //h5lc.play("ws://pull2.afb1188.com/live/" + stream + ".flv") //h5lc.play("ws://localhost:8080/live/" + stream) h5lc.play("ws://localhost:8080/live/test.flv") //h5lc.play("ws://localhost:8080/live/test.flv") // h5lc.play("ws://119.9.118.39:8080/live/user1", canvas) // h5lc.play("ws://test.qihaipi.com/gnddragon/test.flv", canvas) // h5lc.play("ws://localhost:8080/live/test.flv", canvas)