'React-Youtube npm video not playing

enter image description here

Youtube video not playing in browser, just showing video and getting blank screen while refreshing the page

import React from 'react';
import './App.css';
import YouTube from 'react-youtube';


function App() {

  const opts = {
    playerVars: {
      // https://developers.google.com/youtube/player_parameters
      autoplay: 1
    }
  };

  return (
    <div className="App">
      <YouTube
        videoId="2m1drlOZSDw"
        opts={opts}
      />
    </div>
  );
}

export default App;

EDIT: Network tab showing this error : Because a cookie’s SameSite attribute was not set or is invalid, it defaults to SameSite=Lax, which prevents the cookie from being set in a cross-site context. This behavior protects user data from accidentally leaking to third parties and cross-site request forgery



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source