增加推流转发到国标,尚不完善
This commit is contained in:
parent
f83a192bfd
commit
b17280522b
@ -12,6 +12,7 @@ public class GbStream extends PlatformGbStream{
|
|||||||
private double longitude;
|
private double longitude;
|
||||||
private double latitude;
|
private double latitude;
|
||||||
private String streamType;
|
private String streamType;
|
||||||
|
private boolean status;
|
||||||
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
@ -68,4 +69,12 @@ public class GbStream extends PlatformGbStream{
|
|||||||
public void setStreamType(String streamType) {
|
public void setStreamType(String streamType) {
|
||||||
this.streamType = streamType;
|
this.streamType = streamType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(boolean status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,5 @@ public class PlatformGbStream {
|
|||||||
public void setPlatformId(String platformId) {
|
public void setPlatformId(String platformId) {
|
||||||
this.platformId = platformId;
|
this.platformId = platformId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
|||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.response.impl.*;
|
import com.genersoft.iot.vmp.gb28181.transmit.response.impl.*;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
// import org.slf4j.Logger;
|
// import org.slf4j.Logger;
|
||||||
// import org.slf4j.LoggerFactory;
|
// import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -13,24 +13,20 @@ import javax.sip.message.Response;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import gov.nist.javax.sip.address.AddressImpl;
|
import gov.nist.javax.sip.address.AddressImpl;
|
||||||
import gov.nist.javax.sip.address.SipUri;
|
import gov.nist.javax.sip.address.SipUri;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -549,7 +549,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
|
|||||||
deviceChannel.setLatitude(gbStream.getLatitude());
|
deviceChannel.setLatitude(gbStream.getLatitude());
|
||||||
deviceChannel.setDeviceId(parentPlatform.getDeviceGBId());
|
deviceChannel.setDeviceId(parentPlatform.getDeviceGBId());
|
||||||
deviceChannel.setManufacture("wvp-pro");
|
deviceChannel.setManufacture("wvp-pro");
|
||||||
deviceChannel.setStatus(1);
|
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
||||||
// deviceChannel.setParentId(parentPlatform.getDeviceGBId());
|
// deviceChannel.setParentId(parentPlatform.getDeviceGBId());
|
||||||
deviceChannel.setRegisterWay(1);
|
deviceChannel.setRegisterWay(1);
|
||||||
deviceChannel.setCivilCode(cmder.getSipConfig().getSipDomain());
|
deviceChannel.setCivilCode(cmder.getSipConfig().getSipDomain());
|
||||||
|
@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
|||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -240,8 +240,9 @@ public class ZLMHttpHookListener {
|
|||||||
String streamId = json.getString("stream");
|
String streamId = json.getString("stream");
|
||||||
String schema = json.getString("schema");
|
String schema = json.getString("schema");
|
||||||
boolean regist = json.getBoolean("regist");
|
boolean regist = json.getBoolean("regist");
|
||||||
StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
|
||||||
if ("rtp".equals(app) && !regist ) {
|
if ("rtp".equals(app) && !regist ) {
|
||||||
|
StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
||||||
if (streamInfo!=null){
|
if (streamInfo!=null){
|
||||||
redisCatchStorage.stopPlay(streamInfo);
|
redisCatchStorage.stopPlay(streamInfo);
|
||||||
storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
|
storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
|
||||||
@ -250,8 +251,12 @@ public class ZLMHttpHookListener {
|
|||||||
redisCatchStorage.stopPlayback(streamInfo);
|
redisCatchStorage.stopPlayback(streamInfo);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (!"rtp".equals(app) && "rtsp".equals(schema)){
|
if (!"rtp".equals(app) && "rtmp".equals(schema)){
|
||||||
zlmMediaListManager.updateMediaList();
|
if (regist) {
|
||||||
|
zlmMediaListManager.addMedia(app, streamId);
|
||||||
|
}else {
|
||||||
|
zlmMediaListManager.removeMedia(app, streamId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject ret = new JSONObject();
|
JSONObject ret = new JSONObject();
|
||||||
|
@ -70,6 +70,11 @@ public class ZLMHttpHookSubscribe {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个类型的所有的订阅
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<ZLMHttpHookSubscribe.Event> getSubscribes(HookType type) {
|
public List<ZLMHttpHookSubscribe.Event> getSubscribes(HookType type) {
|
||||||
ZLMHttpHookSubscribe.Event event= null;
|
ZLMHttpHookSubscribe.Event event= null;
|
||||||
Map<JSONObject, Event> eventMap = allSubscribes.get(type);
|
Map<JSONObject, Event> eventMap = allSubscribes.get(type);
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
package com.genersoft.iot.vmp.media.zlm;
|
package com.genersoft.iot.vmp.media.zlm;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.TypeReference;
|
import com.alibaba.fastjson.TypeReference;
|
||||||
import com.genersoft.iot.vmp.common.RealVideo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.SsrcUtil;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
||||||
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.impl.RedisCatchStorageImpl;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -29,60 +30,79 @@ public class ZLMMediaListManager {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IVideoManagerStorager storager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GbStreamMapper gbStreamMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PlatformGbStreamMapper platformGbStreamMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStreamPushService streamPushService;
|
||||||
|
|
||||||
|
|
||||||
public void updateMediaList() {
|
public void updateMediaList() {
|
||||||
JSONObject mediaList = zlmresTfulUtils.getMediaList();
|
storager.clearMediaList();
|
||||||
|
|
||||||
|
// 使用异步的当时更新媒体流列表
|
||||||
|
zlmresTfulUtils.getMediaList((mediaList ->{
|
||||||
if (mediaList == null) return;
|
if (mediaList == null) return;
|
||||||
String dataStr = mediaList.getString("data");
|
String dataStr = mediaList.getString("data");
|
||||||
|
|
||||||
Integer code = mediaList.getInteger("code");
|
Integer code = mediaList.getInteger("code");
|
||||||
Map<String, RealVideo> result = new HashMap<>();
|
Map<String, StreamPushItem> result = new HashMap<>();
|
||||||
|
List<StreamPushItem> streamPushItems = null;
|
||||||
|
// 获取所有的国标关联
|
||||||
|
List<GbStream> gbStreams = gbStreamMapper.selectAll();
|
||||||
if (code == 0 ) {
|
if (code == 0 ) {
|
||||||
if (dataStr != null) {
|
if (dataStr != null) {
|
||||||
List<MediaItem> mediaItems = JSON.parseObject(dataStr, new TypeReference<List<MediaItem>>() {});
|
streamPushItems = streamPushService.handleJSON(dataStr);
|
||||||
for (MediaItem item : mediaItems) {
|
|
||||||
if ("rtp".equals(item.getApp())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String key = item.getApp() + "_" + item.getStream();
|
|
||||||
RealVideo realVideo = result.get(key);
|
|
||||||
if (realVideo == null) {
|
|
||||||
realVideo = new RealVideo();
|
|
||||||
realVideo.setApp(item.getApp());
|
|
||||||
realVideo.setStream(item.getStream());
|
|
||||||
realVideo.setAliveSecond(item.getAliveSecond());
|
|
||||||
realVideo.setCreateStamp(item.getCreateStamp());
|
|
||||||
realVideo.setOriginSock(item.getOriginSock());
|
|
||||||
realVideo.setTotalReaderCount(item.getTotalReaderCount());
|
|
||||||
realVideo.setOriginType(item.getOriginType());
|
|
||||||
realVideo.setOriginTypeStr(item.getOriginTypeStr());
|
|
||||||
realVideo.setOriginUrl(item.getOriginUrl());
|
|
||||||
realVideo.setCreateStamp(item.getCreateStamp());
|
|
||||||
realVideo.setAliveSecond(item.getAliveSecond());
|
|
||||||
|
|
||||||
ArrayList<RealVideo.MediaSchema> mediaSchemas = new ArrayList<>();
|
|
||||||
realVideo.setSchemas(mediaSchemas);
|
|
||||||
realVideo.setTracks(item.getTracks());
|
|
||||||
realVideo.setVhost(item.getVhost());
|
|
||||||
result.put(key, realVideo);
|
|
||||||
}
|
|
||||||
|
|
||||||
RealVideo.MediaSchema mediaSchema = new RealVideo.MediaSchema();
|
|
||||||
mediaSchema.setSchema(item.getSchema());
|
|
||||||
mediaSchema.setBytesSpeed(item.getBytesSpeed());
|
|
||||||
realVideo.getSchemas().add(mediaSchema);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
logger.warn("更新视频流失败,错误code: " + code);
|
logger.warn("更新视频流失败,错误code: " + code);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RealVideo> realVideos = new ArrayList<>(result.values());
|
if (streamPushItems != null) {
|
||||||
Collections.sort(realVideos);
|
storager.updateMediaList(streamPushItems);
|
||||||
redisCatchStorage.updateMediaList(realVideos);
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMedia(String app, String streamId) {
|
||||||
|
//使用异步更新推流
|
||||||
|
zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{
|
||||||
|
|
||||||
|
if (json == null) return;
|
||||||
|
String dataStr = json.getString("data");
|
||||||
|
|
||||||
|
Integer code = json.getInteger("code");
|
||||||
|
Map<String, StreamPushItem> result = new HashMap<>();
|
||||||
|
List<StreamPushItem> streamPushItems = null;
|
||||||
|
if (code == 0 ) {
|
||||||
|
if (dataStr != null) {
|
||||||
|
streamPushItems = streamPushService.handleJSON(dataStr);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.warn("更新视频流失败,错误code: " + code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (streamPushItems != null && streamPushItems.size() == 1) {
|
||||||
|
storager.updateMedia(streamPushItems.get(0));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void removeMedia(String app, String streamId) {
|
||||||
|
// 查找是否关联了国标, 关联了不删除, 置为离线
|
||||||
|
StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(app, streamId);
|
||||||
|
if (streamProxyItem == null) {
|
||||||
|
storager.removeMedia(app, streamId);
|
||||||
|
}else {
|
||||||
|
storager.mediaOutline(app, streamId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.media.zlm;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -27,7 +28,11 @@ public class ZLMRESTfulUtils {
|
|||||||
@Value("${media.secret}")
|
@Value("${media.secret}")
|
||||||
private String mediaSecret;
|
private String mediaSecret;
|
||||||
|
|
||||||
public JSONObject sendPost(String api, Map<String, Object> param) {
|
public interface RequestCallback{
|
||||||
|
void run(JSONObject response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject sendPost(String api, Map<String, Object> param, RequestCallback callback) {
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
String url = String.format("http://%s:%s/index/api/%s", mediaIp, mediaPort, api);
|
String url = String.format("http://%s:%s/index/api/%s", mediaIp, mediaPort, api);
|
||||||
JSONObject responseJSON = null;
|
JSONObject responseJSON = null;
|
||||||
@ -47,6 +52,7 @@ public class ZLMRESTfulUtils {
|
|||||||
.post(body)
|
.post(body)
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
if (callback == null) {
|
||||||
try {
|
try {
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
if (response.isSuccessful()) {
|
if (response.isSuccessful()) {
|
||||||
@ -61,20 +67,53 @@ public class ZLMRESTfulUtils {
|
|||||||
}catch (IOException e) {
|
}catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
client.newCall(request).enqueue(new Callback(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NotNull Call call, @NotNull Response response){
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
try {
|
||||||
|
String responseStr = response.body().string();
|
||||||
|
if (responseStr != null) {
|
||||||
|
callback.run(JSON.parseObject(responseStr));
|
||||||
|
}else {
|
||||||
|
callback.run(null);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||||
|
logger.error(String.format("连接ZLM失败: %s, %s", e.getCause().getMessage(), e.getMessage()));
|
||||||
|
logger.info("请检查media配置并确认ZLM已启动...");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return responseJSON;
|
return responseJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getMediaList(String app, String schema){
|
public JSONObject getMediaList(String app, String stream, String schema, RequestCallback callback){
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("app",app);
|
if (app != null) param.put("app",app);
|
||||||
param.put("schema",schema);
|
if (stream != null) param.put("stream",stream);
|
||||||
|
if (schema != null) param.put("schema",schema);
|
||||||
param.put("vhost","__defaultVhost__");
|
param.put("vhost","__defaultVhost__");
|
||||||
return sendPost("getMediaList",param);
|
return sendPost("getMediaList",param, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getMediaList(){
|
public JSONObject getMediaList(String app, String stream){
|
||||||
return sendPost("getMediaList",null);
|
return getMediaList(app, stream,null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getMediaList(RequestCallback callback){
|
||||||
|
return sendPost("getMediaList",null, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getMediaInfo(String app, String schema, String stream){
|
public JSONObject getMediaInfo(String app, String schema, String stream){
|
||||||
@ -83,13 +122,13 @@ public class ZLMRESTfulUtils {
|
|||||||
param.put("schema",schema);
|
param.put("schema",schema);
|
||||||
param.put("stream",stream);
|
param.put("stream",stream);
|
||||||
param.put("vhost","__defaultVhost__");
|
param.put("vhost","__defaultVhost__");
|
||||||
return sendPost("getMediaInfo",param);
|
return sendPost("getMediaInfo",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getRtpInfo(String stream_id){
|
public JSONObject getRtpInfo(String stream_id){
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("stream_id",stream_id);
|
param.put("stream_id",stream_id);
|
||||||
return sendPost("getRtpInfo",param);
|
return sendPost("getRtpInfo",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){
|
public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){
|
||||||
@ -99,37 +138,37 @@ public class ZLMRESTfulUtils {
|
|||||||
param.put("src_url", src_url);
|
param.put("src_url", src_url);
|
||||||
param.put("dst_url", dst_url);
|
param.put("dst_url", dst_url);
|
||||||
param.put("timeout_ms", timeout_ms);
|
param.put("timeout_ms", timeout_ms);
|
||||||
return sendPost("addFFmpegSource",param);
|
return sendPost("addFFmpegSource",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject delFFmpegSource(String key){
|
public JSONObject delFFmpegSource(String key){
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
param.put("key", key);
|
param.put("key", key);
|
||||||
return sendPost("delFFmpegSource",param);
|
return sendPost("delFFmpegSource",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getMediaServerConfig(){
|
public JSONObject getMediaServerConfig(){
|
||||||
return sendPost("getServerConfig",null);
|
return sendPost("getServerConfig",null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject setServerConfig(Map<String, Object> param){
|
public JSONObject setServerConfig(Map<String, Object> param){
|
||||||
return sendPost("setServerConfig",param);
|
return sendPost("setServerConfig",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject openRtpServer(Map<String, Object> param){
|
public JSONObject openRtpServer(Map<String, Object> param){
|
||||||
return sendPost("openRtpServer",param);
|
return sendPost("openRtpServer",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject closeRtpServer(Map<String, Object> param) {
|
public JSONObject closeRtpServer(Map<String, Object> param) {
|
||||||
return sendPost("closeRtpServer",param);
|
return sendPost("closeRtpServer",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject startSendRtp(Map<String, Object> param) {
|
public JSONObject startSendRtp(Map<String, Object> param) {
|
||||||
return sendPost("startSendRtp",param);
|
return sendPost("startSendRtp",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject stopSendRtp(Map<String, Object> param) {
|
public JSONObject stopSendRtp(Map<String, Object> param) {
|
||||||
return sendPost("stopSendRtp",param);
|
return sendPost("stopSendRtp",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject addStreamProxy(String app, String stream, String url, boolean enable_hls, boolean enable_mp4, String rtp_type) {
|
public JSONObject addStreamProxy(String app, String stream, String url, boolean enable_hls, boolean enable_mp4, String rtp_type) {
|
||||||
@ -141,7 +180,7 @@ public class ZLMRESTfulUtils {
|
|||||||
param.put("enable_hls", enable_hls?1:0);
|
param.put("enable_hls", enable_hls?1:0);
|
||||||
param.put("enable_mp4", enable_mp4?1:0);
|
param.put("enable_mp4", enable_mp4?1:0);
|
||||||
param.put("rtp_type", rtp_type);
|
param.put("rtp_type", rtp_type);
|
||||||
return sendPost("addStreamProxy",param);
|
return sendPost("addStreamProxy",param, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject closeStreams(String app, String stream) {
|
public JSONObject closeStreams(String app, String stream) {
|
||||||
@ -150,6 +189,6 @@ public class ZLMRESTfulUtils {
|
|||||||
param.put("app", app);
|
param.put("app", app);
|
||||||
param.put("stream", stream);
|
param.put("stream", stream);
|
||||||
param.put("force", 1);
|
param.put("force", 1);
|
||||||
return sendPost("close_streams",param);
|
return sendPost("close_streams",param, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
|||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
//import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
//import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -75,9 +75,8 @@ public class ZLMRunner implements CommandLineRunner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... strings) throws Exception {
|
public void run(String... strings) throws Exception {
|
||||||
JSONObject subscribeKey = new JSONObject();
|
|
||||||
// 订阅 zlm启动事件
|
// 订阅 zlm启动事件
|
||||||
hookSubscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_server_started,subscribeKey,(response)->{
|
hookSubscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_server_started,null,(response)->{
|
||||||
MediaServerConfig mediaServerConfig = JSONObject.toJavaObject(response, MediaServerConfig.class);
|
MediaServerConfig mediaServerConfig = JSONObject.toJavaObject(response, MediaServerConfig.class);
|
||||||
zLmRunning(mediaServerConfig);
|
zLmRunning(mediaServerConfig);
|
||||||
});
|
});
|
||||||
@ -155,7 +154,7 @@ public class ZLMRunner implements CommandLineRunner {
|
|||||||
logger.info("zlm接入成功...");
|
logger.info("zlm接入成功...");
|
||||||
if (autoConfig) saveZLMConfig();
|
if (autoConfig) saveZLMConfig();
|
||||||
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
|
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
|
||||||
if (System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){
|
if (mediaInfo != null && System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){
|
||||||
logger.info("zlm刚刚更新,忽略这次更新");
|
logger.info("zlm刚刚更新,忽略这次更新");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.genersoft.iot.vmp.common;
|
package com.genersoft.iot.vmp.media.zlm.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class RealVideo implements Comparable<RealVideo>{
|
public class StreamPushItem extends GbStream implements Comparable<StreamPushItem>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用名
|
* 应用名
|
||||||
@ -85,9 +84,10 @@ public class RealVideo implements Comparable<RealVideo>{
|
|||||||
this.vhost = vhost;
|
this.vhost = vhost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@NotNull RealVideo realVideo) {
|
public int compareTo(@NotNull StreamPushItem streamPushItem) {
|
||||||
return new Long(this.createStamp - realVideo.getCreateStamp().intValue()).intValue();
|
return new Long(this.createStamp - streamPushItem.getCreateStamp().intValue()).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MediaSchema {
|
public static class MediaSchema {
|
@ -1,7 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service;
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,6 +1,8 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service;
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 媒体信息业务
|
* 媒体信息业务
|
||||||
@ -22,4 +24,5 @@ public interface IMediaService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
StreamInfo getStreamInfoByAppAndStream(String app, String stream);
|
StreamInfo getStreamInfoByAppAndStream(String app, String stream);
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service;
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
@ -1,4 +1,4 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service;
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IStreamPushService {
|
||||||
|
|
||||||
|
List<StreamPushItem> handleJSON(String json);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将应用名和流ID加入国标关联
|
||||||
|
* @param stream
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean saveToGB(GbStream stream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将应用名和流ID移出国标关联
|
||||||
|
* @param stream
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean removeFromGB(GbStream stream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取
|
||||||
|
* @param page
|
||||||
|
* @param count
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageInfo<StreamPushItem> getPushList(Integer page, Integer count);
|
||||||
|
}
|
@ -1,12 +1,9 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
|
||||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlarfotmGbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.vmanager.platform.PlatformController;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IGbStreamService;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -34,7 +31,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||||||
private GbStreamMapper gbStreamMapper;
|
private GbStreamMapper gbStreamMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlarfotmGbStreamMapper plarfotmGbStreamMapper;
|
private PlatformGbStreamMapper platformGbStreamMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<GbStream> getAll(Integer page, Integer count) {
|
public PageInfo<GbStream> getAll(Integer page, Integer count) {
|
||||||
@ -57,7 +54,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||||||
try {
|
try {
|
||||||
for (GbStream gbStream : gbStreams) {
|
for (GbStream gbStream : gbStreams) {
|
||||||
gbStream.setPlatformId(platformId);
|
gbStream.setPlatformId(platformId);
|
||||||
plarfotmGbStreamMapper.add(gbStream);
|
platformGbStreamMapper.add(gbStream);
|
||||||
}
|
}
|
||||||
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
||||||
result = true;
|
result = true;
|
||||||
@ -76,7 +73,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
||||||
try {
|
try {
|
||||||
for (GbStream gbStream : gbStreams) {
|
for (GbStream gbStream : gbStreams) {
|
||||||
plarfotmGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
|
platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
|
||||||
}
|
}
|
||||||
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
dataSourceTransactionManager.commit(transactionStatus); //手动提交
|
||||||
result = true;
|
result = true;
|
@ -1,13 +1,14 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -23,6 +24,8 @@ public class MediaServiceImpl implements IMediaService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getStreamInfoByAppAndStream(String app, String stream) {
|
public StreamInfo getStreamInfoByAppAndStream(String app, String stream) {
|
||||||
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
|
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
|
||||||
@ -51,4 +54,7 @@ public class MediaServiceImpl implements IMediaService {
|
|||||||
}
|
}
|
||||||
return streamInfo;
|
return streamInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,9 +1,8 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||||
@ -15,8 +14,8 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
|||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
@ -1,4 +1,4 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||||
@ -7,9 +7,9 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
|||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlarfotmGbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -36,7 +36,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
private GbStreamMapper gbStreamMapper;
|
private GbStreamMapper gbStreamMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlarfotmGbStreamMapper plarfotmGbStreamMapper;
|
private PlatformGbStreamMapper platformGbStreamMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -94,7 +94,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||||||
videoManagerStorager.deleteStreamProxy(app, stream);
|
videoManagerStorager.deleteStreamProxy(app, stream);
|
||||||
// 如果关联了国标那么移除关联
|
// 如果关联了国标那么移除关联
|
||||||
gbStreamMapper.del(app, stream);
|
gbStreamMapper.del(app, stream);
|
||||||
plarfotmGbStreamMapper.delByAppAndStream(app, stream);
|
platformGbStreamMapper.delByAppAndStream(app, stream);
|
||||||
// TODO 如果关联的推流, 那么状态设置为离线
|
// TODO 如果关联的推流, 那么状态设置为离线
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.TypeReference;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
|
import com.genersoft.iot.vmp.storager.dao.StreamPushMapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GbStreamMapper gbStreamMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StreamPushMapper streamPushMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StreamPushItem> handleJSON(String jsonData) {
|
||||||
|
if (jsonData == null) return null;
|
||||||
|
|
||||||
|
Map<String, StreamPushItem> result = new HashMap<>();
|
||||||
|
|
||||||
|
List<MediaItem> mediaItems = JSON.parseObject(jsonData, new TypeReference<List<MediaItem>>() {});
|
||||||
|
for (MediaItem item : mediaItems) {
|
||||||
|
|
||||||
|
// 不保存国标推理以及拉流代理的流
|
||||||
|
if (item.getOriginType() == 3 || item.getOriginType() == 4 || item.getOriginType() == 5) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String key = item.getApp() + "_" + item.getStream();
|
||||||
|
StreamPushItem streamPushItem = result.get(key);
|
||||||
|
if (streamPushItem == null) {
|
||||||
|
streamPushItem = new StreamPushItem();
|
||||||
|
streamPushItem.setApp(item.getApp());
|
||||||
|
streamPushItem.setStream(item.getStream());
|
||||||
|
streamPushItem.setAliveSecond(item.getAliveSecond());
|
||||||
|
streamPushItem.setCreateStamp(item.getCreateStamp());
|
||||||
|
streamPushItem.setOriginSock(item.getOriginSock());
|
||||||
|
streamPushItem.setTotalReaderCount(item.getTotalReaderCount());
|
||||||
|
streamPushItem.setOriginType(item.getOriginType());
|
||||||
|
streamPushItem.setOriginTypeStr(item.getOriginTypeStr());
|
||||||
|
streamPushItem.setOriginUrl(item.getOriginUrl());
|
||||||
|
streamPushItem.setCreateStamp(item.getCreateStamp());
|
||||||
|
streamPushItem.setAliveSecond(item.getAliveSecond());
|
||||||
|
streamPushItem.setStatus(true);
|
||||||
|
streamPushItem.setVhost(item.getVhost());
|
||||||
|
result.put(key, streamPushItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ArrayList<>(result.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageInfo<StreamPushItem> getPushList(Integer page, Integer count) {
|
||||||
|
PageHelper.startPage(page, count);
|
||||||
|
List<StreamPushItem> all = streamPushMapper.selectAll();
|
||||||
|
return new PageInfo<>(all);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveToGB(GbStream stream) {
|
||||||
|
stream.setStreamType("push");
|
||||||
|
stream.setStatus(true);
|
||||||
|
int add = gbStreamMapper.add(stream);
|
||||||
|
return add > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeFromGB(GbStream stream) {
|
||||||
|
int del = gbStreamMapper.del(stream.getApp(), stream.getStream());
|
||||||
|
return del > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.storager;
|
package com.genersoft.iot.vmp.storager;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.RealVideo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
@ -107,15 +107,4 @@ public interface IRedisCatchStorage {
|
|||||||
*/
|
*/
|
||||||
boolean isChannelSendingRTP(String channelId);
|
boolean isChannelSendingRTP(String channelId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新媒体流列表
|
|
||||||
* @param mediaList
|
|
||||||
*/
|
|
||||||
void updateMediaList(List<RealVideo> mediaList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前媒体流列表
|
|
||||||
* @return List<RealVideo>
|
|
||||||
*/
|
|
||||||
JSONObject getMediaList(int start, int end);
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
|
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
@ -319,4 +320,36 @@ public interface IVideoManagerStorager {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<GbStream> queryGbStreamListInPlatform(String platformId);
|
List<GbStream> queryGbStreamListInPlatform(String platformId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新推流列表
|
||||||
|
* @param streamPushItems
|
||||||
|
*/
|
||||||
|
void updateMediaList(List<StreamPushItem> streamPushItems);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新单个推流
|
||||||
|
* @param streamPushItem
|
||||||
|
*/
|
||||||
|
void updateMedia(StreamPushItem streamPushItem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除单个推流
|
||||||
|
* @param app
|
||||||
|
* @param stream
|
||||||
|
*/
|
||||||
|
void removeMedia(String app, String stream);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空推流列表
|
||||||
|
*/
|
||||||
|
void clearMediaList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置流离线
|
||||||
|
* @param app
|
||||||
|
* @param streamId
|
||||||
|
*/
|
||||||
|
void mediaOutline(String app, String streamId);
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@ import java.util.List;
|
|||||||
public interface GbStreamMapper {
|
public interface GbStreamMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO gb_stream (app, stream, gbId, name, " +
|
@Insert("INSERT INTO gb_stream (app, stream, gbId, name, " +
|
||||||
"longitude, latitude, streamType) VALUES" +
|
"longitude, latitude, streamType, status) VALUES" +
|
||||||
"('${app}', '${stream}', '${gbId}', '${name}', " +
|
"('${app}', '${stream}', '${gbId}', '${name}', " +
|
||||||
"'${longitude}', '${latitude}', '${streamType}')")
|
"'${longitude}', '${latitude}', '${streamType}', ${status})")
|
||||||
int add(GbStream gbStream);
|
int add(GbStream gbStream);
|
||||||
|
|
||||||
@Update("UPDATE gb_stream " +
|
@Update("UPDATE gb_stream " +
|
||||||
@ -24,7 +24,8 @@ public interface GbStreamMapper {
|
|||||||
"name=#{name}," +
|
"name=#{name}," +
|
||||||
"streamType=#{streamType}," +
|
"streamType=#{streamType}," +
|
||||||
"longitude=#{longitude}, " +
|
"longitude=#{longitude}, " +
|
||||||
"latitude=#{latitude}, " +
|
"latitude=#{latitude} " +
|
||||||
|
"status=${status} " +
|
||||||
"WHERE app=#{app} AND stream=#{stream} AND gbId=#{gbId}")
|
"WHERE app=#{app} AND stream=#{stream} AND gbId=#{gbId}")
|
||||||
int update(GbStream gbStream);
|
int update(GbStream gbStream);
|
||||||
|
|
||||||
@ -46,4 +47,9 @@ public interface GbStreamMapper {
|
|||||||
"LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " +
|
"LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " +
|
||||||
"WHERE pgs.platformId = '${platformId}'")
|
"WHERE pgs.platformId = '${platformId}'")
|
||||||
List<GbStream> queryGbStreamListInPlatform(String platformId);
|
List<GbStream> queryGbStreamListInPlatform(String platformId);
|
||||||
|
|
||||||
|
@Update("UPDATE gb_stream " +
|
||||||
|
"SET status=${status} " +
|
||||||
|
"WHERE app=#{app} AND stream=#{stream}")
|
||||||
|
void setStatus(String app, String stream, boolean status);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@Repository
|
@Repository
|
||||||
public interface PlarfotmGbStreamMapper {
|
public interface PlatformGbStreamMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO platform_gb_stream (app, stream, platformId) VALUES" +
|
@Insert("INSERT INTO platform_gb_stream (app, stream, platformId) VALUES" +
|
||||||
"('${app}', '${stream}', '${platformId}')")
|
"('${app}', '${stream}', '${platformId}')")
|
||||||
@ -20,9 +20,9 @@ public interface PlarfotmGbStreamMapper {
|
|||||||
@Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}")
|
@Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||||
int delByAppAndStream(String app, String stream);
|
int delByAppAndStream(String app, String stream);
|
||||||
|
|
||||||
@Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}")
|
@Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}")
|
||||||
int delByPlatformId(String platformId);
|
int delByPlatformId(String platformId);
|
||||||
|
|
||||||
@Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}")
|
@Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||||
StreamProxyItem selectOne(String app, String stream, String platformId);
|
List<StreamProxyItem> selectByAppAndStream(String app, String stream);
|
||||||
}
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.genersoft.iot.vmp.storager.dao;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
|
import org.apache.ibatis.annotations.*;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
@Repository
|
||||||
|
public interface StreamPushMapper {
|
||||||
|
|
||||||
|
@Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
|
||||||
|
"createStamp, aliveSecond) VALUES" +
|
||||||
|
"('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +
|
||||||
|
"'${createStamp}', '${aliveSecond}' )")
|
||||||
|
int add(StreamPushItem streamPushItem);
|
||||||
|
|
||||||
|
@Update("UPDATE stream_push " +
|
||||||
|
"SET app=#{app}," +
|
||||||
|
"stream=#{stream}," +
|
||||||
|
"totalReaderCount=#{totalReaderCount}, " +
|
||||||
|
"originType=#{originType}," +
|
||||||
|
"originTypeStr=#{originTypeStr}, " +
|
||||||
|
"createStamp=#{createStamp}, " +
|
||||||
|
"aliveSecond=#{aliveSecond} " +
|
||||||
|
"WHERE app=#{app} AND stream=#{stream}")
|
||||||
|
int update(StreamPushItem streamPushItem);
|
||||||
|
|
||||||
|
@Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}")
|
||||||
|
int del(String app, String stream);
|
||||||
|
|
||||||
|
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream")
|
||||||
|
List<StreamPushItem> selectAll();
|
||||||
|
|
||||||
|
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=${enable}")
|
||||||
|
List<StreamPushItem> selectForEnable(boolean enable);
|
||||||
|
|
||||||
|
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream}")
|
||||||
|
StreamPushItem selectOne(String app, String stream);
|
||||||
|
|
||||||
|
@Insert("<script>" +
|
||||||
|
"INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
|
||||||
|
"createStamp, aliveSecond) " +
|
||||||
|
"VALUES <foreach collection='streamPushItems' item='item' index='index' >" +
|
||||||
|
"( '${item.app}', '${item.stream}', '${item.totalReaderCount}', '${item.originType}', " +
|
||||||
|
"'${item.originTypeStr}','${item.createStamp}', '${item.aliveSecond}' )" +
|
||||||
|
" </foreach>" +
|
||||||
|
"</script>")
|
||||||
|
void addAll(List<StreamPushItem> streamPushItems);
|
||||||
|
|
||||||
|
@Delete("DELETE FROM stream_push")
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.storager.impl;
|
package com.genersoft.iot.vmp.storager.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.RealVideo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||||
@ -261,34 +261,4 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新媒体流列表
|
|
||||||
* @param mediaList
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void updateMediaList(List<RealVideo> mediaList) {
|
|
||||||
String key = VideoManagerConstants.MEDIA_STREAM_PREFIX;
|
|
||||||
redis.del(key);
|
|
||||||
for (int i = 0; i < mediaList.size(); i++) {
|
|
||||||
RealVideo realVideo = mediaList.get(i);
|
|
||||||
redis.zAdd(key, realVideo, realVideo.getCreateStamp());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前媒体流列表
|
|
||||||
* @return List<RealVideo>
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public JSONObject getMediaList(int start, int end) {
|
|
||||||
String key = VideoManagerConstants.MEDIA_STREAM_PREFIX;
|
|
||||||
Set<Object> realVideos = redis.ZRange(key, start, end);
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("list", new ArrayList(realVideos));
|
|
||||||
jsonObject.put("total", redis.zSize(key));
|
|
||||||
|
|
||||||
return jsonObject;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.dao.*;
|
import com.genersoft.iot.vmp.storager.dao.*;
|
||||||
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
|
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
|
||||||
@ -53,6 +54,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StreamProxyMapper streamProxyMapper;
|
private StreamProxyMapper streamProxyMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StreamPushMapper streamPushMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private GbStreamMapper gbStreamMapper;
|
private GbStreamMapper gbStreamMapper;
|
||||||
|
|
||||||
@ -221,9 +225,10 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean outline(String deviceId) {
|
public synchronized boolean outline(String deviceId) {
|
||||||
|
System.out.println("更新设备离线: " + deviceId);
|
||||||
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
|
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
|
||||||
|
if (device == null) return false;
|
||||||
device.setOnline(0);
|
device.setOnline(0);
|
||||||
System.out.println("更新设备离线");
|
|
||||||
return deviceMapper.update(device) > 0;
|
return deviceMapper.update(device) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,6 +408,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
|||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
streamProxyItem.setStreamType("proxy");
|
streamProxyItem.setStreamType("proxy");
|
||||||
|
streamProxyItem.setStatus(true);
|
||||||
try {
|
try {
|
||||||
if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) {
|
if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) {
|
||||||
//事务回滚
|
//事务回滚
|
||||||
@ -504,4 +510,37 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
|||||||
public StreamProxyItem queryStreamProxy(String app, String stream){
|
public StreamProxyItem queryStreamProxy(String app, String stream){
|
||||||
return streamProxyMapper.selectOne(app, stream);
|
return streamProxyMapper.selectOne(app, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMediaList(List<StreamPushItem> streamPushItems) {
|
||||||
|
if (streamPushItems == null || streamPushItems.size() == 0) return;
|
||||||
|
System.out.printf("updateMediaList: " + streamPushItems.size());
|
||||||
|
streamPushMapper.addAll(streamPushItems);
|
||||||
|
// TODO 待优化
|
||||||
|
for (int i = 0; i < streamPushItems.size(); i++) {
|
||||||
|
gbStreamMapper.setStatus(streamPushItems.get(i).getApp(), streamPushItems.get(i).getStream(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMedia(StreamPushItem streamPushItem) {
|
||||||
|
streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream());
|
||||||
|
streamPushMapper.add(streamPushItem);
|
||||||
|
gbStreamMapper.setStatus(streamPushItem.getApp(), streamPushItem.getStream(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeMedia(String app, String stream) {
|
||||||
|
streamPushMapper.del(app, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearMediaList() {
|
||||||
|
streamPushMapper.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mediaOutline(String app, String streamId) {
|
||||||
|
gbStreamMapper.setStatus(app, streamId, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.gbStream;
|
package com.genersoft.iot.vmp.vmanager.gbStream;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
|
import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam;
|
||||||
import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IGbStreamService;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/gbStream")
|
@RequestMapping("/api/gbStream")
|
||||||
|
@ -2,9 +2,13 @@ package com.genersoft.iot.vmp.vmanager.media;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
|
||||||
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -20,25 +24,16 @@ public class MediaController {
|
|||||||
private final static Logger logger = LoggerFactory.getLogger(MediaController.class);
|
private final static Logger logger = LoggerFactory.getLogger(MediaController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IVideoManagerStorager storager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IStreamProxyService streamProxyService;
|
private IStreamPushService streamPushService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMediaService mediaService;
|
private IMediaService mediaService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/list")
|
|
||||||
@ResponseBody
|
|
||||||
public JSONObject list( @RequestParam(required = false)Integer page,
|
|
||||||
@RequestParam(required = false)Integer count,
|
|
||||||
@RequestParam(required = false)String q,
|
|
||||||
@RequestParam(required = false)Boolean online ){
|
|
||||||
|
|
||||||
JSONObject jsonObject = redisCatchStorage.getMediaList(page - 1, page - 1 + count);
|
|
||||||
return jsonObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/getStreamInfoByAppAndStream")
|
@RequestMapping(value = "/getStreamInfoByAppAndStream")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ -46,4 +41,6 @@ public class MediaController {
|
|||||||
return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream);
|
return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package com.genersoft.iot.vmp.vmanager.platformGbStream;
|
package com.genersoft.iot.vmp.vmanager.platformGbStream;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
|
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IGbStreamService;
|
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -8,8 +8,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
|||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IMediaService;
|
import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
|||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
//import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.vmanager.streamProxy;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.vmanager.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.genersoft.iot.vmp.vmanager.streamPush;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
|
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||||
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.media.MediaController;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(value = "/api/push")
|
||||||
|
public class StreamPushController {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(StreamPushController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStreamPushService streamPushService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/list")
|
||||||
|
@ResponseBody
|
||||||
|
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
|
||||||
|
@RequestParam(required = false)Integer count,
|
||||||
|
@RequestParam(required = false)String q,
|
||||||
|
@RequestParam(required = false)Boolean online ){
|
||||||
|
|
||||||
|
PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page - 1, page - 1 + count);
|
||||||
|
return pushList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/saveToGB")
|
||||||
|
@ResponseBody
|
||||||
|
public Object saveToGB(@RequestBody GbStream stream){
|
||||||
|
if (streamPushService.saveToGB(stream)){
|
||||||
|
return "success";
|
||||||
|
}else {
|
||||||
|
return "fail";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/removeFormGB")
|
||||||
|
@ResponseBody
|
||||||
|
public Object removeFormGB(@RequestBody GbStream stream){
|
||||||
|
if (streamPushService.removeFromGB(stream)){
|
||||||
|
return "success";
|
||||||
|
}else {
|
||||||
|
return "fail";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
@ -1,283 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div id="pLatformStreamList">
|
|
||||||
<el-container>
|
|
||||||
<el-header>
|
|
||||||
<uiHeader></uiHeader>
|
|
||||||
</el-header>
|
|
||||||
<el-main>
|
|
||||||
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
|
|
||||||
<span style="font-size: 1rem; font-weight: bold;">直播级联列表</span>
|
|
||||||
</div>
|
|
||||||
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
|
|
||||||
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addStreamProxy">添加代理</el-button>
|
|
||||||
</div>
|
|
||||||
<devicePlayer ref="devicePlayer"></devicePlayer>
|
|
||||||
<el-table :data="streamProxyList" border style="width: 100%" :height="winHeight">
|
|
||||||
<el-table-column prop="app" label="应用名" align="center" show-overflow-tooltip/>
|
|
||||||
<el-table-column prop="stream" label="流ID" align="center" show-overflow-tooltip/>
|
|
||||||
<el-table-column prop="gbId" label="国标平台" align="center" show-overflow-tooltip/>
|
|
||||||
|
|
||||||
<el-table-column label="转HLS" width="120" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div slot="reference" class="name-wrapper">
|
|
||||||
<el-tag size="medium" v-if="scope.row.enable_hls">已启用</el-tag>
|
|
||||||
<el-tag size="medium" type="info" v-if="!scope.row.enable_hls">未启用</el-tag>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="MP4录制" width="120" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div slot="reference" class="name-wrapper">
|
|
||||||
<el-tag size="medium" v-if="scope.row.enable_mp4">已启用</el-tag>
|
|
||||||
<el-tag size="medium" type="info" v-if="!scope.row.enable_mp4">未启用</el-tag>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="启用" width="120" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<div slot="reference" class="name-wrapper">
|
|
||||||
<el-tag size="medium" v-if="scope.row.enable">已启用</el-tag>
|
|
||||||
<el-tag size="medium" type="info" v-if="!scope.row.enable">未启用</el-tag>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="操作" width="360" align="center" fixed="right">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button-group>
|
|
||||||
<el-button size="mini" icon="el-icon-video-play" v-if="scope.row.enable" @click="play(scope.row)">播放</el-button>
|
|
||||||
<el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
|
|
||||||
<el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
|
|
||||||
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button>
|
|
||||||
<!-- <el-button size="mini" icon="el-icon-position" type="primary" >加入国标</el-button> -->
|
|
||||||
</el-button-group>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<el-pagination
|
|
||||||
style="float: right"
|
|
||||||
@size-change="handleSizeChange"
|
|
||||||
@current-change="currentChange"
|
|
||||||
:current-page="currentPage"
|
|
||||||
:page-size="count"
|
|
||||||
:page-sizes="[15, 25, 35, 50]"
|
|
||||||
layout="total, sizes, prev, pager, next"
|
|
||||||
:total="total">
|
|
||||||
</el-pagination>
|
|
||||||
<streamProxyEdit ref="streamProxyEdit" ></streamProxyEdit>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import streamProxyEdit from './dialog/StreamProxyEdit.vue'
|
|
||||||
import devicePlayer from './dialog/devicePlayer.vue'
|
|
||||||
import uiHeader from './UiHeader.vue'
|
|
||||||
export default {
|
|
||||||
name: 'pLatformStreamList',
|
|
||||||
components: {
|
|
||||||
devicePlayer,
|
|
||||||
streamProxyEdit,
|
|
||||||
uiHeader
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
streamProxyList: [],
|
|
||||||
currentPusher: {}, //当前操作设备对象
|
|
||||||
updateLooper: 0, //数据刷新轮训标志
|
|
||||||
currentDeviceChannelsLenth:0,
|
|
||||||
winHeight: window.innerHeight - 200,
|
|
||||||
currentPage:1,
|
|
||||||
count:15,
|
|
||||||
total:0,
|
|
||||||
getListLoading: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.initData();
|
|
||||||
// this.updateLooper = setInterval(this.initData, 10000);
|
|
||||||
},
|
|
||||||
destroyed() {
|
|
||||||
this.$destroy('videojs');
|
|
||||||
clearTimeout(this.updateLooper);
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
initData: function() {
|
|
||||||
this.getStreamProxyList();
|
|
||||||
},
|
|
||||||
currentChange: function(val){
|
|
||||||
this.currentPage = val;
|
|
||||||
this.getStreamProxyList();
|
|
||||||
},
|
|
||||||
handleSizeChange: function(val){
|
|
||||||
this.count = val;
|
|
||||||
this.getStreamProxyList();
|
|
||||||
},
|
|
||||||
getStreamProxyList: function() {
|
|
||||||
let that = this;
|
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios.get(`/api/proxy/list`,{
|
|
||||||
params: {
|
|
||||||
page: that.currentPage,
|
|
||||||
count: that.count
|
|
||||||
}
|
|
||||||
} )
|
|
||||||
.then(function (res) {
|
|
||||||
console.log(res);
|
|
||||||
console.log(res.data.list);
|
|
||||||
that.total = res.data.total;
|
|
||||||
that.streamProxyList = res.data.list;
|
|
||||||
that.getListLoading = false;
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
addStreamProxy: function(){
|
|
||||||
this.$refs.streamProxyEdit.openDialog(null, this.initData)
|
|
||||||
},
|
|
||||||
saveStreamProxy: function(){
|
|
||||||
},
|
|
||||||
play: function(row){
|
|
||||||
let that = this;
|
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
|
|
||||||
params: {
|
|
||||||
app: row.app,
|
|
||||||
stream: row.stream
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (res) {
|
|
||||||
that.getListLoading = false;
|
|
||||||
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
|
|
||||||
streamInfo: res.data,
|
|
||||||
hasAudio: true
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
deleteStreamProxy: function(row){
|
|
||||||
console.log(1111)
|
|
||||||
let that = this;
|
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios.get(`/api/proxy/del`,{
|
|
||||||
params: {
|
|
||||||
app: row.app,
|
|
||||||
stream: row.stream
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (res) {
|
|
||||||
that.getListLoading = false;
|
|
||||||
that.initData()
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
start: function(row){
|
|
||||||
let that = this;
|
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios.get(`/api/proxy/start`,{
|
|
||||||
params: {
|
|
||||||
app: row.app,
|
|
||||||
stream: row.stream
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (res) {
|
|
||||||
that.getListLoading = false;
|
|
||||||
that.initData()
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
stop: function(row){
|
|
||||||
let that = this;
|
|
||||||
this.getListLoading = true;
|
|
||||||
this.$axios.get(`/api/proxy/stop`,{
|
|
||||||
params: {
|
|
||||||
app: row.app,
|
|
||||||
stream: row.stream
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (res) {
|
|
||||||
that.getListLoading = false;
|
|
||||||
that.initData()
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
console.log(error);
|
|
||||||
that.getListLoading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.videoList {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-content: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item {
|
|
||||||
position: relative;
|
|
||||||
width: 15rem;
|
|
||||||
height: 10rem;
|
|
||||||
margin-right: 1rem;
|
|
||||||
background-color: #000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item-img {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
margin: auto;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item-img:after {
|
|
||||||
content: "";
|
|
||||||
display: inline-block;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 2;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
margin: auto;
|
|
||||||
width: 3rem;
|
|
||||||
height: 3rem;
|
|
||||||
background-image: url("../assets/loading.png");
|
|
||||||
background-size: cover;
|
|
||||||
background-color: #000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item-title {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
color: #000000;
|
|
||||||
background-color: #ffffff;
|
|
||||||
line-height: 1.5rem;
|
|
||||||
padding: 0.3rem;
|
|
||||||
width: 14.4rem;
|
|
||||||
}
|
|
||||||
.cpoy-btn {
|
|
||||||
cursor: pointer;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -8,10 +8,8 @@
|
|||||||
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
|
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
|
||||||
<span style="font-size: 1rem; font-weight: bold;">推流列表</span>
|
<span style="font-size: 1rem; font-weight: bold;">推流列表</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
|
|
||||||
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addStreamProxy">添加代理</el-button>
|
|
||||||
</div>
|
|
||||||
<devicePlayer ref="devicePlayer"></devicePlayer>
|
<devicePlayer ref="devicePlayer"></devicePlayer>
|
||||||
|
<addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
|
||||||
<el-table :data="pushList" border style="width: 100%" :height="winHeight">
|
<el-table :data="pushList" border style="width: 100%" :height="winHeight">
|
||||||
<el-table-column prop="app" label="APP" width="180" align="center">
|
<el-table-column prop="app" label="APP" width="180" align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -19,6 +17,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="totalReaderCount" label="在线人数" width="240" align="center">
|
<el-table-column prop="totalReaderCount" label="在线人数" width="240" align="center">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="gbId" label="国标编码" width="150" align="center">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="开始时间" align="center" >
|
<el-table-column label="开始时间" align="center" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
@ -26,12 +26,19 @@
|
|||||||
</el-button-group>
|
</el-button-group>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="正在推流" align="center" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{!!scope.row.status?'是':'否'}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="操作" width="360" align="center" fixed="right">
|
<el-table-column label="操作" width="360" align="center" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button size="mini" icon="el-icon-video-play" @click="playPuhsh(scope.row)">播放</el-button>
|
<el-button size="mini" icon="el-icon-video-play" @click="playPuhsh(scope.row)">播放</el-button>
|
||||||
<el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId" @click="stopPuhsh(scope.row)">停止</el-button>
|
<el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="!!scope.row.streamId" @click="stopPuhsh(scope.row)">停止</el-button>
|
||||||
|
<el-button size="mini" icon="el-icon-position" type="primary" v-if="!!!scope.row.gbId" @click="addToGB(scope.row)">加入国标</el-button>
|
||||||
|
<el-button size="mini" icon="el-icon-position" type="primary" v-if="!!scope.row.gbId" @click="removeFromGB(scope.row)">移出国标</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -55,11 +62,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import streamProxyEdit from './dialog/StreamProxyEdit.vue'
|
import streamProxyEdit from './dialog/StreamProxyEdit.vue'
|
||||||
import devicePlayer from './dialog/devicePlayer.vue'
|
import devicePlayer from './dialog/devicePlayer.vue'
|
||||||
|
import addStreamTOGB from './dialog/addStreamTOGB.vue'
|
||||||
import uiHeader from './UiHeader.vue'
|
import uiHeader from './UiHeader.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'pushVideoList',
|
name: 'pushVideoList',
|
||||||
components: {
|
components: {
|
||||||
devicePlayer,
|
devicePlayer,
|
||||||
|
addStreamTOGB,
|
||||||
streamProxyEdit,
|
streamProxyEdit,
|
||||||
uiHeader
|
uiHeader
|
||||||
},
|
},
|
||||||
@ -80,10 +89,9 @@
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initData();
|
this.initData();
|
||||||
// this.updateLooper = setInterval(this.initData, 10000);
|
this.updateLooper = setInterval(this.initData, 2000);
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.$destroy('videojs');
|
|
||||||
clearTimeout(this.updateLooper);
|
clearTimeout(this.updateLooper);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -101,7 +109,7 @@
|
|||||||
getPushList: function() {
|
getPushList: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.getDeviceListLoading = true;
|
this.getDeviceListLoading = true;
|
||||||
this.$axios.get(`/api/media/list`,{
|
this.$axios.get(`/api/push/list`,{
|
||||||
params: {
|
params: {
|
||||||
page: that.currentPage,
|
page: that.currentPage,
|
||||||
count: that.count
|
count: that.count
|
||||||
@ -119,12 +127,7 @@
|
|||||||
that.getDeviceListLoading = false;
|
that.getDeviceListLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addStreamProxy: function(){
|
|
||||||
console.log(2222)
|
|
||||||
this.$refs.streamProxyEdit.openDialog(null, this.initData)
|
|
||||||
},
|
|
||||||
saveStreamProxy: function(){
|
|
||||||
},
|
|
||||||
playPuhsh: function(row){
|
playPuhsh: function(row){
|
||||||
let that = this;
|
let that = this;
|
||||||
this.getListLoading = true;
|
this.getListLoading = true;
|
||||||
@ -149,6 +152,23 @@
|
|||||||
stopPuhsh: function(row){
|
stopPuhsh: function(row){
|
||||||
console.log(row)
|
console.log(row)
|
||||||
},
|
},
|
||||||
|
addToGB: function(row){
|
||||||
|
this.$refs.addStreamTOGB.openDialog({app: row.app, stream: row.stream}, this.initData);
|
||||||
|
},
|
||||||
|
removeFromGB: function(row){
|
||||||
|
var that = this;
|
||||||
|
that.$axios.post(`/api/push/removeFormGB`, row)
|
||||||
|
.then(function (res) {
|
||||||
|
console.log(res);
|
||||||
|
console.log(res.data == "success");
|
||||||
|
if (res.data == "success") {
|
||||||
|
that.initData()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
dateFormat: function(/** timestamp=0 **/) {
|
dateFormat: function(/** timestamp=0 **/) {
|
||||||
var ts = arguments[0] || 0;
|
var ts = arguments[0] || 0;
|
||||||
var t,y,m,d,h,i,s;
|
var t,y,m,d,h,i,s;
|
||||||
|
@ -64,7 +64,6 @@
|
|||||||
<el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
|
<el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
|
||||||
<el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
|
<el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
|
||||||
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button>
|
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button>
|
||||||
<!-- <el-button size="mini" icon="el-icon-position" type="primary" >加入国标</el-button> -->
|
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
138
web_src/src/components/dialog/addStreamTOGB.vue
Normal file
138
web_src/src/components/dialog/addStreamTOGB.vue
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<div id="addStreamProxy" v-loading="isLoging">
|
||||||
|
<el-dialog
|
||||||
|
title=" 加入"
|
||||||
|
width="40%"
|
||||||
|
top="2rem"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="showDialog"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
@close="close()"
|
||||||
|
>
|
||||||
|
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
||||||
|
<el-form ref="streamProxy" :rules="rules" :model="proxyParam" label-width="140px">
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="proxyParam.name" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="流应用名" prop="app">
|
||||||
|
<el-input v-model="proxyParam.app" clearable :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="流ID" prop="stream">
|
||||||
|
<el-input v-model="proxyParam.stream" clearable :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="国标编码" prop="gbId">
|
||||||
|
<el-input v-model="proxyParam.gbId" placeholder="设置国标编码可推送到国标" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<div style="float: right;">
|
||||||
|
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||||
|
<el-button @click="close">取消</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "streamProxyEdit",
|
||||||
|
props: {},
|
||||||
|
computed: {},
|
||||||
|
created() {},
|
||||||
|
data() {
|
||||||
|
// var deviceGBIdRules = async (rule, value, callback) => {
|
||||||
|
// console.log(value);
|
||||||
|
// if (value === "") {
|
||||||
|
// callback(new Error("请输入设备国标编号"));
|
||||||
|
// } else {
|
||||||
|
// var exit = await this.deviceGBIdExit(value);
|
||||||
|
// console.log(exit);
|
||||||
|
// console.log(exit == "true");
|
||||||
|
// console.log(exit === "true");
|
||||||
|
// if (exit) {
|
||||||
|
// callback(new Error("设备国标编号已存在"));
|
||||||
|
// } else {
|
||||||
|
// callback();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
return {
|
||||||
|
listChangeCallback: null,
|
||||||
|
showDialog: false,
|
||||||
|
isLoging: false,
|
||||||
|
proxyParam: {
|
||||||
|
name: null,
|
||||||
|
app: null,
|
||||||
|
stream: null,
|
||||||
|
gbId: null,
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||||
|
app: [{ required: true, message: "请输入应用名", trigger: "blur" }],
|
||||||
|
stream: [{ required: true, message: "请输入流ID", trigger: "blur" }],
|
||||||
|
gbId: [{ required: true, message: "请输入国标编码", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openDialog: function (proxyParam, callback) {
|
||||||
|
this.showDialog = true;
|
||||||
|
this.listChangeCallback = callback;
|
||||||
|
if (proxyParam != null) {
|
||||||
|
this.proxyParam = proxyParam;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSubmit: function () {
|
||||||
|
console.log("onSubmit");
|
||||||
|
var that = this;
|
||||||
|
that.$axios
|
||||||
|
.post(`/api/push/saveToGB`, that.proxyParam)
|
||||||
|
.then(function (res) {
|
||||||
|
console.log(res);
|
||||||
|
console.log(res.data == "success");
|
||||||
|
if (res.data == "success") {
|
||||||
|
that.$message({
|
||||||
|
showClose: true,
|
||||||
|
message: "保存成功",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
that.showDialog = false;
|
||||||
|
if (that.listChangeCallback != null) {
|
||||||
|
that.listChangeCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close: function () {
|
||||||
|
console.log("关闭加入GB");
|
||||||
|
this.showDialog = false;
|
||||||
|
this.$refs.streamProxy.resetFields();
|
||||||
|
},
|
||||||
|
deviceGBIdExit: async function (deviceGbId) {
|
||||||
|
var result = false;
|
||||||
|
var that = this;
|
||||||
|
await that.$axios
|
||||||
|
.post(`/api/platforms/exit/${deviceGbId}`)
|
||||||
|
.then(function (res) {
|
||||||
|
result = res.data;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
checkExpires: function() {
|
||||||
|
if (this.platform.enable && this.platform.expires == "0") {
|
||||||
|
this.platform.expires = "300";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -10,8 +10,6 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="gbId" label="国标编码" show-overflow-tooltip>
|
<el-table-column prop="gbId" label="国标编码" show-overflow-tooltip>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="streamType" label="流来源" align="center" show-overflow-tooltip>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="流来源" width="100" align="center">
|
<el-table-column label="流来源" width="100" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div slot="reference" class="name-wrapper">
|
<div slot="reference" class="name-wrapper">
|
||||||
|
@ -6,7 +6,6 @@ import deviceList from '../components/DeviceList.vue'
|
|||||||
import channelList from '../components/channelList.vue'
|
import channelList from '../components/channelList.vue'
|
||||||
import pushVideoList from '../components/PushVideoList.vue'
|
import pushVideoList from '../components/PushVideoList.vue'
|
||||||
import streamProxyList from '../components/StreamProxyList.vue'
|
import streamProxyList from '../components/StreamProxyList.vue'
|
||||||
import pLatformStreamList from '../components/PLatformStreamList.vue'
|
|
||||||
import devicePosition from '../components/devicePosition.vue'
|
import devicePosition from '../components/devicePosition.vue'
|
||||||
import login from '../components/Login.vue'
|
import login from '../components/Login.vue'
|
||||||
import parentPlatformList from '../components/ParentPlatformList.vue'
|
import parentPlatformList from '../components/ParentPlatformList.vue'
|
||||||
@ -34,10 +33,6 @@ export default new VueRouter({
|
|||||||
path: '/pushVideoList',
|
path: '/pushVideoList',
|
||||||
component: pushVideoList,
|
component: pushVideoList,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/pLatformStreamList',
|
|
||||||
component: pLatformStreamList,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: '/streamProxyList',
|
path: '/streamProxyList',
|
||||||
component: streamProxyList,
|
component: streamProxyList,
|
||||||
|
Loading…
Reference in New Issue
Block a user