|  |  | 
 |  |  |    @Autowired
 | 
 |  |  |    private IVideoManagerStorager storager;
 | 
 |  |  | 
 | 
 |  |  |    @Autowired
 | 
 |  |  |    private ZLMRESTfulUtils zlmresTfulUtils;
 | 
 |  |  | 
 | 
 |  |  |    @Value("${media.ip}")
 | 
 |  |  |    private String mediaIp;
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |       }
 | 
 |  |  |       String app = json.getString("app");
 | 
 |  |  |       String streamId = json.getString("id");
 | 
 |  |  | //      String ssrc = String.format("%10d", Integer.parseInt(streamId, 16)); // ZLM 要求大写且首位补零
 | 
 |  |  |       String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16));
 | 
 |  |  |       StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc);
 | 
 |  |  |       if ("rtp".equals(app) && streamInfo != null ) {
 | 
 |  |  |          MediaServerConfig mediaInfo = storager.getMediaInfo();
 | 
 |  |  |          streamInfo.setFlv(String.format("http://%s:%s/rtp/%s.flv", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |          streamInfo.setWs_flv(String.format("ws://%s:%s/rtp/%s.flv", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |          streamInfo.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtmpPort(), streamId));
 | 
 |  |  |          streamInfo.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |          streamInfo.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtspPort(), streamId));
 | 
 |  |  |          storager.startPlay(streamInfo);
 | 
 |  |  |       if ("rtp".equals(app)) {
 | 
 |  |  |          String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16));
 | 
 |  |  |          StreamInfo streamInfoForPlay = storager.queryPlayBySSRC(ssrc);
 | 
 |  |  |          if ("rtp".equals(app) && streamInfoForPlay != null ) {
 | 
 |  |  |             MediaServerConfig mediaInfo = storager.getMediaInfo();
 | 
 |  |  |             streamInfoForPlay.setFlv(String.format("http://%s:%s/rtp/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |             streamInfoForPlay.setWs_flv(String.format("ws://%s:%s/rtp/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |             streamInfoForPlay.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaInfo.getWanIp(), mediaInfo.getRtmpPort(), streamId));
 | 
 |  |  |             streamInfoForPlay.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |             streamInfoForPlay.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaInfo.getWanIp(), mediaInfo.getRtspPort(), streamId));
 | 
 |  |  |             storager.startPlay(streamInfoForPlay);
 | 
 |  |  |          }
 | 
 |  |  | 
 | 
 |  |  |          StreamInfo streamInfoForPlayBack = storager.queryPlaybackBySSRC(ssrc);
 | 
 |  |  |          if ("rtp".equals(app) && streamInfoForPlayBack != null ) {
 | 
 |  |  |             MediaServerConfig mediaInfo = storager.getMediaInfo();
 | 
 |  |  |             streamInfoForPlayBack.setFlv(String.format("http://%s:%s/rtp/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |             streamInfoForPlayBack.setWs_flv(String.format("ws://%s:%s/rtp/%s.flv", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |             streamInfoForPlayBack.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaInfo.getWanIp(), mediaInfo.getRtmpPort(), streamId));
 | 
 |  |  |             streamInfoForPlayBack.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), streamId));
 | 
 |  |  |             streamInfoForPlayBack.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaInfo.getWanIp(), mediaInfo.getRtspPort(), streamId));
 | 
 |  |  |             storager.startPlayback(streamInfoForPlayBack);
 | 
 |  |  |          }
 | 
 |  |  |       }
 | 
 |  |  | 
 | 
 |  |  |       // TODO Auto-generated method stub
 | 
 |  |  | 
 |  |  |       String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16));
 | 
 |  |  |       StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc);
 | 
 |  |  |       if ("rtp".equals(app) && !regist ) {
 | 
 |  |  |          storager.stopPlay(streamInfo);
 | 
 |  |  |          if (streamInfo!=null){
 | 
 |  |  |             storager.stopPlay(streamInfo);
 | 
 |  |  |          }else{
 | 
 |  |  |             streamInfo = storager.queryPlaybackBySSRC(ssrc);
 | 
 |  |  |             storager.stopPlayback(streamInfo);
 | 
 |  |  |          }
 | 
 |  |  |       }
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |       String ssrc = String.format("%010d", numb); 
 | 
 |  |  |       
 | 
 |  |  |       cmder.streamByeCmd(ssrc);
 | 
 |  |  |       StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc);
 | 
 |  |  |       if (streamInfo!=null){
 | 
 |  |  |          storager.stopPlay(streamInfo);
 | 
 |  |  |       }else{
 | 
 |  |  |          streamInfo = storager.queryPlaybackBySSRC(ssrc);
 | 
 |  |  |          storager.stopPlayback(streamInfo);
 | 
 |  |  |       }
 | 
 |  |  |       
 | 
 |  |  |       JSONObject ret = new JSONObject();
 | 
 |  |  |       ret.put("code", 0);
 |