Looking for the old docs? Go here

Providers

YouTube

This provider enables playing videos hosted on YouTube via embeds.

This provider is used to embed video content hosted on YouTube via the IFrame API. Out of the box you can enjoy the following benefits over the native embed:

  • Preconnections for 224x faster rendering (using the same technique as lite-youtube-embed).
  • Automatically discovering and loading WebP posters, falling back to JPG.
  • Complete control of loading using load strategies. Lazy by default (only loaded when in view).
  • Autoplay failure detection.
  • No cookies by default for GDPR-compliance.
  • Ugly recommendations popup is hidden when using custom controls.
  • Access to all of Vidstack Player features.
INFO

Refer to the Player component if you’re looking for props, methods, and events.

The following source URLs are supported and used to determine when to load the YouTube provider:

  • youtube/_cMxraX_5RE
  • https://www.youtube.com/watch?v=_cMxraX_5RE
  • https://www.youtube-nocookie.com/watch?v=_cMxraX_5RE
  • https://www.youtube.com/embed/_cMxraX_5RE
  • https://youtu.be/_cMxraX_5RE
    
    
TIP

What is “_cMxraX_5RE”? It’s the ID of the video which can be found in the URL when watching a video on YouTube (e.g., https://www.youtube.com/watch?v={VIDEO_ID_HERE}).

You can configure specific embed options on the provider like so:

    
    

Previous