| | |
| | | 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; |
| | |
| | | @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监控 =========== |
| | |
| | | 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); |
| | | |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |