Последние несколько дней у меня не было проблем с событием ключевой точки Vimeo, все работает нормально, я просто начал замечать это сегодня.
Это простой триггер ключевой точки.
Когдатекущее время видео достигает ключевой точки: оно что-то делает, в приведенном ниже примере кода мы просто выводим что-то с помощью оповещения.
Используя firebug на консоли Google Chrome, оно говорит, что cuePoint был успешно добавлен, но когда видео достигаетcuepoint, выдает ошибку.
снимок экрана консоли: https://user -images.githubusercontent.com / 42766598 / 45663523-898c3f80-bb39-11e8-8d87-4a4be84a3483.png
ключевая точка успешно добавлена, id: 10333313-0233-4312-8013-111233103010
Uncaught TypeError: Время должно быть числом.
URL тестовой страницы:http://rjlwebph.com/vimeo-cuepoint/test.html
Вот мой код ниже:
<html>
<head>
<script src="https://player.vimeo.com/api/player.js"></script>
</head>
<body>
<iframe src="https://player.vimeo.com/video/67449472?autoplay=1&title=0&byline=0&portrait=0" width="853" height="480" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
<script>
var iframe = document.querySelector('iframe');
var player = new Vimeo.Player(iframe);
var cueTime = 60;
player.addCuePoint( cueTime, {
customKey: 'customkey'
}).then(function(id) {
console.log('cue point added successfully, id: '+id);
}).catch(function(error) {
switch (error.name) {
case 'UnsupportedError':
console.log('cue points are not supported with the current player or browser: '+cueTime);
// cue points are not supported with the current player or browser
break;
case 'RangeError':
console.log('the time was less than 0 or greater than the video’s duration: '+cueTime);
// the time was less than 0 or greater than the video’s duration
break;
default:
console.log('some other error occurred: '+cueTime);
// some other error occurred
break;
}
});
player.on('cuepoint', function() {
alert('cuePoint reached... '+cueTime);
});
</script>
</body>
</html>