1

我正在测试一个防止用户在 JWPlayer 6.10 上跳过的解决方案(该解决方案可以在这个线程https://stackoverflow.com/a/11766073/616453中找到)。

onSeek 函数在笔记本电脑上的 firefox/chrome 和 Android 上的 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;
        }   
     });
}
4

0 回答 0