| | |
| | | AudioBroadcastResult audioBroadcastResult = new AudioBroadcastResult(); |
| | | audioBroadcastResult.setApp(app); |
| | | audioBroadcastResult.setStream(stream); |
| | | audioBroadcastResult.setStreamInfo(mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, stream, null, null, false)); |
| | | audioBroadcastResult.setStreamInfo(mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, stream, null, null, null,false)); |
| | | audioBroadcastResult.setCodec("G.711"); |
| | | wvpResult.setData(audioBroadcastResult); |
| | | RequestMessage requestMessage = new RequestMessage(); |
| | |
| | |
|
| | | logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
|
| | | JSONObject ret = new JSONObject();
|
| | | if (!"rtp".equals(param.getApp())) {
|
| | | if (!"rtp".equals(param.getApp()) && !"broadcast".equals(param.getApp())) {
|
| | | // 推流鉴权
|
| | | if (param.getParams() == null) {
|
| | | logger.info("推流鉴权失败: 缺少不要参数:sign=md5(user表的pushKey)");
|
| | |
| | | * @param stream |
| | | * @return |
| | | */ |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, boolean isPlay); |
| | | StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId, boolean isPlay); |
| | | } |
| | |
| | | param.put("general.continue_push_ms", "3000" ); |
| | | // 最多等待未初始化的Track时间,单位毫秒,超时之后会忽略未初始化的Track, 设置此选项优化那些音频错误的不规范流, |
| | | // 等zlm支持给每个rtpServer设置关闭音频的时候可以不设置此选项 |
| | | param.put("general.wait_track_ready_ms", "3000" ); |
| | | // param.put("general.wait_track_ready_ms", "3000" ); |
| | | if (mediaServerItem.isRtpEnable() && !StringUtils.isEmpty(mediaServerItem.getRtpPortRange())) { |
| | | param.put("rtp_proxy.port_range", mediaServerItem.getRtpPortRange().replace(",", "-")); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) { |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId); |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId, true); |
| | | } |
| | | |
| | | @Override |
| | |
| | | JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class); |
| | | JSONArray tracks = mediaJSON.getJSONArray("tracks"); |
| | | if (authority) { |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, streamAuthorityInfo.getCallId()); |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, streamAuthorityInfo.getCallId(), true); |
| | | }else { |
| | | streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null); |
| | | } |
| | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority) { |
| | | return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null, authority); |
| | | } |
| | | |
| | | @Override |
| | | public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr) { |
| | | return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr, true); |
| | | } |
| | | |
| | | @Override |
| | |
| | | this.broadcastStatus = 0; |
| | | }else if (e === "connected") { |
| | | this.broadcastStatus = 1; |
| | | }else { |
| | | }else if (e === "disconnected") { |
| | | this.broadcastStatus = -1; |
| | | } |
| | | }); |