我看过其他帖子并试过不同的决议,但没有一个对我有用。
视频文件在Chrome中可以正常播放,但会出错
html5:找不到文件
IE10和FF中的
最初我只有以下代码
<div class="flowplayer">
<video>
<source class="video-source" type="video/mp4" src="@Model.VideoURL" />
</video>
</div>
然后我根据this
更新了代码<div class="flowplayer">
<video>
<!-- if Firefox -->
<source src="@Model.VideoURL" type="video/ogg" />
<!-- if Safari/Chrome-->
<source src="@Model.VideoURL" type="video/mp4" />
<!-- If the browser doesn't understand the <video> element, then reference a Flash file. You could also write something like "Use a Better Browser!" if you're feeling nasty. (Better to use a Flash file though.) -->
<embed src="@Model.VideoURL" type="application/x-shockwave-flash" width="1024" height="798" allowscriptaccess="always" allowfullscreen="true"></embed>
</video>
</div>
我从AWS中提取视频,视频网址看起来像这样
https://myurl.cloudfront.net/MyGuid
更新
我按照doc
更改了我的代码HTML 的
<div class="player" data-engine="flash">
<video preload="none">
<source type="video/ogg" src="@Model.VideoURL">
<source type="video/webm" src="@Model.VideoURL">
<source type="video/mp4" src="@Model.VideoURL">
</video>
</div>
的Javascript
$(".player").flowplayer({ swf: "/Content/swf/flowplayer.swf" });
这在IE10和Chomre中运行良好,但在FF中我得到错误
html5: Video file not found
'https://myurl.cloudfront.net/myGuid'
//this is the correct url and the one that is located in @Model.VideoURL
更新2
我猜火狐不喜欢来自其他网站here
的abosulte网址我尝试使用this guys suggestion
设置自定义属性但我仍然收到相同的错误(html5:未找到视频文件)
答案 0 :(得分:3)
错误不是网址或流程播放器。这就是我在AWS中存储数据的方式。我在上传视频时没有指定内容类型。 Chrome非常聪明,可以用闪存来解决问题,因此IE也是如此,但FF从未如此。
新文件上传代码
using (AmazonS3Client client = new AmazonS3Client())
{
var bucketObject = new PutObjectRequest
{
BucketName = fileStorageProvider.BucketName,
Key = awsFileName,
ContentType = "video/mp4", //new line of code
CannedACL = S3CannedACL.PublicRead
};
bucketObject.WithInputStream(file.InputStream);
client.PutObject(bucketObject);
}