ビデオへのポインティングをMVC
返す簡単なアクションがあります。FilePathResult
何らかの理由で、HTML5
ビデオ(を使用js-video.js
)がビデオを再生していません。URLを機能することがわかっているURLに変更すると、ビデオは正常に再生されます。したがって、それは私がファイルを提供する方法と関係があるに違いありません。
ブラウザでURLを参照すると、ビデオがダウンロードされて正常に再生されます。
ビデオは.mp4
、返されるMIMEタイプがvideo/mp4
。です。
Video Studio 2012
、、、を使用して.NET 4
いIIS 8 Express
ますWindows 7 x64 Home Premium
。
これが私のそれぞれのコードです:
[Authorize(Roles = "File_Read")]
public FileResult Get(int? id)
{
try
{
if (id == null)
throw new ArgumentNullException("id");
var fileRepo = FileRepositoryFactory.Repository;
var file = fileRepo.GetById(id.Value);
if (file == null)
throw new InvalidOperationException(String.Format("Failed to find file with id: {0}", id));
if (String.IsNullOrWhiteSpace(file.FilePath))
{
return this.File(file.Data, file.MIMEType, file.FileName);
}
else
{
return this.File(file.FilePath, file.MIMEType, file.FileName);
}
}
catch (Exception ex)
{
return this.File("failed.txt", "text/plain");
}
}
Chrome
これが返されるもののスクリーンショットです: