Interactive YouTube caption overlay with draggable captions.
GOOD NEWS!! Captions dragging is now a built-in feature on Youtube. This project will now be archived for references in the future
As of 9 Feb 2021 the position of captions on Youtube videos are fixed and can't be moved around. This project solves that.
This implementation is a browser-based prototype that overlays captions on top of a YouTube player in real time. The app loads caption XML for a selected video, synchronizes each caption line to the current playback time, and renders captions inside a movable caption panel.
This project is intentionally lightweight and framework-free, focused on clear JavaScript logic and API integration.
- HTML5
- CSS3
- JavaScript (vanilla)
- jQuery (AJAX)
- YouTube IFrame Player API
- Google timedtext caption endpoint
- The app initializes a YouTube player.
- caption XML is requested for the current video ID.
- caption nodes are parsed into a list of timed text items.
- While the video is playing, a timer checks current playback time.
- The matching caption line is rendered in the overlay.
-
In the project folder, start a local static server:
python3 -m http.server
-
Open the app at:
http://localhost:8000 -
Wait for the embedded player to load.
-
Click the search button and paste a YouTube URL.
-
Captions appear when caption data is available.
Notes:
- Use localhost (not file://) to avoid YouTube player identity issues.
- If you see Error 153, disable privacy/ad-block extensions for this page and retry.
- Stop the local server with Ctrl+C when done.
- Works only for videos that expose caption tracks for the requested language.