react-player icon indicating copy to clipboard operation
react-player copied to clipboard

[Feature Request] Callback on mounted video element.

Open stefanlazarevic opened this issue 2 years ago • 2 comments

I am using react-player to render FilePlayer and the native video element.

I need to perform some CSS style computation when the video is ready but call to ref.getInternalPlayer() returns null.

I managed to achieve desired behavior using a workaround where I am performing computation on onReady callback, but it would be very handful to have a dedicated callback executed once we have a video element in the DOM and we can access it with getInternalPlayer method.

My current workflow is following

  1. Attach reference to the player.
  2. Wait for onReady callback.
  3. Get internal video element const videoElement = reactPlayer.getInternalPlayer();
  4. Get video client rect. const rect = videoElement.getBoundingClientRect();
  5. perform computation...

stefanlazarevic avatar Aug 06 '21 12:08 stefanlazarevic

Curious what computation you are referring to is? I am trying to do something similar with getting the position of the mouse click with regards to the video player.

hackgoofer avatar Aug 12 '21 23:08 hackgoofer

I am calculating the parent element height since the video element is grouped with other building blocks.

stefanlazarevic avatar Aug 20 '21 08:08 stefanlazarevic