how can I embeed dailymotion player in react

Viewed 29

I want to add dailymotion player in my react class based component but i find this error

first I have declare this variable

  componentDidMount = () => {
    console.log(
      "daily motion================================================================================================================================================================================"
    );
    this.setState({ test: true });
    const script = document.createElement("script");
    script.src ="https://geo.dailymotion.com/player";
    script.async = true;
    document.body.appendChild(script);
    this.playerLoad()

  };

  playerLoad = () => {
    console.log("daily motion player load ");
    this.player = window.dailymotion
      .createPlayer("my-dailymotion-player", {
        video: "x84sh87",
      })
      .then((player) => console.log(player))
      .catch((e) => console.error(e));
  };

0 Answers
Related