The problem lies in the storage folder ~/App_Data/Video
, which are protected by the project, thus can not be access to
The folder containing files must be change, then be included in the project
The problem lies in the storage folder ~/App_Data/Video
, which are protected by the project, thus can not be access to
The folder containing files must be change, then be included in the project
I tried to play video, which have it name and path stored in database. File do exist in specific folder and said folder is in the scope of this project in this context
The result show video player but have no video play
Controller
public ActionResult DownloadVideo(String url, String filename)
{
ELSEntities db = new ELSEntities();
string path = Server.MapPath(url);
string fullpath = url+"/"+filename;
ViewBag.vid = fullpath;
return View();
}
url
and filename
parameters example:
url
: ~/App_Data/Video
filename
: ETRG.mp4
View
<h2>DownloadVideo</h2>
@ViewBag.vid
<html>
<head>
<meta name="viewport" content="width=device-width" />
</head>
<body>
<div class="video-frame">
<video width="630" height="420" controls="controls">
<source src="@Url.Content(ViewBag.vid)" type="video/mp4" />
</video>
</div>
</body>
I have tried to use FileResult
, video play successfully but user can not control that video in anyway
public FileResult DownloadVideo(String url, String filename)
{
string path = Server.MapPath(url);
string fullpath = Path.Combine(path, filename);
return File(fullpath, "video/mp4");
}