Skip to content

Conversation

@ibrahimcesar
Copy link
Owner

Fixes onPlaybackRateChange and onPlaybackQualityChange events by handling additional properties in YouTube's infoDelivery postMessage events.

What Changed

Core Implementation (src/lib/index.tsx)

  • Added handlers for playbackRate and playbackQuality in infoDelivery event
  • YouTube sends these properties via the same infoDelivery events as state changes
  • Events now fire when user changes speed or quality via ⚙️ settings button

Documentation (README.md)

  • Updated Event Compatibility Status table - both events now ✅ Verified Working
  • Added testing instructions for ⚙️ settings button usage
  • Enhanced Advanced Events section with practical examples
  • Added new "Event Status Tracker Demo" section
  • Updated Quick Start example to showcase new events
  • Updated Core Features section to highlight all events verified

Demo Updates (demo/pages/index.js)

  • Event Status Tracker now properly marks playback rate/quality as fired
  • Added testing instructions in UI
  • Enhanced event handler logging

Technical Details

YouTube's iframe postMessage API sends multiple event types via infoDelivery:

  • info.playerState - player state changes (already handled)
  • info.playbackRate - playback speed changes (NEW)
  • info.playbackQuality - video quality changes (NEW)

The infoDelivery handler now checks for all three properties and calls the appropriate callback handlers.

Testing

  1. Play video in Events demo
  2. Click ⚙️ settings button in YouTube player
  3. Change "Playback speed" → onPlaybackRateChange fires
  4. Change "Quality" → onPlaybackQualityChange fires
  5. Event Status Tracker shows ✅ for both events

Event Status

All core events now fully tested and verified:
✅ onIframeAdded
✅ onReady
✅ onStateChange
✅ onPlay
✅ onPause
✅ onEnd
✅ onBuffering
✅ onPlaybackRateChange (NEW - now working)
✅ onPlaybackQualityChange (NEW - now working)
⚠️ onError (untested - requires invalid video)

🤖 Generated with Claude Code

Fixes onPlaybackRateChange and onPlaybackQualityChange events by handling
additional properties in YouTube's infoDelivery postMessage events.

## What Changed

### Core Implementation (src/lib/index.tsx)
- Added handlers for `playbackRate` and `playbackQuality` in infoDelivery event
- YouTube sends these properties via the same infoDelivery events as state changes
- Events now fire when user changes speed or quality via ⚙️ settings button

### Documentation (README.md)
- Updated Event Compatibility Status table - both events now ✅ Verified Working
- Added testing instructions for ⚙️ settings button usage
- Enhanced Advanced Events section with practical examples
- Added new "Event Status Tracker Demo" section
- Updated Quick Start example to showcase new events
- Updated Core Features section to highlight all events verified

### Demo Updates (demo/pages/index.js)
- Event Status Tracker now properly marks playback rate/quality as fired
- Added testing instructions in UI
- Enhanced event handler logging

## Technical Details

YouTube's iframe postMessage API sends multiple event types via `infoDelivery`:
- `info.playerState` - player state changes (already handled)
- `info.playbackRate` - playback speed changes (NEW)
- `info.playbackQuality` - video quality changes (NEW)

The infoDelivery handler now checks for all three properties and calls the
appropriate callback handlers.

## Testing

1. Play video in Events demo
2. Click ⚙️ settings button in YouTube player
3. Change "Playback speed" → onPlaybackRateChange fires
4. Change "Quality" → onPlaybackQualityChange fires
5. Event Status Tracker shows ✅ for both events

## Event Status

All core events now fully tested and verified:
✅ onIframeAdded
✅ onReady
✅ onStateChange
✅ onPlay
✅ onPause
✅ onEnd
✅ onBuffering
✅ onPlaybackRateChange (NEW - now working)
✅ onPlaybackQualityChange (NEW - now working)
⚠️ onError (untested - requires invalid video)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 15, 2025

size-limit report 📦

Path Size
ES Module 3.05 KB (0%)
CommonJS 3.02 KB (0%)
CSS 1.05 KB (0%)

ibrahimcesar pushed a commit that referenced this pull request Nov 15, 2025
Fixes code style issues in src/lib/index.tsx that were causing the
format:check CI step to fail on PR #213 (feat/playback-rate-quality-events).

This commit applies Prettier formatting rules to ensure consistent code
style across the codebase.
ibrahimcesar added a commit that referenced this pull request Nov 15, 2025
* feat: implement playback rate and quality change events

Fixes onPlaybackRateChange and onPlaybackQualityChange events by handling
additional properties in YouTube's infoDelivery postMessage events.

## What Changed

### Core Implementation (src/lib/index.tsx)
- Added handlers for `playbackRate` and `playbackQuality` in infoDelivery event
- YouTube sends these properties via the same infoDelivery events as state changes
- Events now fire when user changes speed or quality via ⚙️ settings button

### Documentation (README.md)
- Updated Event Compatibility Status table - both events now ✅ Verified Working
- Added testing instructions for ⚙️ settings button usage
- Enhanced Advanced Events section with practical examples
- Added new "Event Status Tracker Demo" section
- Updated Quick Start example to showcase new events
- Updated Core Features section to highlight all events verified

### Demo Updates (demo/pages/index.js)
- Event Status Tracker now properly marks playback rate/quality as fired
- Added testing instructions in UI
- Enhanced event handler logging

## Technical Details

YouTube's iframe postMessage API sends multiple event types via `infoDelivery`:
- `info.playerState` - player state changes (already handled)
- `info.playbackRate` - playback speed changes (NEW)
- `info.playbackQuality` - video quality changes (NEW)

The infoDelivery handler now checks for all three properties and calls the
appropriate callback handlers.

## Testing

1. Play video in Events demo
2. Click ⚙️ settings button in YouTube player
3. Change "Playback speed" → onPlaybackRateChange fires
4. Change "Quality" → onPlaybackQualityChange fires
5. Event Status Tracker shows ✅ for both events

## Event Status

All core events now fully tested and verified:
✅ onIframeAdded
✅ onReady
✅ onStateChange
✅ onPlay
✅ onPause
✅ onEnd
✅ onBuffering
✅ onPlaybackRateChange (NEW - now working)
✅ onPlaybackQualityChange (NEW - now working)
⚠️ onError (untested - requires invalid video)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Apply Prettier formatting to resolve PR #213 CI failure

Fixes code style issues in src/lib/index.tsx that were causing the
format:check CI step to fail on PR #213 (feat/playback-rate-quality-events).

This commit applies Prettier formatting rules to ensure consistent code
style across the codebase.

---------

Co-authored-by: Ibrahim Cesar Nogueira Bevilacqua <[email protected]>
Co-authored-by: Claude <[email protected]>
ibrahimcesar pushed a commit that referenced this pull request Nov 15, 2025
Merged PR #213 which implements playback rate and quality change events.

Conflict resolution:
- src/lib/index.tsx: Resolved formatting conflict in iframe parameters
  - Kept double quotes for string literals (consistent with codebase style)
  - Kept multi-line formatting for better readability
  - Preserved origin parameter logic from both branches

All 51 tests passing ✅
@ibrahimcesar ibrahimcesar merged commit 6e23e28 into main Nov 15, 2025
5 of 7 checks passed
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.

2 participants