Skip to content
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

The properties are not working #1138

Open
WebDev-Farhan opened this issue Mar 20, 2024 · 0 comments
Open

The properties are not working #1138

WebDev-Farhan opened this issue Mar 20, 2024 · 0 comments

Comments

@WebDev-Farhan
Copy link

Why my right click is not disabled according to the doc? Also, I don't see the pip option in player controls or the quality option in the settings
my code:

import PlyrComponent from "plyr-react";
import "plyr-react/plyr.css"; // Import your custom CSS file for styling

const VideoPlayer = ({ videoUrl }) => {
  // Regular expression to extract video ID from YouTube URL
  const regex =
    /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/;

  // Extract video ID from the URL
  const match = videoUrl.match(regex);
  const videoId = match ? match[1] : null;

  return (
    <div className="video-player min-w-80 md:min-w-[600px] lg:min-w-[700px] xl:min-w-[1000px] 2xl:min-w-[1000px]">
      {videoId ? (
        <PlyrComponent
          source={{
            type: "video",
            sources: [
              {
                src: videoId,
                provider: "youtube",
              },
            ],
          }}
          options={{
            controls: [
              "play-large", // Add a large play button
              "play", // Play button
              "progress", // Progress bar
              "current-time", // Current time
              "mute", // Mute button
              "volume", // Volume control
              "captions", // Captions/subtitles button
              "settings", // Settings button
              "pip", // Picture-in-picture mode button
              "airplay", // Airplay button
              "fullscreen", // Fullscreen button
            ],
            settings:[
              'quality',
              'speed',
            ],
            quality:{
              default: 1080,
            },
            disableContextMenu: true,
            clickToPlay: true,
            youtube: {
              disableKeyboard: false,
              playsinline: false,
              modestBranding: true,
              cc_load_policy: 0,
              iv_load_policy: 3,
              rel: 0,
              showinfo: 0,
              controls:0
            },
          }}
        />
      ) : (
        <p>Invalid YouTube URL</p>
      )}
    </div>
  );
};

export default VideoPlayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant