Skip to content

Conversation

ArjunCodess
Copy link

fixes #572.

Description

Fixed CldVideoPlayer not streaming after route change in Next.js 15 App Router by implementing proper player lifecycle management and state synchronisation.

Key Changes:

  • Added state management for script loading and player initialisation tracking
  • Implemented robust player disposal that properly cleans up the global state
  • Added defensive initialisation logic with precondition checks
  • Enhanced route change handling with proper cleanup and reinitialization
  • Removed problematic duplicate instance checking that interfered with route changes

This fix ensures the video player properly reinitialises when users navigate back to pages containing the player, resolving the streaming issues after route changes in Next.js 15 App Router.

Issue Ticket Number

Fixes #572

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Fix or improve the documentation
  • This change requires a documentation update

Checklist

  • I have followed the contributing guidelines of this project as mentioned in CONTRIBUTING.md
  • I have created an issue ticket for this PR
  • I have checked to ensure there aren't other open Pull Requests for the same update/change?
  • I have performed a self-review of my own code
  • I have run tests locally to ensure they all pass
  • I have commented my code, particularly in hard-to-understand areas
  • I have made the corresponding changes needed to the documentation

…logic

- Introduce state management for script loading and player initialization
- Refactor player disposal logic to prevent conflicts with multiple instances
- Enhance useEffect hooks to manage player lifecycle more effectively
- Remove redundant checks for multiple video instances
Copy link

vercel bot commented Oct 2, 2025

@ArjunCodess is attempting to deploy a commit to the Cloudinary DevX Team on Vercel.

A member of the Team first needs to authorize it.

@ArjunCodess ArjunCodess changed the title CldVideoPlayer Route Change Fix #572 fix: resolve CldVideoPlayer route change issue #572 Oct 2, 2025
@ArjunCodess
Copy link
Author

@eportis-cloudinary just a follow-up.

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

Successfully merging this pull request may close these issues.

[Bug] CldVideoPlayer not streaming after route change (Next.js 15 App Router)
2 participants