-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React control? #9
Comments
import React, { useEffect, useState } from "react";
import WFPlayer from "wfplayer";
export default () => {
const [waveform, setWaveform] = useState(null);
const $waveform = React.createRef();
const $video = React.createRef();
useEffect(() => {
const waveform = new WFPlayer({
container: $waveform.current,
mediaElement: $video.current,
});
setWaveform(waveform);
}, []);
return (
<div>
<video src="test.mp4" ref={$video} />
<div ref={$waveform} />
</div>
);
}; |
Lol - thanks :). This would clean up much of what I had done. Although...
|
If your file path is dynamic, it is recommended to destroy the waveform and re instantiate it every time the path changes |
Thanks - that helps...although...I'm new to React...not sure how I would do that, right? Because React controls the lifecycle of the included component you created above that I would be including into my page? |
Hi - I want to use this in a react project - have you considered making a react wrapper? Right now I'm hacking it in using Refs but it's messy and buggy.
The text was updated successfully, but these errors were encountered: