Compare commits

...

2 Commits

2 changed files with 22 additions and 17 deletions

View File

@ -56,6 +56,7 @@
},
"DB": {
"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
//"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
"SqlType": "MySql",
"UpdateTable": false
},

View File

@ -392,24 +392,28 @@ namespace VideoAnalysisCore.Controllers
var task = await videoTaskDB.GetByIdAsync(videoTaskId);
if (task is null)
return BadRequest("参数无效");
try
{
var videoInfo = await vodClient.GetPlayInfoAsync(new GetPlayInfoRequest()
{
VideoId = task.TagId,
Formats = "mp4",
OutputType = "cdn",
AuthTimeout = 3600 * 24 * 12,
});
if (videoInfo is null || videoInfo.StatusCode != 200 && !videoInfo.Body.PlayInfoList.PlayInfo.Any())
return BadRequest("获取存储的视频信息失败!");
return Ok(videoInfo.Body.PlayInfoList.PlayInfo.First().PlayURL);
if(!string.IsNullOrWhiteSpace(task.MediaUrl))
return Ok(task.MediaUrl);
else
return BadRequest("此视频未能获取到视频");
//try
//{
// var videoInfo = await vodClient.GetPlayInfoAsync(new GetPlayInfoRequest()
// {
// VideoId = task.TagId,
// Formats = "mp4",
// OutputType = "cdn",
// AuthTimeout = 3600 * 24 * 12,
// });
// if (videoInfo is null || videoInfo.StatusCode != 200 && !videoInfo.Body.PlayInfoList.PlayInfo.Any())
// return BadRequest("获取存储的视频信息失败!");
// return Ok(videoInfo.Body.PlayInfoList.PlayInfo.First().PlayURL);
}
catch (Exception ex)
{
return BadRequest("获取存储的视频信息失败!" + ex.Message);
}
//}
//catch (Exception ex)
//{
// return BadRequest("获取存储的视频信息失败!" + ex.Message);
//}
}