【发布时间】:2016-12-06 15:24:13
【问题描述】:
我今天在使用 JWPlayer 时遇到问题。
在 Chrome、FF 和 Edge 上一切正常,但在移动设备和 Safari 浏览器上却不行。我收到以下错误消息:
加载媒体时出错:无法播放文件 根据文档,我使用了错误的媒体格式,但它适用于移动设备和 Safari 浏览器上的所有浏览器。
这是我对 JWplayer 7.8.2 客户端的设置:
<div id="preview_video>
</div>
<script type="text/javascript">
jwplayer("preview_video").setup({
playlist: [{
sources: [{
file:"myfile.flv",
type: 'flv'
},{
file:"myfile.mp4"
// fallback mp4 file in case flash is disabled or not allowed
type:'mp4'
}],
image:"myfile_image.jpg"
}],
primary : 'flash',
aspectratio : "16:9",
width: "100%"
});
</script>
这是我的服务器端代码
if($_REQUEST["format"] == 'mp4'){
$mediaPath = $myfile."mp4";
$content_type = "video/mp4";
}else{
$mediaPathPhoto = $myfile".flv";
$content_type = "video/x-flv";
}
header("Content-Type: {$content_type}");
header("Content-Length: ".filesize($mediaPath));
readfile($mediaPath);
exit();
通过谷歌搜索了几个小时后,我来到这里希望有人可以帮助我..
谢谢你
【问题讨论】:
标签: javascript ios safari jwplayer mp4