我在c#中编写了一个测试应用程序来播放videojs播放器中的video / mp4文件,videojs播放器的源代码是一个调用控制器方法的HttpRouteURL。此控制器方法返回FilePathResult(文件),该文件是video / mp4文件。输出视频在IE 10中运行良好,但在Chrome中无法正常运行。在Chrome中,当我滚动“搜索栏”以前进到视频的其他部分时,它再次回落到当前时间,我无法清理。它从我推进酒吧之前的播放点开始播放。我猜这个问题是因为我不是从.mp4文件中获取,而是从返回视频文件对象的控制器URL获取。你可以帮助我在Chrome和Mozilla中启用视频清理吗?这是控制器代码:
public FilePathResult SendToView(string coursename, int year, string sem, int id)
{
List<Video> videoList = new List<Video>();
Video video1 = new Video(
"ece-550", 2012, "simpsons.mp4", "spring", @"C:\Products\PCRS", 550);
Video video2 = new Video(
"ece-573", 2013, "oceans.mp4", "fall", @"C:\samples", 573);
Video video3 = new Video(
"ece-773", 2013, "whistle.mp4", "spring", @"C:\Products\PCRS\RnD\ffmpeg\input", 773);
Video video4 = new Video(
"his-501", 2012, "ducks.mp4", "fall", @"C:\", 501);
videoList.Add(video1);
videoList.Add(video2);
videoList.Add(video3);
videoList.Add(video4);
foreach (var v in videoList)
{
if (coursename == v.Coursename && year == v.Year && sem == v.Sem && id == v.Id)
{
returnpath = v.VideoPath;
finalpath = Path.Combine(returnpath, v.Filename);
}
}
Response.Clear();
Response.AddHeader("Content-Disposition", "inline; filename=@finalpath");
return File(finalpath, "video/mp4");
}
}
}
这是视图片段:
<div>
<!-- Using video.js -->
<video id="videoPlayer" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="480"
data-setup='{}'>
<source src="@Url.HttpRouteUrl("Course", new { controller = "Course", action = "SendToView", coursename = course , year = year,
sem = semester , id = ID})" type="video/mp4" />
</video>
</div>
非常感谢,请帮忙。