0

I am using jQuery plugin called GalleryView, in its Beta3 version (http://spaceforaname.com/galleryview). The Beta4 version is planned to have built-in controls for play/pause animation. My question is:

How to emulate 'play' and 'pause' controls from outside the script without the need to modify GalleryView code. Is there any plugin for that? Or maybe undocumented action?

During the initialization it is possible to decide whether you want the autoplay feature on or off.

If there is no action/plugin available, how did you solve that? Can you share GalleryView modification you applied?

Regards, T.

Tadeck
  • 132,510
  • 28
  • 152
  • 198

3 Answers3

1

I solved this by modifying original GalleryView script by adding the following things:

  • paused variable within script, storing the status of pause/play (true if paused, false if playing),
  • added the following callback definition:

    /*
    **  playPause()
    **      Resume slideshow if paused, pause if slideshow playing.
     */
    function playPause() {
        if(!paused) {
            // Pause slideshow in 500ms. This allows for brief swipes of the mouse over the gallery without unnecessarily pausing it
            $(document).oneTime(0,"animation_pause",function(){
                $(document).stopTime("transition");
                paused = true;
            });
            $('.gv-nav-play-pause').removeClass('gv-nav-pause').addClass('gv-nav-play');
        } else {
            $(document).stopTime("animation_pause");
            if(opts.transition_interval > 0) {
                $(document).everyTime(opts.transition_interval,"transition",function(){
                    showNextItem();
                });
                paused = false;
            }
            $('.gv-nav-play-pause').removeClass('gv-nav-play').addClass('gv-nav-pause');
        }
    };
    
  • added a button for play/pause, styled it and attached playPause callback to it on click and some touch events (to allow touch-enabled devices).

It worked like a charm, without glitches, but the code may not be perfect - I had to use original GalleryView code, which itself is not perfect.

Tadeck
  • 132,510
  • 28
  • 152
  • 198
0

As of now I haven't found any way to turn autoplay off (I would like that option as well). It is my understanding that the next version will have player controls. As of this post it is still unstable but promising. Here's a link to the version 3 Beta4 demo page by the GalleryView author:

http://spaceforaname.com/galleryview-3.0/testpage.html

Ed C
  • 1
  • Thank you for your effort, but I already know about incoming Beta4 version. Unless it is stable, it represents no value to me. It seems I am going to implement play / pause controls myself and - if possible - post the solution / code here. – Tadeck May 09 '11 at 23:07
0

I'm using the current version and needed the autoplay turned off on one slider. I solved it by putting in a 10 minute delay between cycles. This gave the 9 minute video in one of the slides time to play. A longer delay (30 minutes) would effectively turn off autoplay.

Wayne
  • 1
  • How have you solved the ability to press 'play' for a slideshow? Did you store the value of `transition_interval` in some internal variable? I have solved the problem and am planning to place link to the solution here (I have added play/pause button in Beta3 and it still probably needs some work for vertical mode), but are interested if your solution is cleaner (at least in some terms). – Tadeck May 11 '11 at 21:00
  • 1
    Tadeck, didn't address play/pause. Slideshow is in autoplay constantly. Just set a very long cyle time between slides. Since I use thumbnails and previous / next buttons, those served as a "play" button whenever the user wanted to advance. Pressing any of those overrides the long delay. BTW...noted today that spaceforaname.com went offline. – Wayne May 11 '11 at 23:04
  • Ooops, that is not good (I am saying about Gallery View). Hopefully, I have downloaded previous version and created a repository on GitHub (intending to expand it with lacking features, but it seems it will have to serve also for people wanting to download Beta3 version also, since the original location is not working), so the script itself is not lost. I hope the author will post it somewhere else on the Internet. The location of the script: [github.com/tadeck/GalleryView](https://github.com/tadeck/GalleryView). – Tadeck May 11 '11 at 23:42
  • When it comes to feature you developed: I think I may misunderstand what you are saying, but are you saying that you have disabled the autoplay for the whole slideshow (slider) by increasing the `transition_interval` option to `10000`? According to the documentation (google cache version [here](http://bit.ly/j0lgq0)), similar thing (but permanently disabling automatical transitions) can be done by setting `transition_interval` to `0`. – Tadeck May 11 '11 at 23:58