plyr-react icon indicating copy to clipboard operation
plyr-react copied to clipboard

Event handlers not working at all

Open saidarshan27 opened this issue 2 years ago • 2 comments

Event hadnlers like onPlay, onClick, onPause not working at all. I tried to reproduce it in a codesandbox.

import "./styles.css";
import Plyr from "plyr-react";
import "plyr-react/plyr.css";

export default function App() {
  return (
    <Plyr
      type="youtube"
      videoId="umldliRDefQ"
      onPlay={() => console.log("playing")}
      onClick={() => {
        console.log("clicking");
      }}
    />
  );
}

Steps to reproduce the behavior:

  1. Go to (https://codesandbox.io/s/recursing-morning-b1mk1t?file=/src/App.js

Expected behavior I want a callback to be run onPlay, onPause, onSeek to attach custom handlers.

[https://stackoverflow.com/questions/76065265/plyr-react-event-callbacks-not-working-at-all](stackoverflow question)

saidarshan27 avatar Apr 20 '23 14:04 saidarshan27

Yes I confirm this issue exists, a few handlers work others don't

metacoding avatar Jul 01 '23 08:07 metacoding

Look at the listeners attribute under the options prop.

Docs: https://github.com/sampotts/plyr#options Available event handlers: https://github.com/sampotts/plyr/blob/a148e2e5b6eb4cda1d63a21397636a365f5dabbb/src/js/config/defaults.js#L214

sloreti avatar Jan 16 '25 23:01 sloreti