Video.js 在视频自动播放之前增加5秒延迟

Video.js 在视频自动播放之前增加5秒延迟,video.js,Video.js,我正试图在video.js开始自动播放之前为其添加5秒的延迟,但不知道如何使用此实现: $('.video-js').each(function () { var element = $(this); var id = element.attr('id').replace('#', ''); var heading_links = element.parents('.post-images-wrapper').find('.pcos-heading-links');

我正试图在video.js开始自动播放之前为其添加5秒的延迟,但不知道如何使用此实现:

$('.video-js').each(function () {
    var element = $(this);
    var id = element.attr('id').replace('#', '');
    var heading_links = element.parents('.post-images-wrapper').find('.pcos-heading-links');

    _V_(id).ready(function() {
        var video_player = this, options = video_player.options();

        if (options.autoplay) { heading_links.hide(); }

        video_player.on('ended', function() {  
            video_player.posterImage.show();  
            video_player.currentTime(0);  
            video_player.controlBar.hide();  
            video_player.bigPlayButton.show();  
            video_player.cancelFullScreen();
            heading_links.show();  
        });  

        video_player.on('play', function() {
            video_player.posterImage.hide();  
            video_player.controlBar.show();  
            video_player.bigPlayButton.hide();
            heading_links.hide();
        });  

    });
});

如果您使用的是
\u V\u
,那么您可能使用的是旧版本的video.js。更高版本只需使用
videojs
这应该仍然有效,但您也应该升级

首先,确保视频标签上不再有
autoplay
属性。然后:

_V_(id).ready(function(){
  var player = this;

  setTimeout(function(){
    player.play();
  }, 5000);
});

这样我就可以像这样编辑我的内容了?setTimeout(函数(){video_player.on('play',函数(){video_player.posterImage.hide();video_player.controlBar.show();video_player.bigPlayButton.hide();heading_links.hide();},5000);我不能完全理解你想做的每件事,但是你为什么不试试看呢。谢谢,它可以工作,但是我用了video_player.play()而不是player.play();