Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vidstack Player: Errors with Self-Hosted Video Playback on Page Navigation Using React Router #1549

Open
rajatgautam755421 opened this issue Jan 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@rajatgautam755421
Copy link

We are encountering issues with the Vidstack player in our WordPress plugin when handling self-hosted videos in a React application using react-router-dom.

Steps to Reproduce:
Upload a self-hosted video as an admin in the WordPress plugin.
As a student, navigate to the page containing the self-hosted video.
Observe that the video plays correctly initially.
Use react-router-dom to navigate to a different page.
Return to the page with the self-hosted video.
Observed Behavior:
When navigating back to the page with the video, the following errors are shown:

vidstack-D2YCgfrz.js:373 Uncaught TypeError: video.canPlayType is not a function
vidstack-D2YCgfrz.js:4776 Uncaught TypeError: this._media.load is not a function
Expected Behavior:
The self-hosted video should play correctly when navigating back to the page without needing a full page refresh.

Temporary Workaround:
Refreshing the page resolves the issue, and the video plays without errors.

Additional Notes:
This issue only occurs with self-hosted videos. Other sources like Vimeo, BunnyNet, and YouTube are not affected.
The issue seems related to how Vidstack player initializes or handles unmounting/mounting when navigating between routes.
Please investigate this issue and provide a fix or guidance on handling Vidstack player lifecycle when using react-router-dom.

Screenshot 2025-01-02 095034

@rajatgautam755421 rajatgautam755421 added the bug Something isn't working label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant