You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.5 KiB

using EC.App.Core;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace OnvifWebServer.Controllers.Onvif
{
/// <summary>
/// Onvif 媒体参数控制
/// </summary>
[Route("onvif/[controller]")]
[ApiDescriptionSettings("Onvif")]
public class MediaController : ApiController
{
private readonly IMediaBLL _mediaBLL;
/// <summary>
///
/// </summary>
/// <param name="mediaBLL"></param>
public MediaController(IMediaBLL mediaBLL)
{
this._mediaBLL = mediaBLL;
}
/// <summary>
/// 是否连接
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public bool IsConnected(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = _mediaBLL.IsConnected(ip);
return ret;
}
/// <summary>
/// 获取播放视频 URL
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public async Task<string> GetStreamUri(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string uri = await _mediaBLL.GetStreamUri(ip);
return uri;
}
/// <summary>
/// 获取抓图 URL
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public async Task<string> GetSnapshotUri(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string uri = await _mediaBLL.GetSnapshotUri(ip);
return uri;
}
}
}