fix: update Shaka Player to use attach() method (fixes #120)#134
Open
fix: update Shaka Player to use attach() method (fixes #120)#134
Conversation
… constructor pattern Fixes #120 Changes: - Remove video element from Player constructor (deprecated in v4.x) - Add shaka.polyfill.installAll() call in constructor - Update load() method to call attach() before loading source - Make load() method async to properly await attach() and load() This change prevents the deprecation warning: "Player w/ mediaElement has been deprecated and will be removed in v5.0" Following the migration guide from Shaka Player documentation: https://shaka-player-demo.appspot.com/docs/api/tutorial-basic-usage.html Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
alexbj75
pushed a commit
that referenced
this pull request
Feb 13, 2026
Updates outdated dependencies as requested in issue #31: ## Dependency Updates - **dash.js**: 4.5.1 → 5.1.1 (major update) - **mitt**: 3.0.0 → 3.0.1 (patch update) - **shaka-player**: 4.3.0 → 5.0.1 (major update, already compatible via PR #134) - **hls.js**: 1.6.15 (already at latest) ## Verification ✅ All tests pass (npm test) ✅ Build succeeds (npm run build) ✅ No breaking API changes detected ✅ All tech adapters remain compatible ## Breaking Change Analysis ### dash.js v5.x - No breaking changes in our DashJsTech.ts implementation - All APIs (MediaPlayer.create(), initialize(), destroy()) remain stable - Tested with DASH streams successfully ### shaka-player v5.x - Already compatible (PR #134 fixed deprecation warning) - Uses modern attach() API instead of deprecated constructor pattern ### mitt v3.0.1 - Fully backward compatible with v3.0.0 - Event emitter interface unchanged ## Impact - Resolves security vulnerabilities in older dependencies - Provides access to latest features and bug fixes - Maintains full backward compatibility with existing code - No migration required for applications using the player Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
$(cat <<'EOF'
Summary
Fixes #120 - Updates Shaka Player initialization to use the new
attach()method instead of the deprecated constructor pattern with mediaElement.Changes
new shaka.Player(this.video)tonew shaka.Player()await this.shakaPlayer.attach(this.video)before loading sourceshaka.polyfill.installAll()call in constructorload()method async to properly handle the attach operationProblem
The current implementation uses the deprecated pattern of passing a video element to the Player constructor, which causes this warning:
Solution
Following the Shaka Player migration guide, the player is now initialized without a media element and uses the
attach()method before loading content.Before:
After:
Testing
Compatibility
This change ensures compatibility with Shaka Player v5.0 when it's released while maintaining backward compatibility with v4.x.
🤖 Generated with Claude Code
EOF
)