Skip to content

fix: FIT-31: Ensure media buffers are syncable events that keep audio and video in sync #7633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from

Conversation

bmartel
Copy link
Contributor

@bmartel bmartel commented May 27, 2025

Previously we were not syncing when a media source would buffer, which led to out of sync audio and video in many cases, especially in spotty network conditions or with very large file sizes. This addresses that issue by syncing buffering state events into SyncManager, and handling the state in the particular cases Audio, Video, Paragraphs. Also updated and aligned the buffering visuals by moving that into the TimelineControls.

This video showcases a ~300MB video throttled to 3G then seeked and played, and later unthrottled to simulate what was previously causing media sources to go out of sync with one another:

Kapture.2025-05-28.at.08.47.55.webm

Feature Flag:

  • Added a new feature flag FF_SYNCED_BUFFERING to enable synchronized media buffering across components. (web/libs/core/src/lib/utils/feature-flags/flags.ts)

UI Updates:

  • Introduced a visual buffering indicator in the Timeline component's controls, including new SCSS styles and animations. (web/libs/editor/src/components/Timeline/Controls.scss) [1] [2]
  • Updated the VideoCanvas component to conditionally display a buffering indicator based on the buffering state. (web/libs/editor/src/components/VideoCanvas/VideoCanvas.scss, web/libs/editor/src/components/VideoCanvas/VideoCanvas.tsx) [1] [2]

Synchronized Buffering Logic:

  • Added a useSyncedBuffering hook to manage synchronized buffering states across components using Jotai atoms. (web/libs/editor/src/hooks/useSyncedBuffering.ts)
  • Updated the VideoCanvas and Html5Player components to utilize the synchronized buffering logic, including debounced state updates and conditional behavior based on the feature flag. (web/libs/editor/src/components/VideoCanvas/VideoCanvas.tsx, web/libs/editor/src/lib/AudioUltra/Controls/Html5Player.ts) [1] [2]

Playback Logic Enhancements:

  • Modified the Player class to include a buffering property and handle buffering events (canplay and waiting) with debounced updates. (web/libs/editor/src/lib/AudioUltra/Controls/Player.ts) [1] [2]
  • Adjusted the Timeline and VideoCanvas components to propagate buffering states through their props and interfaces. (web/libs/editor/src/components/Timeline/Types.ts, web/libs/editor/src/components/Timeline/Timeline.tsx) [1] [2]

These changes collectively improve the user experience by providing better visual feedback during buffering and ensuring consistent playback behavior across components.

@bmartel bmartel requested review from a team, hlomzik, Gondragos and nick-skriabin as code owners May 27, 2025 15:18
Copy link

netlify bot commented May 27, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 174a8c4
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/683a26d11924f40008080f1e

Copy link

netlify bot commented May 27, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 174a8c4
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/683a26d146779b0008519506
😎 Deploy Preview https://deploy-preview-7633--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the fix label May 27, 2025
Copy link

netlify bot commented May 27, 2025

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 174a8c4
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/683a26d15332c900083c2ecc
😎 Deploy Preview https://deploy-preview-7633--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

netlify bot commented May 27, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 174a8c4
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/683a26d13845bb00085fb6c5

@bmartel
Copy link
Contributor Author

bmartel commented May 28, 2025

/fm sync

Workflow run

@bmartel bmartel changed the title fix: FIT-31: Ensure media buffers are syncable events that keep audio… … and video in sync fix: FIT-31: Ensure media buffers are syncable events that keep audio and video in sync May 29, 2025
@bmartel bmartel requested a review from hlomzik May 30, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants