You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plyr instance is not available in (passed) ref #1122
Describe the bug
In development mode I see this error (70% of the time when page gets reloaded), following is the first line . plyr.min.js:1 Uncaught TypeError: Cannot read properties of null (reading 'getAttribute')
but this is not a problem when project is built
THE PROBLEM is:
In the (passed) ref there's no plyr instance. Getting following Using like this (from docs)
same issue, I've fixed temporary by pre-loading the player
How to do that? preload the plyr js file?
I my case something like this fixed the issue this example is what I mean by preloading the player
'use client'importPlyr,{APITypes,PlyrOptions,PlyrSource}from"plyr-react";constMainComponent(){const[haveSource,setHaveSource]=useState(false);// When eveer the source was ready then make (haveSource) trueuseEffect(()=>{// make source ready .....setHaveSource(true)},[])return<div>
// if we didn't have any source then we will hide the play, (not unmounting it but hide it)
<divstyle={{!haveSource ? {position: "absolute",top: "-100%",left: "-100%"opacity: 0} :{}}}><Plyrref={playerRef}source={videoSource}options={playerOptions}/></div></div>}
Activity
SarkarKurdish commentedon Nov 27, 2023
same issue, I've fixed temporary by pre-loading the player
apudiu commentedon Nov 28, 2023
How to do that? preload the plyr js file?
SarkarKurdish commentedon Nov 28, 2023
I my case something like this fixed the issue this example is what I mean by preloading the player