public async Task <IActionResult> GetVedioUrl([FromRoute] string sourceurl) { sourceurl = sourceurl.Replace("%2F", "/"); string url = CustomExtensionsMethods.GetCameraVedioUrl(sourceurl, localIP: _options.Value.LocalIP, vedioResalution: _options.Value.VedioResalution); return(await Task.FromResult(Ok(url))); }
public async Task <IActionResult> GetCameraVedioUrl([FromRoute] string id, [FromRoute] int cameraIndex) { var device = await _deviceQueries.GetDeviceAsync(id) as TerminalDevice; if (device == null) { return(BadRequest("站点不存在")); } var camera = device.Loads?.FirstOrDefault(x => x.EquipNum.EndsWith(cameraIndex.ToString())) as Camera; if (camera == null) { return(BadRequest("摄像机不存在")); } string account = camera.DeviceProps.Where(x => x.PropName == "account").FirstOrDefault()?.PropValue; string password = camera.DeviceProps.Where(x => x.PropName == "password").FirstOrDefault()?.PropValue; if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(password)) { return(BadRequest("摄像机信息错误")); } string url = CustomExtensionsMethods.GetCameraVedioUrl(account, password, camera.DeviceIP, localIP: _options.Value.LocalIP, vedioResalution: _options.Value.VedioResalution); return(Ok(url)); }