获取视频文件
[HttpGet("play/{fileName}")]
public IActionResult Play(string fileName)
{
var file = System.IO.File.OpenRead($"assets/{fileName}");
return File(file, "video/mp4", true);
}
修改为通过IP访问
在appsettings.json中添加
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://*:5000"
}
}
}
添加跨域
app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
vue使用 axios
安装npm install axios