Javascript 如何在JWPlayer中强制使用HTML5并禁用Flash
下面是我的代码,在播放视频时应该使用HTML5播放器Javascript 如何在JWPlayer中强制使用HTML5并禁用Flash,javascript,html,jwplayer,Javascript,Html,Jwplayer,下面是我的代码,在播放视频时应该使用HTML5播放器 <html> <head><script type="text/javascript" src="http://content.jwplatform.com/libraries/asdetr.js"></script></head> <body> <div id="myElement">Loading the player...</div>
<html>
<head><script type="text/javascript" src="http://content.jwplatform.com/libraries/asdetr.js"></script></head>
<body>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
file: "http://content.jwplatform.com/videos/trytry-789.mp4",
image: "http://content.jwplatform.com/thumbs/dfg569-676.jpg",
width: 640,
height: 360,
modes: [
{ type: "html5",
config: {
file: "http://content.jwplatform.com/videos/trytry-789.mp4"
}
}
]
});
</script>
</body>
</html>
正在加载播放器。。。
var playerInstance=jwplayer(“myElement”);
playerInstance.setup({
文件:“http://content.jwplatform.com/videos/trytry-789.mp4",
图像:“http://content.jwplatform.com/thumbs/dfg569-676.jpg",
宽度:640,
身高:360,
模式:[
{类型:“html5”,
配置:{
文件:“http://content.jwplatform.com/videos/trytry-789.mp4"
}
}
]
});
请建议我使用HTML5播放器的好方法。如果我做错了,请纠正我 这似乎是可能的,我为你创作了这把小提琴: 可能导致问题的原因之一是,您正在从外部站点(
http://content.jwplatform.com/libraries/asdetr.js
),当前返回404。我把它改成了http://content.jwplatform.com/libraries/XeGdlzmk.js
并临时修复;但这不是最终的解决办法
以下是在站点中实现jwplayer的两种方法,具体取决于从何处加载库:
- 云托管播放器:来自jwplayer服务器
- 自托管:从您的服务器
在这里你可以找到更多关于它的信息 改用此代码。您使用的是JW Player 5的模式块,非常不推荐使用。下面的代码可以工作,因为JW6和JW7已经强制主渲染模式为HTML5
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://content.jwplatform.com/libraries/asdetr.js"></script>
</head>
<body>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
file: "http://content.jwplatform.com/videos/trytry-789.mp4",
image: "http://content.jwplatform.com/thumbs/dfg569-676.jpg",
width: 640,
height: 360,
fallback: false
});
</script>
</body>
正在加载播放器。。。
var playerInstance=jwplayer(“myElement”);
playerInstance.setup({
文件:“http://content.jwplatform.com/videos/trytry-789.mp4",
图像:“http://content.jwplatform.com/thumbs/dfg569-676.jpg",
宽度:640,
身高:360,
后退:错误
});
试试这段代码。它对我有用
<html>
<head><script type="text/javascript" src="http://content.jwplatform.com/libraries/asdetr.js"></script></head>
<body>
<div id="myElement">Loading the player...</div>
<video crossorigin="anonymous" poster="http://support.jwplayer.com/customer/portal/attachments/268150" controls="controls" width="640" height="272">
<source src="http://content.jwplatform.com/videos/C4lp6Dtd-640.mp4" type="video/mp4" />
</video>
</body>
</html>
正在加载播放器。。。
我已经使用了上面的代码,它可以工作,但我有一个问题,当我们右键单击播放器时,它仍然显示flash player而不是HTML 5。我们正在使用的视频是.mp4,还是需要使用其他视频格式?谢谢你有链接吗?我在本地测试的代码是html5,而不是Flash。这对我来说是在html5模式下运行的。我使用的是JW播放器版本7。如何检查JW播放器是否使用HTML5播放器?还有Flash播放器?有没有办法检查一下?谢谢。右击播放器。如果右击菜单中有Flash版本,它会这样说。