0

I am using the following code to play a video. What i want is to stop the video and when I rollover to start again. Now if I rollover after the video start it will continue from the point was paused

function hide_wrap () {
var wrap = $('#wrap');
if (wrap.data('hidden')) return;
wrap.animate({height: '-=250px'}, 'slow');
  $('#videoContainer').hide();
  $("video")[0].pause();
  $("#button").hide();
    wrap.data('hidden', true);
}
function show_wrap() {
    var wrap = $('#wrap');
    wrap.animate({height: '+=250'}, 'slow');
    $('#videoContainer').css('display', 'block');
    $("video")[0].play();
    $('#button').css('display', 'block');
      wrap.data('hidden', false);
  }
Markus Hayner
  • 2,869
  • 2
  • 28
  • 60
  • 1
    Possible duplicate of [HTML5 video javascript controls - restart video](http://stackoverflow.com/questions/8402158/html5-video-javascript-controls-restart-video) – Rob Nov 03 '15 at 17:45

1 Answers1

1

You just need to set

$("video")[0].currentTime = 0;

and there you go.

Filipe Merker
  • 2,428
  • 1
  • 25
  • 41