Jump to content


These Forums Are Now Read-Only


For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Photo

Next And Previous Js Functions

wordpress youtube tubepress-pro

  • Please log in to reply
4 replies to this topic

#1 db306

db306

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 17 April 2014 - 06:00 PM

Does anyone one know what is the function that calls the following video in javascript?

I want to add two buttons that call the function to move to the next or previous video. When a video finishes, the following one starts, so I guess there is a function for that?

 

I'm interested in youtube videos only although I doubt it changes anything?

 

Thanks :)



#2 db306

db306

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 18 April 2014 - 09:40 AM

On the gallery.js I found this bit of code but I cannot manage to call with a simple function the next video...

Is there a way I could do something like:

 

<button onclick="publish(text_event_galleryChangeVideo, [ galleryId, sequence[index + 1] ]);">Next</button> 
    (function () {

        /**
         * Go to the next video in the gallery.
         */
        var onNextVideoRequested = function (event, galleryId) {

            /** Get the gallery's sequence. This is an array of video ids. */
            var sequence  = galleryRegistry.getSequence(galleryId),
                vidId     = galleryRegistry.getCurrentVideoId(galleryId),
                index     = jquery.inArray(vidId.toString(), sequence),
                lastIndex = sequence ? sequence.length - 1 : index;

            /** Sorry, we don't know anything about this video id, or we've reached the end of the gallery. */
            if (index === -1 || index === lastIndex) {

                return;
            }

            /** Start the next video in line. */
            publish(text_event_galleryChangeVideo, [ galleryId, sequence[index + 1] ]);
        },

            /** Play the previous video in the gallery. */
            onPrevVideoRequested = function (event, galleryId) {

                /** Get the gallery's sequence. This is an array of video ids. */
                var sequence = galleryRegistry.getSequence(galleryId),
                    vidId    = galleryRegistry.getCurrentVideoId(galleryId),
                    index    = jquery.inArray(vidId.toString(), sequence);

                /** Sorry, we don't know anything about this video id, or we're at the start of the gallery. */
                if (index === -1 || index === 0) {

                    return;
                }

                /** Start the previous video in line. */
                publish(text_event_galleryChangeVideo, [ galleryId, sequence[index - 1] ]);
            };

        subscribe(text_event_galleryNextVideo, onNextVideoRequested);

        subscribe(text_event_galleryPreviousVideo, onPrevVideoRequested);

    }());


#3 brandon

brandon

    Advanced Member

  • TubePress Staff
  • 1989 posts

Posted 22 April 2014 - 11:04 PM

Hello db306,

 

This level of customization is beyond the level of support provided by this forum.

 

Thanks!


Want a faster, more personalized support experience? Open a ticket with us! We will be gradually phasing out forum-based support in favor of a proper ticketing system. Please help us help you!


#4 sami789

sami789

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 05 October 2014 - 10:32 AM

I want to add two buttons that call the function to move to the next or previous video. When a video finishes, the following one starts, so I guess there is a function for that?

 


Mohsin


#5 brandon

brandon

    Advanced Member

  • TubePress Staff
  • 1989 posts

Posted 06 October 2014 - 06:22 PM

Hello Sami,

 

Yes, there is a function for that however that level of customization is beyond the support offered on this forum.

 

Thanks!


Want a faster, more personalized support experience? Open a ticket with us! We will be gradually phasing out forum-based support in favor of a proper ticketing system. Please help us help you!