Skip to content

fix(web): notify subscribers when late fallbackDuration updates playback store - #2988

Merged
richiemcilroy merged 2 commits into
CapSoftware:mainfrom
ghazy2001:fix/playback-store-late-fallback-duration
Oct 23, 2026
Merged

richiemcilroy merged 2 commits into
CapSoftware:mainfrom
ghazy2001:fix/playback-store-late-fallback-duration

Conversation

@ghazy2001

@ghazy2001 ghazy2001 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2931 / #2932, addressing @richiemcilroy's feedback in #2975 regarding late fallbackDuration updates.

Problem

When PlaybackProvider is mounted with an initial fallback (e.g. 0 or null before recording metadata finishes loading), TimelineView subscribes via playback.subscribe(...) and initializes its duration state to playback.getDuration() (0).

When the async video metadata resolves and PlaybackProvider's useEffect invokes store.setFallbackDuration(next), the store previously updated fallback and duration internally without emitting an update to timeSubscribers. Consequently:

  • TimelineView was not notified of the new duration and remained in a zero-duration state ([0, 0]).
  • Seeking by clicking the timeline clamped to the old duration (0).

Fix

  • In playback-store.ts (setFallbackDuration), compare getDuration() before and after applying the normalized fallback duration.
  • If the observable total duration changed, trigger emitTime() to notify subscribers so TimelineView (and any other subscribers) can synchronize their duration state.
  • If getDuration() did not change (e.g. identical value or video element already has finite duration), remain silent.

Testing

Added two unit tests to apps/web/__tests__/unit/playback-store.test.ts:

  1. Verifies that subscribers receive notification when late fallbackDuration changes the store duration from 0 to 60.
  2. Verifies that no redundant notifications are emitted when fallbackDuration does not change the total duration (e.g. element already loaded with finite duration).
  • Verified with Biome linter and formatter.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

The PR notifies playback subscribers when a late fallback changes the duration returned by getDuration().

  • Late fallback changes now reach playback subscribers.

No actionable issues found. Tests were inspected, not run.

Reviews (1) · Last reviewed commit: "fix(web): notify subscribers when late f..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Oct 23, 2026 9:42pm UTC

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 23, 2026 14:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – cap-status October 23, 2026 21:42 Inactive
@richiemcilroy
richiemcilroy merged commit 2ee7846 into CapSoftware:main Oct 23, 2026
30 of 31 checks passed

This branch was previously deployed

1 inactive deployment
Preview – cap-status — fe48fb3d Deployed Oct 23, 2026 by vercel[bot]
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.

2 participants