CSS-Tricks / AnythingSlider

A jQuery Slider plugin for anything.
http://css-tricks.github.io/AnythingSlider/
GNU Lesser General Public License v3.0
1.15k stars 380 forks source link

how to call function isVideoPlaying() with a certain fixed time, which I define. #520

Closed Vitoko closed 11 years ago

Vitoko commented 11 years ago

How can I change the frequency call of the function "isVideoPlaying ()" to be fixed .. suppose 3 milliseconds, and not take the time of the "delay"?

I ask this because I use videos and pictures in one slideshow with autoplay, so when an image has a time of "60 seconds", it change the delay time and the call to isVideoPlaying () takes too long to move to the next slide.

(Sorry my english, and thank you for this useful and beautiful tool)

Mottie commented 11 years ago

Hi Vitoko!

I'll probably need to add another option to set that delay to be a different value. In the mean time, you can just change the value yourself - line 807

                    } else if (!o.resumeOnVideoEnd) {
                        // stop slideshow if resume if false
                        base.startStop();
                    }
                }, o.delay); // <-------- change the delay here
            } else {
                base.clearTimer();
            }
Vitoko commented 11 years ago

Hi Mottie, thanks for you answer..

if i change it.. i supose:

} else if (!o.resumeOnVideoEnd) {
                    // stop slideshow if resume if false
                    base.startStop();
                }
            }, 2000); // <-------- change the delay here
        } else {
            base.clearTimer();
        }

And my code its like:

        $('#slider').anythingSlider({
            delay                : 60000,
            resizeContents            : true,
            addWmodeToObject    : 'transparent',
            buildArrows       : false,
            buildNavigation             : false,

my pictures shows only 2 seconds now! not 60 .. i don't understand...

Mottie commented 11 years ago

The delay 2000 is in milliseconds. To make it 60 seconds, set the value to 60000.

Vitoko commented 11 years ago

let me explain again, i need the function isVideoPlaying works every 2 seconds, and my images appear on the screen for 60 seconds...

i change the value in the code (line 807), and its look like the main value delay doesn't work..

(sorry my english my friend... it's very difficult to me explain this)

Mottie commented 11 years ago

Hmm, well the problem is that the delay that we just changed is actually the slideshow delay, so changing it in the code like we did overrides the option setting. The isVideoPlaying function is only called when the slider is ready to change pages, so if the page is ready to change and it finds that the video is playing, it just waits until the next change page interval to check again.

I realize that it would take a long time to change slides if you have a very short video, but maybe 60 seconds is too long. If the user hovers over the slider, the slideshow pauses and restarts the timer when they stop hovering over the slider; so the slideshow timer restarts and they would have to wait another 60 seconds before the slide changes.

I don't think I have the time nor the desire to change the slideshow timer from how it works now; so I think it might be best to either completely stop the slideshow, or reduce the delay because the user can pause the slideshow or change slide sooner if they so desire. Sorry.

Vitoko commented 11 years ago

Mottie, i was use this code (method 2): https://github.com/CSS-Tricks/AnythingSlider/wiki/FAQ#wiki-delay

but i realize that this method replace the delay time, so i use method 1, wich only adds time to a fixed delay time (a short time) so it's works for me..

Thanks!