expo-av (video): how to call the onReadyForDisplay function?

I am trying to apply the function of changing the orientation of the video when the display is changed, but when calling the function this is giving an error, do you have any documentation on how I call this function?

she is in the video documentation (Video - Expo Documentation)

{onReadyForDisplay

A function to be called when the video is ready for display. Note that this function gets called whenever the video’s natural size changes.

The function is passed a dictionary with the following key-value pairs:

  • naturalSize : a dictionary with the following key-value pairs:
    • width : a number describing the width in pixels of the video data
    • height : a number describing the height in pixels of the video data
    • orientation : a string describing the natural orientation of the video data, either 'portrait' or 'landscape'}

Hey @igor_oliveira, when creating a post like this it’s important to share as much relevant and actionable information as possible. For instance, here it would be necessary to know what the error explicitly states, how you are implementing the code as well as what platform you are testing on.

Just to be certain, are you trying to call this as a separate function? If so, this is to be used as a prop so it would be like so:

<Video onReadyForDisplay={() => {}} />

Cheers,
Adam

1 Like

Sorry!
This is the way I was trying to use the function and the dependencies:


I probably applied it wrong

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.