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.

80 lines
1.8 KiB

3 years ago
using EC.App.Core;
3 years ago
using EC.App.ThatBLL.Onvif.Intf;
3 years ago
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
3 years ago
using System.Threading.Tasks;
3 years ago
namespace OnvifWebServer.Controllers.Onvif
{
/// <summary>
/// Onvif 媒体参数控制
/// </summary>
[ApiController]
3 years ago
[ApiDescriptionSettings("Onvif")]
[Route("onvif/[controller]")]
3 years ago
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;
}
3 years ago
/// <summary>
/// 获取播放视频 URL
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
3 years ago
public async Task<string> GetStreamUrl(
3 years ago
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string url = await _mediaBLL.GetStreamUrl(ip);
return url;
3 years ago
}
/// <summary>
/// 获取抓图 URL
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
3 years ago
public async Task<string> GetSnapshotUrl(
3 years ago
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string url = await _mediaBLL.GetSnapshotUrl(ip);
return url;
}
/// <summary>
/// 获取抓图 Base64
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public async Task<string> GetSnapshot(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string snapshotBase64 = await _mediaBLL.GetSnapshot(ip);
return snapshotBase64;
3 years ago
}
3 years ago
}
}