Open Johannes5 opened 1 year ago
Hey @Johannes5
The speed
& volume
are attributes that options
props received, so you can store them in the state (or ref) conditionally and re-render your component with new speed. Is that solve your problem?
With the above code I wasn't able to set the speed.
So far I was only able to set the speed inside the useEffect() inside CustomPlyrInstance via
api.plyr.speed = 1.75
Because I want to change the speed via Hotkeys - and I'm using a useHotkeys hook - I need to access this plyr instance outside the useEffect Hook.
Which begs the question - why the useEffect hook in the first place? And - what can I do?
Plyr has setters and getters:
I would like to use shortcuts to change the playing speed. According to the above examples, with plyr this would be done with
player.speed = 1.8
But since I am using the forwarded ref from a custom plyr instance I've tried it like this:
I've gotten the error message that the left-hand side of the argument is invalid and realized that setting on a ref is pointless
So do I use plyrs setters in my situation?