Skip to content

Autoplay stays in the series; the next episode's player takes the keyboard - #449

Merged
Nawid3333 merged 6 commits into
mainfrom
fix/autoplay-same-series
Oct 11, 2026
Merged

Nawid3333 merged 6 commits into
mainfrom
fix/autoplay-same-series

Conversation

@Nawid3333

Copy link
Copy Markdown
Owner

His reports of 2026-10-11:

1. aniworld.cc: after season 3's last episode, autoplay went on to another series.

The next-episode search now stays in the series wherever the page's address names one (EpisodeLinks.seriesOf). That is the path before the first season or episode segment, e.g. /anime/stream/<series>/. A link counts as the series only if its own series part is the same. Sequels such as one-piece-2/… or one-piece-film-red don't count.

  • After a season's last episode, autoplay goes on to the next season's first episode, when the page lists the season and links the next one. If the page links the next season's episodes, it takes the lowest one, which covers sites that number on across seasons.
  • A gap in the season (a removed episode) is followed past, not taken as the season's end.
  • The very next episode's link is followed in this tab even with target="_blank".
  • On a series page whose links show the whole season, a "next episode" button (which could lead anywhere) is not pressed.
  • After the series' last episode autoplay stops and says why:
    • in the player: "Last episode of the series: autoplay stopped";
    • in mpv: "Next video: the last episode of the series: autoplay stops".
  • A page FastStream can't read says so instead, and only that case goes to the problem list.
  • In MPV mode, the series end also stops the search before any hoster frame is asked (a hoster's links lead to other videos).

Replayed on the real aniworld pages (their live DOM, test Firefox):

  • S3E12 stops;
  • S3E11 → S3E12;
  • S2E12 → S3E1;
  • "previous" from S3E12 → S3E11 (1.3.82.86 took the "Staffel 3" link there).

2. After autoplay, F (and Space) did nothing until a click in the player.

The page had the keyboard. The player now takes it when FastStream went on to it by itself, and only then. Measured in Firefox:

  • before: the page had the keyboard and F did nothing;
  • now: the player has it and F goes fullscreen without a click.

That holds for the video in the page and in a hoster frame of another origin. WebDriver can't send a key two frames deep; a key sent inside the player goes fullscreen through both frames.

Texts are in all 16 languages (gemma4 drafts, checked by glm; Polish corrected).

Reviews: deepseek, kimi and glm each reviewed the change, and every finding was checked against the code. The real ones are fixed in the third commit, each with a test that fails without it. The false ones are listed in the conversation.

Tests:

  • lint, typecheck, unit 2,378 passed.
  • The new tests fail on the code before the fix (mutation-checked).
  • e2e autoplay-next-episode in real Firefox 4/4, including:
    • a two-episode series: it stops after the last episode, says so, and the tab stays on the series;
    • F after autoplay: fullscreen without a click.

🤖 Generated with Claude Code

Nawid3333 and others added 6 commits October 11, 2026 21:04
His report (2026-10-11, aniworld.cc): after season 3's last episode,
autoplay went on to another series. The next-episode search now keeps
to the series where the page's address names one (EpisodeLinks.seriesOf:
the path before its first season or episode segment, e.g.
/anime/stream/<series>/): a link of another series is never the next
episode, in any of the search's steps.

After a season's last episode it goes on to the next season's first
(.../staffel-4/episode-1) when the page links that season and lists this
one's episodes. After the series' last episode it stops and says so:
the player ("Last episode of the series: autoplay stopped") and mpv
("the last episode of the series: autoplay stops"); a page FastStream
cannot read says that instead, and only that is noted as a problem.
In MPV mode the series' end also stops the search before any hoster
frame (whose links are other videos) is asked.

Replayed on the real aniworld pages (their live DOM): S3E12 stops, S3E11
goes to S3E12, S2E12 goes to S3E1, previous from S3E12 goes to S3E11
(1.3.82.86 took the "Staffel 3" link there).

Texts in all 16 languages (gemma4 drafts, glm check: Polish fixed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
His report (2026-10-11): after autoplay went on to the next episode, F
(and Space, the arrows) did nothing until a click in the player: the
page had the keyboard. The player now takes it when FastStream went on
to it by itself (a continuation's autoPlay), and only then: a player
that opens while the user types in the page leaves the keyboard there.

Measured in Firefox: before, the page had the keyboard and F did
nothing; now the player has it and F goes fullscreen with no click,
the video in the page or in a hoster's frame of another origin (where
WebDriver cannot send a key two frames deep; the key sent in the player
goes fullscreen through both frames).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deepseek, kimi and glm on the series check (each checked against the
code, each with a test that fails without the fix):
- The very next episode's link into a new tab is followed, in this tab:
  missed, autoplay went on to the next season past the rest of this one,
  or stopped as at the series' end.
- One series is a link's own series (seriesOf equal), not a prefix: a
  sequel that starts the same (one-piece-2/..., one-piece-film-red) is
  another series.
- A segment with the season and the episode (staffel-3-episode-12,
  my-show-season-2-episode-5) names its series, and goes on to its next
  season.
- A gap in a season (episode 13 removed, 14 there) goes on to 14, not to
  the next season; it is no series' end either.
- A site that numbers on across seasons: the next season's lowest linked
  episode, not an invented episode-1.
- On a series page that its links tell all of, a "next episode" button
  (which may lead anywhere) is not pressed.

The real aniworld pages still give: S3E12 stops, S3E11 -> S3E12,
S2E12 -> S3E1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deepseek, kimi and glm on the follow-ups (each checked against the code,
each with a test that fails without the fix):
- The next episode's player takes the keyboard only when the page says
  nobody types there and the tab is in sight (content.js PAGE_TYPING,
  asked by the background for the player: REQUEST_KEYBOARD). All three
  reviews: window.focus() took it from a field the user typed in.
- S03E12 and 3x12 addresses: a gap and the next season (S04E01, 4x01).
- A season's first episode lists its season by its other episodes (it
  has no previous one): no "next episode" button pressed there either.
- A series that is a folder keeps its other parts (.../girls/ova/...);
  a sequel's folder (.../girls-2/) stays another series.
- The next season: its episode 1 where linked, its episode this one +1
  where the site numbers on, else episode 1 - not a "continue watching"
  episode 5 the page links.

content-cleanup e2e (red on CI): the poll answers seriesEnd too, and the
very next episode's address in a link into a new tab is now followed in
this tab (/nt/episode-7); a "next episode" into a new tab to anywhere
else still is not (/nt/teaser).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deepseek's third round: since the last commit, one link to another
episode of the season ("latest episode: 5") made the page count as one
that lists its season, and a page with no list then had its "next
episode" button ignored (a jump to 5, or a stop). A list is the previous
episode's link, or two other episodes of the season.

(kimi's and glm's third rounds found the poll's seriesEnd and the
new-tab rule missing: both are in the commits before, which their diff
did not show; the e2e passes with them.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On CI's Linux runner two of them ran into the 120 s test timeout with no
word of where (run 38169602991; locally they take 7-11 s, and the commit
before was green there): each step now logs the seconds since the test
began, so the next such failure says which step hangs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Nawid3333
Nawid3333 merged commit 811eb2a into main Oct 11, 2026
25 checks passed
@Nawid3333
Nawid3333 deleted the fix/autoplay-same-series branch October 11, 2026 20:11
Nawid3333 added a commit that referenced this pull request Oct 11, 2026
* e2e: every test ends at the top of its window

On CI's Linux runner, autoplay-next-episode's tests hung until mocha's
120 s timeout (main after #450, #449's runs; 2026-10-11). The step logs
show where: each hang came in a test's first browser.url(), before its
first step, and each in a test after one that ended switched into the
player's frame (not every such test hung: a race in the driver). The
navigation replaces the page, and the frame the driver waited in goes
with it.

A mocha root hook now switches to the window's top after every test,
in every suite (framed-player.e2e.mjs did it on its own). A window or
session already gone is expected; any other failure of the reset is
logged, so a reset that stops working shows. Reviewed by deepseek, kimi
and glm (the diagnosis; the logging and the wording are their findings).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* firefox-vpn e2e: the second test enters the player itself

With the root hook, a test no longer starts in the frame the one before
ended in. firefox-vpn's second test clicked the player's VPN button
without switching into the player, relying on the first test to leave
it there - on #451's CI it ran in the page (no button, no
chrome.permissions there), and the third test failed after it (no
permission given). It now enters the player first; its page is the
first test's, nothing navigates. Locally 3/3; deepseek, kimi and glm:
nothing real.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant