0
使用HTML5视频支持是相当了不起的,但在IE版本中不起作用,所以我不喜欢它。如何在iframe中嵌入视频
我正在使用MVC4 Razor查看引擎进行开发。
我想出了反应这个问题
虽然我直接从YouTube视频嵌入那么它工作正常。但是,当我上传一个视频,然后通过@Model.FilePath
显示它,那么它甚至不会在那里显示iframe。路径是正确的。
控制器 -
[HttpPost]
public ActionResult Index(HttpPostedFileBase file, SystemUser user)
{
if (file != null && file.ContentLength > 0)
{
string path = Server.MapPath("~/Logo/");
file.SaveAs(path + file.FileName);
string filePath = "/Logo/" + Path.GetFileName(file.FileName);
string Extension = Path.GetExtension(file.FileName);
var scope = (from u in dv.SystemUsers
where u.UserId == this.LoggedInUser.UserId
select u).FirstOrDefault();
scope.FilePath = filePath;
scope.FileName = file.FileName;
dv.SystemUsers.GetModifiedMembers(scope);
dv.SubmitChanges();
return RedirectToAction("userprofile", "User");
}
return View();
}
查看 -
@model MvcApplication8.Models.SystemUser
<h2>
UserProfile</h2>
<iframe width="560" height="315" src="@Model.FilePath" frameborder="0" ></iframe>
FilePath-
/Logo/video-2012-12-08-21-31-56.mp4
当用图像工作使用<img src="@Model.FilePath">
而不是视频,它工作得很好。
iframe嵌入出了什么问题?
感谢这方面的工作,但它是不是只是一个静态的视频路径。我正在保存路径,然后通过'@ Model.Filepath'显示它# – Manoj
我更新了回应 –
仍在挣扎,我得到了FilePath,但它以“无法解析服务器的DNS地址”错误欢迎我。 – Manoj