Add minimal read-only timeline widget with playback playhead #5102
+269
−48
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.
issue: #5097
Problem:-
Music Blocks plays music correctly, but users cannot see when notes happen in time.
All notes appear only as stacked blocks, which makes it hard for beginners to understand rhythm, timing, and how notes line up during playback.
There is currently no visual timeline to help users connect what they hear with when it happens.
Solution:-
This PR introduces a minimal, read-only timeline widget that visually shows playback timing using a moving playhead.
The timeline does not change how music is played or how blocks work.
It only reads existing timing data and displays it visually.
What Was Added:-
-A new timeline widget built using a canvas
-A simple horizontal timeline with a moving playhead
-The playhead stays in sync with music playback
-The widget follows existing widget patterns used in Music Blocks
-This is a first, intentionally simple version:
->No note visualization yet
->No interaction
->No UI menu entry (opened via console for testing)
Why This Approach?
The goal is to introduce the concept of a timeline without affecting existing behavior.
Keeping it minimal makes the change easy to review and provides a solid base for future improvements.
Files Changed:-
->New: js/widgets/timeline.js
->New: js/widgets/TIMELINE_TESTING.md
->Updated: js/activity.js
->Updated: js/logo.js
Only minimal integration changes were made.
How to Test?
-Run Music Blocks locally
-Open the browser console
Run:-
globalActivity.logo.timeline = new Timeline();
globalActivity.logo.timeline.init(globalActivity);
-Press Play and observe the moving playhead
-Music playback should behave exactly as before.
What This Does Not Change?
-No playback logic
-No block behavior
-No UI layout
-No music engine code