我有一段代碼,我一直在努力爲視頻提供服務。代碼如下:.net MVC流媒體MP4到iDevice問題
public ResumingFileStreamResult GetMP4Video(string videoID)
{
if (User.Identity.IsAuthenticated)
{
string clipLocation = string.Format("{0}\\Completed\\{1}.mp4", ConfigurationManager.AppSettings["VideoLocation"].ToString(), videoID);
FileStream fs = new FileStream(clipLocation, FileMode.Open, FileAccess.Read);
ResumingFileStreamResult fsr = new ResumingFileStreamResult(fs, "video/mp4");
return fsr;
}
else
{
return null;
}
}
這是我的HTML代碼:
<video controls preload poster="@Url.Content(string.Format("~/Videos/{0}_2.jpg", Model.VideoID))">
<source src="@Url.Action("GetMP4Video", "Video", new { videoID = Model.VideoID })" type="video/mp4" />
<source src="@Url.Action("GetWebMVideo", "Video", new { videoID = Model.VideoID })" type="video/webm" />
<object id="flowplayer" data="@Url.Content("~/Scripts/FlowPlayer/flowplayer-3.2.14.swf")" type="application/x-shockwave-flash" width="640" height="360">
<param name="movie" value="@Url.Content("~/Scripts/FlowPlayer/flowplayer-3.2.14.swf")" />
<param name="allowfullscreen" value="true" />
<param name="flashvars" value="config={'playlist':['@Url.Content(string.Format("~/Videos/{0}_2.jpg", Model.VideoID))',{'url':'@Url.Action("GetMP4Video", "Video", new { videoID = Model.VideoID })','autoPlay':false}]}" />
</object>
</video>
我的問題是這樣的設置似乎工作,從我的桌面上所有瀏覽器都正常,但當我嘗試使用加載頁面我iPad或iPhone只顯示播放圖標,並通過它顯示無法播放。我嘗試將mp4視頻的源代碼更改爲直接鏈接到mp4視頻,並立即開始播放。
有沒有什麼特別的我需要做的,我錯過了命令使我的方法兼容iDevices?任何幫助,將不勝感激。