我正在测试防止用户在JWPlayer 6.10上跳过的解决方案(该解决方案可以在此线程https://stackoverflow.com/a/11766073/616453中找到)。
onSeek功能在Android上的firefox / chrome和笔记本电脑上调用。但它没有被称为ios 8.4原生播放器。
有人会帮我这个吗?我以为JWPlayer 5有一些ios的问题而JWPlayer 6没有这个问题?是否有任何配置选项不适用于ios?感谢。
请在下面找到我用于演示的html和javascript:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="http://p.jwpcdn.com/6/10/jwplayer.js"></script>
<!--
<script type="text/javascript" src="./js/jwplayer.js"></script>
<script type="text/javascript" src="./js/jwplayer.html5.js"></script>
-->
<script type="text/javascript" src="./js/test.js"></script>
<title>Test JWPlayer</title>
<style>
h3 {
color: #101010;
font-family: Helvetica, Arial, sans-serif;
margin: 20px;
font-size: 20px;
}
.container {
position: relative;
}
</style>
<script>
$(document).ready(function(){
$(".test_button").click(func);
});
</script>
</head>
<body>
<h3>JWPlayer Test</h3>
<button type="button" class="test_button">Click to show video</button>
<div class="container">
<div class="metaplayer">
<div id='target'></div>
</div>
<div id='searchbar'></div>
<div id='transcript'></div>
</div>
</body>
</html>
以下是javascript代码
var func = function () {
var jwp, video, player;
jwp = jwplayer('target').setup({
controls: true, // v6
width: "600",
height: "300",
autostart: true,
file: "http://nimbus.c9w.net/files/nfiles/hulu-brand/hulu-brand-summer-keepup_640x360_440kbps_0dB.mp4"
});
var maxPlayPosition = 0.0;
var seeking = false;
jwp.onTime(function(event)
{
if (!seeking)
{
maxPlayPosition = Math.max(event.position, maxPlayPosition);
}
});
jwp.onSeek(function (event)
{
if (!seeking)
{
if (event.offset > maxPlayPosition)
{
seeking = true;
setTimeout(function ()
{
jwp.seek(maxPlayPosition);
}, 100);
}
}
else
{
seeking = false;
}
});
}