Skip to content

Proposal for plyr-react component update #678

Closed
@realamirhe

Description

By the latest version, we are using a fully integrated component using react-aptor as connector level connecting native video element to the plyr instance class. I was thinking about is there a way that we can get developers to access to being synced with the first render phase of our app.

Although there is a simple solution of getting onFirstRender and configuring that in the new hook, that is not so flexible.

The second idea is to pass the hole hook and make developers call it on their own. Imagine there is a hook that can usePlyr
which gets some arguments and returns a ref which must be bound to the video element and that's it.

const MyCustomPlyrComponent = () => {
 const ref = usePlyr(/* some arguments */)
 
 useEffect(loggerEffectOnFirstRender, [])
 
 return <video ref={ref} />
}

The package needs a tiny change for achieving this behavior and we can use the exact same mechanism for the default Plyr component.

export default Plyr
export const usePlyr
// export other needed things

Further info

The issue face has been reported here by @mnervik

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions