我正在使用反应功能组件和 plyr-react 版本 3.2.1。
得到错误ref.current.plyr.on 不是函数
在 3.1.0 及以下版本中它工作正常
Stackblitz 链接 - https://stackblitz.com/edit/react-vv9haf
代码
const PlayerView = () => {
const ref = useRef();
useEffect(() => {
ref.current.plyr.on("ended", (event) => {
console.log("ended-event");
})
}, [])
return (
<Plyr
id="player"
options={{ ...options, controls }}
source={src}
ref={ref}
/>
);