fix: YouTube autoplay fails after track #400 (#3541) #3584
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: YouTube Autoplay Fails After Track 400
🎯 Issue Summary
Fixes #3541 - YouTube fails to autoplay next track for all tracks past 400 in large playlists.
🔍 Root Cause
The
playlistUpNextAutoplayfunction was incorrectly settingcurrentIndex = totalVideoswhenplaylist_up_next_autoplaywas disabled, forcing playlists to end and breaking autoplay for large playlists beyond YouTube's ~200 video pagination limit.🛠️ Solution
Core Fix
currentIndex = totalVideoscurrentIndexandlocalCurrentIndexto maintain playlist continuityEnhanced Features
📁 Files Changed
📝
js&css\web-accessible\www.youtube.com\playlist.jsplaylistUpNextAutoplay()logicplaylistLargePlaylistHandler()functioncleanupPlaylistHandlers()function📝
js&css\web-accessible\functions.jsvideoPageUpdate()📝
js&css\web-accessible\init.jsyt-page-data-updatedyt-navigate-finishfor navigation🧪
test-large-playlist-fix.js(New)🔄 How It Works
🧪 Testing
Automated Test
Manual Testing
✅ Verification
📊 Impact
🎉 Result
Users can now autoplay through large playlists without interruption after track 400, resolving the long-standing issue reported in #3541.