最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Prevent Slider Revolution from pausing HTML5 video - Stack Overflow

programmeradmin4浏览0评论

I'm using the Themepunch Revolution slider in a project, which shows a single video slide in HTML 5.

When I click on it, it pauses, which I don't want.

The <video> element in the page is generated by the slider plugin.

Here's what I tried so far:

$('body').on('click', 'video', function(e) {
    e.preventDefault();
    e.stopPropagation();
    return false;
});

This is the code in the slider library:

html5vid.find('video, .tp-poster, .tp-video-play-button').click(function() {
    if (html5vid.hasClass("videoisplaying"))
        video.pause();
    else
        video.play();
})

I also tried catching the pause event, but it never fires:

$('body').on('pause', 'video', ...);

I'm using the Themepunch Revolution slider in a project, which shows a single video slide in HTML 5.

When I click on it, it pauses, which I don't want.

The <video> element in the page is generated by the slider plugin.

Here's what I tried so far:

$('body').on('click', 'video', function(e) {
    e.preventDefault();
    e.stopPropagation();
    return false;
});

This is the code in the slider library:

html5vid.find('video, .tp-poster, .tp-video-play-button').click(function() {
    if (html5vid.hasClass("videoisplaying"))
        video.pause();
    else
        video.play();
})

I also tried catching the pause event, but it never fires:

$('body').on('pause', 'video', ...);
Share Improve this question asked Feb 27, 2016 at 13:44 OliOli 2,4742 gold badges28 silver badges47 bronze badges 3
  • well, isn't the code in the slider library telling you why it's pausing? it's checking whether it's running, if so it will pause... don't think you can override that outside the library unless you edited the script... – benomatis Commented Feb 27, 2016 at 13:46
  • ...have you tried unbinding click? – benomatis Commented Feb 27, 2016 at 13:49
  • @webeno yeah my only working solution so far is directly removing the lines from the library, which is ugly :( – Oli Commented Feb 27, 2016 at 14:00
Add a ment  | 

3 Answers 3

Reset to default 5

For Revolution Slider 6.x, it's easier, just select the video layer option > Content > (Scroll down) Advanced Media Settings > Set "No Interaction" off

This will disable the click to pause/play also remove controls, you end up with a playing video with no interactions, also don't forget to set Loop Media on for plete experience

Revolution Slider No Interaction Setting to prevent controls and stop click for play/pause:

Hey it is 2019 but anyone who look for solution is that :

Put transparent shape layer onto video layer as full width and height.

Make sure put this layer one step above the video layer as showing below(this shape looks like it below the video layer but in rev slider animation settings the more bottom the more up on the front-end i hope i make it clear :)

Layer positions on rev slider animation settings

Try

html5vid.find('video, .tp-poster, .tp-video-play-button').unbind('click');

Replace html5vid with whatever element the script is looking to find in.

EDITED

...or better yet, try to unbind click on the video element as follows:

$('video').unbind( "click" );
发布评论

评论列表(0)

  1. 暂无评论