var stopVideo = function ( element ) {
    var iframe = element.querySelector( 'iframe');
    var video = element.querySelector( 'video' );
    if ( iframe !== null ) {
        var iframeSrc = iframe.src;
        iframe.src = iframeSrc;
    }
    if ( video !== null ) {
        video.pause();
    }
};
Call the function as needed, passing the container element into the function:
stopVideo( tab );// autoplay video
$(window).scroll(function() {
  $(".autoplay-video iframe").each( function() {
    var 
      $this = $(this), 
      videoSrc = $this.attr("src"),
      symbol;
    if( !$this.hasClass("video-init") && $(window).scrollTop() > $this.offset().top - 200 ) {
    		$this.addClass("video-init");
        symbol = videoSrc.indexOf("?") == -1 ? "?" : "&";
        $(this)[0].src += symbol + "autoplay=1";
    } else {
    }
  }); 
});