添加海康视频流
parent
edf602bf38
commit
f996d26928
|
|
@ -22,4 +22,21 @@ namespace OpenAuth.App.Common
|
|||
/// </summary>
|
||||
public string SecretKey { get; set; }
|
||||
}
|
||||
|
||||
public class KikvisionConfig2
|
||||
{
|
||||
/// <summary>
|
||||
/// 综合安防管理平台 url
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
public int Port { get; set; }
|
||||
/// <summary>
|
||||
/// AppKey
|
||||
/// </summary>
|
||||
public string AppKey { get; set; }
|
||||
/// <summary>
|
||||
/// SecretKey
|
||||
/// </summary>
|
||||
public string SecretKey { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,14 +44,16 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
private ClientWebSocket _socket;
|
||||
private IConfiguration _configuration;
|
||||
IOptions<KikvisionConfig> _options;
|
||||
IOptions<KikvisionConfig2> _options2;
|
||||
IOptions<JPushClientConfig> _jpoptions;
|
||||
|
||||
public FireManagementApp(IConfiguration configuration, IOptions<KikvisionConfig> options,
|
||||
public FireManagementApp(IConfiguration configuration, IOptions<KikvisionConfig> options, IOptions<KikvisionConfig2> options2,
|
||||
IOptions<JPushClientConfig> jpoptions, ISugarUnitOfWork<SugarDbContext> unitWork,
|
||||
ISimpleClient<FmFireclueTask> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
_auth = auth;
|
||||
_options = options;
|
||||
_options2 = options2;
|
||||
_configuration = configuration;
|
||||
_jpoptions = jpoptions;
|
||||
}
|
||||
|
|
@ -1220,6 +1222,38 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return "fail";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个设备的视频流---海康平台2
|
||||
/// </summary>
|
||||
/// <param name="cameraIndexCode">视频标识</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public string GetPreviewURLs2(string cameraIndexCode, string protocol)
|
||||
{
|
||||
HttpUtillib.SetPlatformInfo(_options2.Value.AppKey, _options2.Value.SecretKey, _options2.Value.Url,
|
||||
_options2.Value.Port, true);
|
||||
|
||||
var obj = new
|
||||
{
|
||||
cameraIndexCode,
|
||||
streamType = 0,
|
||||
protocol = protocol,
|
||||
transmode = 1,
|
||||
expand = "transcode=0",
|
||||
streamform = "ps"
|
||||
};
|
||||
string body = JsonConvert.SerializeObject(obj);
|
||||
string uri = "/artemis/api/video/v2/cameras/previewURLs";
|
||||
byte[] result = HttpUtillib.HttpPost(uri, body, 15, 1);
|
||||
if (null != result)
|
||||
{
|
||||
return Encoding.UTF8.GetString(result);
|
||||
}
|
||||
|
||||
return "fail";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 人员类型统计
|
||||
|
|
|
|||
|
|
@ -579,6 +579,26 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
|||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取视频流---海康平台2
|
||||
/// </summary>
|
||||
/// <param name="deviceCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public string GetPreviewURLs2(string deviceCode, string protocol)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _app.GetPreviewURLs2(deviceCode, protocol);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
#region 人员类型统计查询
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ namespace OpenAuth.WebApi
|
|||
#endregion
|
||||
#region 配置文件
|
||||
services.Configure<KikvisionConfig>(Configuration.GetSection("Hik"));
|
||||
services.Configure<KikvisionConfig2>(Configuration.GetSection("Hik2"));
|
||||
services.Configure<JPushClientConfig>(Configuration.GetSection("JPushClient"));
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@
|
|||
"AppKey": "23604396",
|
||||
"SecretKey": "NZJ8L3bxCOOV6rtTFjsx"
|
||||
},
|
||||
"Hik2": {
|
||||
"Url": "223.99.16.253",
|
||||
"Port": 1443,
|
||||
"AppKey": "28135251",
|
||||
"SecretKey": "V5nOdrZ7llDeNVP3KHX4"
|
||||
},
|
||||
"JPushClient": {
|
||||
"AppKey": "bfee2a863eccbb852baa9140",
|
||||
"MasterSecret": "019f8665e581318dfcbac060"
|
||||
|
|
|
|||
Loading…
Reference in New Issue