Skip to content

Fix/issue 3926 video player refactor#3938

Open
pradeep0153 wants to merge 4 commits into
Premshaw23:masterfrom
pradeep0153:fix/issue-3926-video-player-refactor
Open

Fix/issue 3926 video player refactor#3938
pradeep0153 wants to merge 4 commits into
Premshaw23:masterfrom
pradeep0153:fix/issue-3926-video-player-refactor

Conversation

@pradeep0153

Copy link
Copy Markdown
Contributor

Closes #3926.

Description

This PR resolves a massive technical debt issue by consolidating our highly complex, duplicated video streaming logic into a single, robust, and highly maintainable React component.

Changes Made

  • Conducted a codebase audit and discovered that the exact same 300+ lines of code responsible for initializing the video player (Video.js/Shaka Player), establishing HLS stream connections, and negotiating DRM (Widevine/PlayReady) tokens were copy-pasted across three separate areas: the main CourseView, the marketing PreviewModal, and the AssignmentVideo wrapper.
  • Extracted and abstracted this massive block of imperative logic into a clean, declarative <LearnovaPlayer /> component.
  • The new component exposes a simplified props interface (e.g., <LearnovaPlayer videoUrl={url} drmConfig={config} onCompletion={handleEnd} />), completely hiding the internal setup complexity from the parent consumers.
  • Refactored all three feature areas to consume this new unified component.

Impact

  • Maintainability & Bug Reduction: Copy-pasting complex configuration code is a recipe for disaster. Previously, if we needed to update a DRM token header or patch a specific browser's playback bug, developers had to manually track down and update three separate files, inevitably leading to regressions when one was forgotten. By centralizing the video player into a single source of truth, we ensure uniform playback behavior, synchronized analytics tracking, and drastically reduce the surface area for future bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code Quality: Extract video player and DRM logic into a reusable generic component

1 participant