Vimeo Player.js提示未捕获的TypeError:时间必须为数字:

时间:2018-09-18 10:57:29

标签: vimeo-api vimeo-player

这个很奇怪。我有一个Vimeo视频,并设置了多个提示点以触发各种事件。
直到今天早上,一切都很好。

HTML示例:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Cue point Issue</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="css/style.css" rel="stylesheet">

</head>
<body>
    <div class="videoContainer">
        <img class="aspectRationImg" src="img/asp-img.png" />
        <iframe class="custVimVideo" src="https://player.vimeo.com/video/33110953?title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>      
    </div>

<script src="https://player.vimeo.com/api/player.js"></script>
<script src="js/interactive_video_events.js"></script>
</body>
</html>

随附的JavaScript:

var iframe = document.querySelector('iframe');
var player = new Vimeo.Player(iframe);

player.addCuePoint(5, {
customKey: 'doSomething'
}).then(function(id) {
}).catch(function(error) {
    switch (error.name) {
        case 'UnsupportedError':
            break;
        case 'RangeError':
            break;
        default:
            break;
    }
});

player.on('cuepoint', function(data) {
    switch (data.data.customKey) {
            case 'doSomething':
                console.log("Cue Called");
                break;
            default:
                break;
        }
});

视频播放5秒后,会产生以下错误(谷歌浏览器):

player.js:2 Uncaught TypeError: Time must be a number.
at new r (player.js:2)
at Function.value (player.js:2)
at player.js:2
at Array.forEach (<anonymous>)
at TextTrack.<anonymous> (player.js:2)
at TextTrack.e (player.js:2)
r @ player.js:2
value @ player.js:2
(anonymous) @ player.js:2
(anonymous) @ player.js:2
e @ player.js:2

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

我们的最新版本中存在一个导致此问题的错误。它是在我们的API存储库(https://github.com/vimeo/player.js/issues/318)中报告的,此后已得到解决。这不再是问题!