Fork Copy Preview Loop a part of video on Youtube Loop a part of video on Youtube Drag and drop startTime; var suitableTimeout = endTime - startTime; if (currentTime <= startTime || currentTime > endTime) { ytplayer.seekTo(startTime); } else { suitableTimeout = endTime - currentTime; } console.log('>> Start timeout after: ', suitableTimeout * 1000); setTimeout(function () { simpleLoop(startTime, endTime) }, suitableTimeout * 1000); } var savedTimerange = localStorage.getItem('simple_loop_' + location.href); var input = prompt('Time range: start,end', savedTimerange || ''); if (!input) { return; } localStorage.setItem('simple_loop_' + location.href, input); var arr = input.split(','); simpleLoop(parseInt(arr[0]), parseInt(arr[1])); })();"> Simple Loop into bookmark bar. Open video on youtube. Click Simple Loop bookmark and type time range. View script here.