-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: OPTIC-2125: Add sync between TimeSeries, Video, Audio #7376
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
Conversation
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-storybook canceled.
|
… components Fixes #4892: How can we label video and time series signals while watching them together? Fixes HumanSignal#5359: Video/audio sync doesn't work - Add sync attribute to TimeSeries tag model to enable group-based synchronization - Compose TimeSeries with SyncableMixin for event broadcasting and handling - Implement sync event handlers for seek, play, and pause events - Add smooth view updates during audio/video playback - Prevent event flooding by suppressing sync events during playback - Maintain view window size during playback - Map media timeline to TimeSeries range (start/end points) This enables synchronized playback and seeking between Video, Audio, and TimeSeries components when they share the same sync group. Multiple TimeSeries components can also sync with each other, allowing for coordinated view updates across different time series data. For example: ``` <View> <Video name="video" value="$video" sync="group_a"/> <AudioPlus name="audio" value="$audio" sync="group_a"/> <TimeSeries name="accel_timeseries" value="$accel_data" sync="group_a"> <Channel column="accel_x" strokeColor="#FF0000"/> <Channel column="accel_y" strokeColor="#00FF00"/> </TimeSeries> <TimeSeries name="gyro_timeseries" value="$gyro_data" sync="group_a"> <Channel column="gyro_x" strokeColor="#0000FF"/> <Channel column="gyro_y" strokeColor="#FF00FF"/> </TimeSeries> </View> ```
Add feature flag controlled synchronization between TimeSeries and other media components (audio/video). This allows the TimeSeries component to: - Sync seek operations with other media components - Sync play/pause states - Handle playback speed synchronization - Enable click-to-seek functionality that syncs with other components The feature is controlled by the FF_TIMESERIES_SYNC feature flag, allowing for gradual rollout and testing. This change improves the user experience by enabling coordinated playback and seeking across different media types in the labeling interface.
This commit refactors the time synchronization mechanisms for TimeSeries and Video components to ensure consistent and accurate behavior. The primary goal is to standardize how time is communicated and interpreted during sync events (play, pause, seek). Key changes include: 1. **Standardized Sync Time Unit:** * Sync messages involving time between these components now aim for clarity, with a focus on components sending and expecting time values that can be consistently interpreted. (The ideal is relative seconds, with components converting locally). 2. **TimeSeries Synchronization (`TimeSeries.jsx`):** * **Relative vs. Absolute Time Handling:** `_handleSeek`, `_handlePlay`, and `_handlePause` methods now correctly convert incoming `data.time` (expected as relative seconds) into the TimeSeries' native units. This depends on the `isDate` flag: * If `isDate` is true (using `timeColumn` and `timeFormat`), relative seconds are converted to an absolute epoch millisecond value. * If `isDate` is false (autogenerated indices), the relative second value is used as the target index. * **Outgoing Sync Conversion:** `emitSeekSync` (on scroll/zoom) and `handleMainAreaClick` (on click-to-seek) now convert the TimeSeries' native time (epoch ms or index) into relative seconds before sending the sync message. * **Stability & Echo Prevention:** * Added `isAlive` checks to `_handleSeek`, `_handlePlay`, and `_handlePause` to prevent errors if the model instance is no longer part of the state tree during async operations. * These sync handlers now also check `if (data.initiator === self.name)` and ignore events initiated by the TimeSeries instance itself, preventing processing loops. 3. **Video Synchronization (`Video.js`):** * **Echo Prevention:** Implemented an `isProcessingIncomingSync` flag. This flag is set when `handleSync` is processing an event. The `handleSeek` method (triggered by native video events) now checks this flag and will not propagate a new `triggerSync("seek")` if the seek was a direct result of an incoming sync message. * **Initiator Tracking:** * The `triggerSync` method now consistently adds `initiator: self.name` to all outgoing sync payloads. * `handleSync` and `handleSyncSpeed` now check `if (data.initiator === self.name)` and ignore messages that the Video component itself originated. These changes improve the robustness and predictability of synchronization when TimeSeries and Video components interact, ensuring time values are handled more consistently.
f0df35a
to
0e23911
Compare
/git merge
|
✅ Deploy Preview for label-studio-playground canceled.
|
This is awesome job, @cloudmark! I tried it and was impressed, that's exactly why SyncableMixin was introduced, to allow improvements like this!
Besides this it's awesome! Looking forward for answers, thank you! |
Also we have to document how does it sync with Audio and Video. I can write a doc, but I need a guidance. As I understand time from media works as relative delta for TimeSeries if it's time based, right? Questions:
|
I did the |
The text was moved to the first PR message |
…cing lines of code and optimizing performance.
Tests are successful, they were not triggered, meaning that SyncableMixin catches all cases we checked.
SyncableMixin should block such echo events on its own.
SyncableMixin should block events fired back to origin.
/git merge
|
TimeSeries Synchronization
timeseries.mp4
Overview
TimeSeries can synchronize with Audio and Video components, allowing coordinated playback and seeking across different media types.
Time Units
Configuration
Time-based TimeSeries:
Index-based TimeSeries:
Synchronization Behavior
Time-based TimeSeries:
Index-based TimeSeries:
Length Mismatches
Best Practices
Use time-based TimeSeries when:
Use index-based TimeSeries when:
Configurations
Index based TimeSeries + Video + TimeSeriesLabels
Time-based multiple TimeSeries + Audio + Video + TimeSeriesLabels
Example for time-series-accel.csv for accel_x, accel_y
Example for time-series-gyro.csv for gyro_x, gyro_y
Advanced Information
Fixes #4892: How can we label video and time series signals while watching them together?
Fixes #5359: Video/audio sync doesn't work
This enables synchronized playback and seeking between Video, Audio, and TimeSeries components when they share the same sync group. Multiple TimeSeries components can also sync with each other, allowing for coordinated view updates across different time series data. For example:
Feature flag