diff --git a/frontend/index.html b/frontend/index.html index 18e0867..ab356b5 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -90,6 +90,13 @@ +
+ + +
diff --git a/frontend/js/feed.js b/frontend/js/feed.js index 638ce7c..638410b 100644 --- a/frontend/js/feed.js +++ b/frontend/js/feed.js @@ -76,6 +76,22 @@ App.feed = App.feed || {}; return Math.min(total - 1, Math.max(0, index)); }; + // True when the user wants a finished clip to replay; false when it should + // auto-advance to the next video. Defaults to looping (see storage). + const shouldLoop = function() { + return App.storage.getFeedEndBehavior() !== 'scroll'; + }; + + // Smoothly scrolls to the slide after `fromIndex`; the scroll-snap container + // fires onScroll, which promotes the new slide to active. No-ops at the end + // of the list so the final clip simply stops on its last frame. + const advanceToNext = function(fromIndex) { + const next = clampIndex(fromIndex + 1); + if (next < 0 || next === fromIndex) return; + const scroller = getScroller(); + if (scroller) scroller.scrollTo({ top: next * slideHeight(), behavior: 'smooth' }); + }; + // Remembers playback position per video id so scrolling away and back // resumes where the user left off. Slides kept in the window are merely // paused (instant resume); slides whose