| | |
| | | package com.genersoft.iot.vmp.media.zlm;
|
| | |
|
| | | import java.math.BigInteger;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONArray;
|
| | | import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
| | | import com.genersoft.iot.vmp.utils.IpUtil;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | |
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | /**
|
| | | * @Description:针对 ZLMediaServer的hook事件监听
|
| | | * @author: swwheihei
|
| | |
| | |
|
| | | @Autowired
|
| | | private SIPCommander cmder;
|
| | |
|
| | | @Autowired
|
| | | private IVideoManagerStorager storager;
|
| | |
|
| | | /**
|
| | | * 流量统计事件,播放器或推流器断开时并且耗用流量超过特定阈值时会触发此事件,阈值通过配置文件general.flowThreshold配置;此事件对回复不敏感。
|
| | |
| | | */
|
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_server_started", produces = "application/json;charset=UTF-8")
|
| | | public ResponseEntity<String> onServerStarted(@RequestBody JSONObject json){
|
| | | public ResponseEntity<String> onServerStarted(HttpServletRequest request, @RequestBody JSONObject json){
|
| | |
|
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("ZLM HOOK on_server_started API调用,参数:" + json.toString());
|
| | | }
|
| | |
|
| | | // String data = json.getString("data");
|
| | | // List<MediaServerConfig> mediaServerConfigs = JSON.parseArray(JSON.toJSONString(json), MediaServerConfig.class);
|
| | | // MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0);
|
| | | MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class);
|
| | | storager.updateMediaInfo(mediaServerConfig);
|
| | | // TODO Auto-generated method stub
|
| | |
|
| | | JSONObject ret = new JSONObject();
|