treehouse : what would you like to learn today?
Web Design Web Development iOS Development

ANYTHING SLIDER with JW Player Video

  • I am very new to jQuery. My slider works fine except when using jwplayer with video playing. The slider does not stop sliding nor does it pause the video.

    I am using this script which works only if you pause video and click play again

    This is how I have placed the video.

      <li class="panel1">
    
      <script type="text/javascript" src="/performance-dev/video/JW_Player/jwplayer.js"></script> 
    
      <div id='mediaspace1'>loading.....</div>
    
      <script type='text/javascript'>
      jwplayer('mediaspace1').setup({
      'flashplayer': '/performance-dev/video/JW_Player/player.swf',
      'file': '/performance-dev/video/JW_Player/Roundabout_Video.mp4',
      'image': 'performance-dev/video/JW_Player/preview.jpg',
      'autostart': 'false',
      'controlbar': 'bottom',
      'width': '700',
      'height': '320'
      });
      </script>
    
      </li>
    

    This is the script which i need help with..

          <script>
      $('#slider1').ready(function(){
    
      //Pause Slider when Playing
          jwplayer().onPlay(function() { 
       $('#slider1').data('AnythingSlider').startStop(false);  
      }); 
      });       
    
         </script>
    
  • Thanks Mottie, My slider is set withing the player - not outside. I am trying to pause the slideshow if someone clicks play only..

      <script>
    $(document).ready(function(){
    
    //Pause Slider when Playing video
        jwplayer().onPlay(function() { 
     $('#slider1').data('AnythingSlider').startStop(true);  
    }); 
    });       
       </script>
    

    The documentation in jsfiddle breaks my entire page..

    anyway what callback stops the slider.

    Appreciated.

  • See below Comment

  • The script below fires the alert when play button is pressed on the JW Player. But the slide wont pause..

      <script>
      $(document).ready(function(){
    
      //Pause Slider when Playing
       jwplayer().onPlay(function() { 
       $('#slider1').data('AnythingSlider').startStop(); //stop the slideshow 
       //alert("slider alert.");
      }); 
      });       
         </script>
    

    Is this function the right one to pause the slider or i am Missing something..Please Help.

         $('#slider1').data('AnythingSlider').startStop(); //stop the slideshow 
    
  • Is there a way to pause the slider by clicking inside the container?

  • I have the JW Player specifically set up outside of the slider because the slider duplicates slides. It is better not to put script tags inside of slider panels.

    Please follow the example I provided.

  • Thanks Mottie.