Skip to content

fix: update Shaka Player to use attach() method (fixes #120)#134

Open
alexbj75 wants to merge 1 commit intomasterfrom
fix/issue-120-shaka-player-deprecation
Open

fix: update Shaka Player to use attach() method (fixes #120)#134
alexbj75 wants to merge 1 commit intomasterfrom
fix/issue-120-shaka-player-deprecation

Conversation

@alexbj75
Copy link
Contributor

$(cat <<'EOF'

Summary

Fixes #120 - Updates Shaka Player initialization to use the new attach() method instead of the deprecated constructor pattern with mediaElement.

Changes

  • Constructor: Changed new shaka.Player(this.video) to new shaka.Player()
  • Load Method: Added await this.shakaPlayer.attach(this.video) before loading source
  • Added: shaka.polyfill.installAll() call in constructor
  • Updated: Made load() method async to properly handle the attach operation

Problem

The current implementation uses the deprecated pattern of passing a video element to the Player constructor, which causes this warning:

Player w/ mediaElement has been deprecated and will be removed in v5.0.
We are currently at version v4.9.
Additional information: Please migrate from initializing Player with a mediaElement; use the attach method instead.

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:

this.shakaPlayer = new shaka.Player(this.video);

After:

this.shakaPlayer = new shaka.Player();
// ... later in load()
await this.shakaPlayer.attach(this.video);

Testing

  • ✅ All unit tests pass
  • ✅ Build succeeds for all packages
  • ✅ No regressions in test coverage

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
)

… 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>
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.

Update shaka-code to avoid depricated Player w/ mediaElement

1 participant