Skip to content

Upgrade to react-player v3.3.3#5818

Merged
adhami3310 merged 3 commits intomainfrom
masenf/react-player-3
Sep 25, 2025
Merged

Upgrade to react-player v3.3.3#5818
adhami3310 merged 3 commits intomainfrom
masenf/react-player-3

Conversation

@masenf
Copy link
Copy Markdown
Collaborator

@masenf masenf commented Sep 24, 2025

This is a breaking change as many props and event handlers have changed name and signature. Some care has been taken to maintain a compatible API for Reflex users of rx.video.

The previous react-player wasn't playing recent youtube videos anymore.

This is a breaking change as many props and event handlers have changed name
and signature. Some care has been taken to maintain a compatible API for Reflex
users of `rx.video`.
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

Upgrades react-player from v2.16.0 to v3.3.3, introducing breaking changes to props and event handlers while maintaining backward compatibility through deprecated prop mapping.

Key changes:

  • Updated library version from react-player@2.16.0 to react-player@3.3.3
  • Renamed core prop url to src with support for string, array of strings, or array of objects
  • Added new config prop for player-specific configuration parameters
  • Refactored event handlers with new names: on_durationon_duration_change, on_seekon_seeked, on_bufferon_waiting, etc.
  • Implemented sophisticated event signature functions to extract data from the new react-player v3 event structure
  • Added deprecation warnings and automatic prop mapping to maintain backward compatibility for existing Reflex users
  • Enhanced Progress TypedDict with duration field

Confidence Score: 4/5

  • This PR is safe to merge with low risk due to good backward compatibility handling
  • Score reflects thorough handling of breaking changes with deprecation warnings and automatic prop mapping. The only issue is a minor typo that doesn't affect functionality.
  • Pay attention to react_player.py for the typo fix on line 190

Important Files Changed

File Analysis

Filename        Score        Overview
reflex/components/react_player/react_player.py 4/5 Major upgrade to react-player v3.3.3 with breaking changes handled via deprecation mapping and warning system - one minor typo found

Sequence Diagram

sequenceDiagram
    participant User as Reflex User
    participant RP as ReactPlayer Component
    participant Dep as Deprecation Handler
    participant RPLib as react-player@3.3.3
    participant Event as Event Handler

    User->>RP: Create component with props (url, on_duration, etc.)
    RP->>Dep: Check for deprecated props
    
    alt Deprecated prop found
        Dep-->>User: console.warn("prop deprecated")
        Dep->>RP: Map old prop to new prop (url->src, on_duration->on_duration_change)
    end
    
    RP->>RPLib: Initialize with updated props
    RPLib->>Event: Trigger media events (on_progress, on_time_update)
    Event->>RP: Extract event data via signature functions
    RP->>Event: Format data (Progress, float values)
    Event-->>User: Deliver formatted event data
Loading

2 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment thread reflex/components/react_player/react_player.py Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Sep 24, 2025

CodSpeed Performance Report

Merging #5818 will not alter performance

Comparing masenf/react-player-3 (6a1f83a) with main (a21414d)

Summary

✅ 8 untouched

@adhami3310
Copy link
Copy Markdown
Member

greptile caught a type 🤭

@adhami3310
Copy link
Copy Markdown
Member

react player no longer requires NoSSRComponent as far as i can see

Update comments describing props for typo/accuracy
@adhami3310 adhami3310 merged commit 80b6e71 into main Sep 25, 2025
40 of 41 checks passed
@adhami3310 adhami3310 deleted the masenf/react-player-3 branch September 25, 2025 17:24
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