修复ui开启音频无法播放的bug

修复可能导致录象查看的bug
修复开启openRTPServer时的bug
This commit is contained in:
648540858
2020-10-19 14:25:41 +08:00
parent 04af6de363
commit 36cd31d69d
9 changed files with 62 additions and 48 deletions

View File

@@ -64,18 +64,25 @@ public class PlayController {
while (lockFlag) {
try {
if (System.currentTimeMillis() - startTime > 15 * 1000) {
storager.stopPlay(streamInfo);
return new ResponseEntity<String>("timeout",HttpStatus.OK);
}else {
streamInfo = storager.queryPlayByDevice(deviceId, channelId);
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
if (rtpInfo == null || !rtpInfo.getBoolean("exist") || storager.queryPlayByDevice(deviceId, channelId).getFlv() == null){
if (rtpInfo != null && rtpInfo.getBoolean("exist") && streamInfo.getFlv() != null){
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo("rtp", "rtmp", streamId);
if (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")) {
lockFlag = false;
JSONArray tracks = mediaInfo.getJSONArray("tracks");
streamInfo.setTracks(tracks);
storager.startPlay(streamInfo);
}else {
}
}else {
Thread.sleep(2000);
continue;
}else {
lockFlag = false;
streamInfo = storager.queryPlay(streamInfo);
};
}
} catch (InterruptedException e) {