Skip to content

[Bug] Docs video doesn’t autoplay in “Watch & Learn” section #640

@error9098x

Description

@error9098x

Bug Report

Describe the bug

The YouTube video in the docs does not autoplay when it becomes visible. The iframe uses an autoPlay attribute (ignored by YouTube) and the embed URL lacks the required params. Most browsers only allow autoplay when muted.

  • Affected file: next-cloudinary/docs/components/Video/Video.js
  • Affected page: /cldimage/basic-usage → “Watch & Learn” section

Is this a regression?

No

Steps To Reproduce the error

  1. Run the docs app: cd next-cloudinary/docs && pnpm dev
  2. Visit http://localhost:3000/cldimage/basic-usage
  3. Scroll to “Watch & Learn”
  4. Observe the video does not autoplay

Expected behaviour

The video should autoplay once it becomes visible (muted to satisfy browser policies).

Screenshot or Video Recording

Image

Suggested fix

  • Add autoplay=1, mute=1, and playsinline=1 to the YouTube embed URL.
  • Remove the ineffective autoPlay attribute on the iframe element.

Proposed change:

--- a/next-cloudinary/docs/components/Video/Video.js
+++ b/next-cloudinary/docs/components/Video/Video.js
@@ -56,13 +56,12 @@ export const Video = ({
         >
           <iframe
             title={title}
             width={width}
             height={height}
-            src={`https://www.youtube.com/embed/${videoId}?feature=oembed`}
+            src={`https://www.youtube.com/embed/${videoId}?feature=oembed&autoplay=1&mute=1&playsinline=1`}
             frameBorder="0"
             allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
             allowFullScreen
-            autoPlay
           />
         </div>
       ) : (

Your environment

  • OS: macOS
  • Node: 18/20
  • Package manager: pnpm
  • Browser: Chrome/Edge/Safari (desktop and mobile)

Additional context

YouTube ignores autoPlay HTML attribute on iframes; autoplay must be requested via URL parameters and typically requires the video to be muted for autoplay to be allowed by modern browser policies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions