MVC3 사이트에서 비디오를 제공하고 있는데, 비디오를 반환하는 컨트롤러 동작과 함께 FilePathResult를 반환하며 브라우저에서 재생하려고하면 몇 가지 실망한 문제가 나타납니다. 내 video.js 또는 mediaelement.js 사용 여부에 관계없이.MVC3 동작의 HTML5 비디오가 올바르게 작동하지 않습니다.
-
크롬이 진행 막대를 사용하여 위치를 변경하지 않으며, 그것이
- IE9는
- 파이어 폭스 남은/경과 표시되지 않습니다 비교적 잘 보인다 완료되면 비디오를 재생할 수 있습니까
- 시간이 정확하게
그러나 내가 호스트되는 파일에 대한 상대 경로를 제공하면 모두 정상적으로 작동합니다. 동영상은 특정 역할에 속한 사용자 만 사용할 수 있어야하므로 실제 옵션이 아닙니다.
액션 :
[Authorize]
public ActionResult Video(string fileName)
{
var pathBase = Server.MapPath("~/Downloads/Videos/");
var filePath = pathBase + fileName;
var contentType = ContentType(fileName);
return new FilePathResult(filePath, contentType) { FileDownloadName = fileName };
}
면도기 :
<!-- @t = the video entity -->
<video width="640" height="360" id="@t.Id" poster="@Url.Action("Video", "Download", new { fileName = @t.Poster })" controls="controls" preload="none">
<!-- MP4 source must come first for iOS -->
<source src="@Url.Action("Video", "Download", new { fileName = @t.Mp4 })" type='video/mp4' />
<!-- WebM for Firefox 4 and Opera -->
<source src="@Url.Action("Video", "Download", new { fileName = @t.WebM })" type='video/webm' />
<!-- OGG for Firefox 3 -->
<source src="@Url.Action("Video", "Download", new { fileName = @t.Ogv })" type='video/ogg' />
<!-- Fallback flash player for no-HTML5 browsers with JavaScript turned off -->
<object width="640" height="360" type="application/x-shockwave-flash" data="@Url.Content("~/Content/flashmediaelement.swf")">
<param name="movie" value="@Url.Content("~/Content/flashmediaelement.swf")" />
<param name="flashvars" value="controls=true&[email protected]("Video", "Download", new { fileName = @t.Poster })&[email protected]("Video", "Download", new { fileName = @t.Mp4 })" />
<!-- Image fall back for non-HTML5 browser with JavaScript turned off and no Flash player installed -->
<img src="@Url.Action("Video", "Download", new { fileName = @t.Poster })" width="640" height="360" alt="@t.Title"
title="No video playback capabilities" />
</object>
</video>
URL이 그들이 완전히 구문 분석 할 때처럼 중요시하는 점은 무엇입니까?를 – heff
download/video? fileName = file.ext – damienc88