cloudinary / cloudinary_js

Cloudinary JavaScript library
MIT License
328 stars 224 forks source link

How do we pass a `ref` to `Video />` component? #268

Closed ScottAgirs closed 3 years ago

ScottAgirs commented 3 years ago

Bug report for cloudinary-react Video />

Before proceeding, please update to latest version and test if the issue persists

Describe the bug in a sentence or two.

Struggling to find docs on and/or to get Video /> component working with React ref.

Issue Type (Can be multiple)

Steps to reproduce

... 
  const videoRef = useRef();
...
return (
  <Video
    ref={videoRef}
    cloudName="ijs-to"
    publicId={`ijs-vid-courses/${videoId}`}
  />
)

Error screenshots

When trying to access current video player reference, it looks like it's undefined

Screen Shot 2021-05-20 at 10 52 10 AM

And the ref instance itself console-logged:

Screen Shot 2021-05-20 at 10 53 49 AM

Perhaps I'm just missing a paragraph with instructions on how to use ref with Video />? 🤞🏼

Many thanks in advace!


Versions and Libraries (fill in the version numbers)

cloudinary-react: 1.7.0

ScottAgirs commented 3 years ago

Whooof, my apologies, not sure how I landed on cloudinary_js 😅 ~Will move to cloudinary-react~

PS. There was a mysterious glitch, innerRef works perfectly fine on Video /> , same was as on Image />.