Giter Club home page Giter Club logo

Comments (4)

Mottie avatar Mottie commented on June 26, 2024

Hi @binishprabhakar!

You can try modifying the isPlaying function to go to the next page when it sees the flag that the video has ended. Something like this:

var isPlaying = function(slider) {
  var vid = slider.$currentPage.find("video");
  if (vid.length && typeof vid[0].pause !== "undefined") {
    if (vid[0].ended) {
      slider.gotoPage(slider.currentPage, true);
      return false;
    }
    return !vid[0].paused && !vid[0].ended;
  }
  return false;
};

$(this.$el).anythingSlider({
  // ...
  isVideoPlaying: function(slider) {
    return isPlaying(slider);
  }
});

I quickly threw this together and didn't check the logic or functionality, so please bear that in mind.

from anythingslider.

binishmp avatar binishmp commented on June 26, 2024

@Mottie I have tried this method also. But getting maximum stack exceeded error.

app.js:19056 Uncaught RangeError: Maximum call stack size exceeded

at RegExp.exec ()
at Function.Sizzle [as find] (app.js:19056)
at jQuery.fn.init.find (app.js:21186)
at isPlaying (app.js:54647)
at Object.isVideoPlaying (app.js:54739)
at $.anythingSlider.base.gotoPage (app.js:31718)
at isPlaying (app.js:54650)
at Object.isVideoPlaying (app.js:54739)
at $.anythingSlider.base.gotoPage (app.js:31718)
at isPlaying (app.js:54650)

from anythingslider.

binishmp avatar binishmp commented on June 26, 2024

@Mottie I have come up with a solution , seems like issue has fixed.

onSlideComplete: function(slider) {
//playVideo(slider.$currentPage);

//check slider has video
var vid = slider.$currentPage.find("video");

if (vid.length) {
    //vid[0].currentTime = 0;
    vid[0].muted = true;
    vid[0].play();
    slider.clearTimer(true); // stop slideshow

    var refreshId = setInterval(function() {
        if (!isPlaying(slider.$currentPage)) {
            slider.clearTimer(true); // stop slideshow
            vid[0].muted = true;
            vid[0].pause();
            slider.gotoPage(slider.currentPage + 1, true);
            slider.startStop(slider.playing, true);
            clearInterval(refreshId);
        }
    }, 500);
} else {
    slider.clearTimer(true); // stop slideshow
    setTimeout(function() {
        slider.gotoPage(slider.currentPage + 1, true);
        slider.startStop(slider.playing, true); // restart slideshow
    }, 10000);
}

},

But, it shows a transition between slide 1 to 2, if slider.gotoPage(slider.currentPage + 1, true); Do you have any idea about this or have any other suggestions.

from anythingslider.

binishmp avatar binishmp commented on June 26, 2024

Its fixed thank you ... @Mottie

from anythingslider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.