feat(video): translated subtitles control on shared-video reader (v1.5)#1155
Open
mircealungu wants to merge 1 commit into
Open
feat(video): translated subtitles control on shared-video reader (v1.5)#1155mircealungu wants to merge 1 commit into
mircealungu wants to merge 1 commit into
Conversation
When the video the learner is watching has captions in a different language than what they're learning, the VideoPlayer now offers to translate the subtitles in-place. The interactive reader (tap-to-translate, bookmarks, time-synced highlight) keeps working because timings and the per-caption context_identifier are unchanged across the swap — only the rendered text and its tokenisation differ. - New TranslateCaptionsControl: encapsulates the offer banner, the translating-spinner state, the polling loop (~2 s), the error/retry branch, and a persistent Original/Translated pill switcher once a set is ready. Per-video preference is stored in localStorage and restored on next visit by calling the (idempotent) translate endpoint. - Three new Zeeguu_API methods on userVideos.js: - requestCaptionTranslation(videoId, lang, cefr, …) — _postJSON wrapper. - pollCaptionTranslationStatus(videoId, setId, …). - getVideoInfoWithCaptionSet(videoId, setId, …). - VideoPlayer integration: imports UserContext for learned_language/learned_cefr_level, renders the control above the player only when source and target languages differ, and on track change refetches videoInfo with the right caption_set_id while resetting lastCaptionIdRef so the currently displayed (stale-text) caption re-renders immediately instead of waiting for the next caption boundary. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for voluble-nougat-015dd1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
v1.5 of share-to-video (web side) — adds the in-place subtitle translation control to
VideoPlayer.js. When the video's caption language differs from the learner'slearned_language, the reader offers to translate captions to the learner's language at their CEFR level. The interactive reader (tap-to-translate, bookmarks, time-synced highlight) keeps working because timings and per-caption context_identifier are unchanged across the swap — only the rendered text and tokenisation differ.Pairs with zeeguu/api PR #647 which adds the
caption_translation_setmodel, the LLM service, thePOST/GET /video/<id>/translate_captionsendpoints, and the/user_video?caption_set_id=extension. Both are scoped so they can be reviewed and reverted independently of the in-flight v1 work (zeeguu/api#635).Changes
src/videos/TranslateCaptionsControl.js— encapsulates the offer banner, the translating-spinner state, the ~2 s polling loop, the error/retry branch, and a persistent Original/Translated pill switcher once a set is ready. Per-video preference is stored in localStorage and restored on next visit by calling the (idempotent) translate endpoint.src/api/userVideos.js— three newZeeguu_APImethods (requestCaptionTranslation,pollCaptionTranslationStatus,getVideoInfoWithCaptionSet).src/videos/VideoPlayer.js— importsUserContextforlearned_language/learned_cefr_level, renders the control above the player only when source and target languages differ, and on track change refetches videoInfo with the rightcaption_set_idwhile resettinglastCaptionIdRefso the currently displayed (stale-text) caption re-renders immediately rather than waiting for the next caption boundary.How to try locally
tools/migrations/26-05-31-a--add_caption_translation.sql), restart the api.npm run dev(or equivalent).Out of scope (captured for later)
TTS dubbing in the learner's language: see
docs/future-work/dubbed-audio-from-shared-video.md. Translated subtitles alone capture most of the UX win and avoid the derivative-work copyright question entirely.🤖 Generated with Claude Code