To embed a YouTube playlist, use an iframe URL with listType=playlist and your playlist ID in list. To start at a particular playlist item, use YouTube’s IFrame Player API: its playlist index is zero-based, so the third item is index 2. The iframe’s start parameter is different—it seeks to a time within the selected video.
Choose the right method
A plain iframe is the simplest choice when you want to show a playlist and let visitors choose what to watch. Use the IFrame Player API when the page must load or cue a specific item by its position in that playlist, or when you need JavaScript controls.
As an Amazon Associate I earn from qualifying purchases.
| Need | Use |
|---|---|
| Embed a playlist without selecting a particular item by position | Iframe URL parameters: listType=playlist and list=PLAYLIST_ID |
| Start at a particular playlist position or control playback with JavaScript | IFrame Player API, using index or playVideoAt(index) |
| Seek into a video that is already selected | The iframe’s start parameter or the API’s startSeconds option |
Embed a YouTube playlist with an iframe
1. Get the playlist ID
Replace PLAYLIST_ID in the example below with the ID of the playlist you want to embed. YouTube’s documented playlist format uses listType=playlist together with list; it does not require a video ID in the URL path.
2. Add the iframe to your page
<iframe
width="640"
height="360"
src="https://www.youtube.com/embed?listType=playlist&list=PLAYLIST_ID"
title="YouTube playlist player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen>
</iframe>
The & shown in the HTML source represents an ampersand in an HTML attribute. If you construct the URL in JavaScript, use a normal & between URL parameters or build the query with URLSearchParams.
#1 Best Overall
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
- CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
- CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
- CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)
3. Size the player for the page
YouTube requires an embedded player viewport of at least 200 × 200 pixels. For a 16:9 player with controls, YouTube recommends at least 480 × 270 pixels. The example’s 640 × 360 dimensions meet that recommendation; adjust them to fit the layout without dropping below the minimum.
Start with a particular playlist item
The documented iframe parameters load a playlist but do not provide an arbitrary playlist-position parameter. To begin at a selected item, use the IFrame Player API and pass the item’s zero-based position to loadPlaylist or cuePlaylist.
Load and play the selected item
After creating a YT.Player instance named player, call:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Rank #2
- Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz
- 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
- 2 × USB 3. 0 ports, 2 x USB 2. 0 Ports
- 2 × micro HDMI ports supproting up to 4Kp60 video resolution
- Micro SD card slot for loading operating system and data storage
player.loadPlaylist({
listType: 'playlist',
list: 'PLAYLIST_ID',
index: 2
});
Here, index: 2 selects the third item. Indexing starts at zero: 0 is the first item, 1 the second, and 2 the third. If your page has a visitor-facing selector numbered from one, convert that number to a zero-based index before passing it to the API.
Queue the selected item without immediately playing
Use cuePlaylist with the same playlist and index when you want to prepare the playlist without immediately requesting playback:
player.cuePlaylist({
listType: 'playlist',
list: 'PLAYLIST_ID',
index: 2
});
Then call player.playVideo() when playback should begin. Once a playlist is loaded or cued, player.playVideoAt(index) can load and play a different item at that zero-based position.
Rank #3
- Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
- 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
- 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE Gigabit Ethernet
- 2 USB 3.0 ports; 2 USB 2.0 ports.
- Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
Connect API control to your site
The IFrame Player API lets a page control the embedded player with JavaScript. If you enable JavaScript API control on the iframe with enablejsapi=1, YouTube recommends setting the origin parameter to your website’s domain as an additional security measure. Use your actual site origin, such as its scheme and hostname, rather than a placeholder.
Start at a time within the selected video
Use start when the player should seek to a number of seconds from the beginning of the currently loaded video. With API playlist loading, startSeconds sets the time offset for the first video selected in the list. Neither parameter chooses a playlist item; select that item separately with the API’s index or playVideoAt(index).
A requested seek time is not guaranteed to land on that exact instant: YouTube says the player seeks to a nearby keyframe, so playback may begin slightly before the requested second.
Rank #4
- Vilros Complete Starter Kit for Pi 4 Includes Raspberry Pi 4 Model B Board and all the accessories you need to get started.
- 9-PART KIT WILL HAVE YOU READY TO GET UP AND RUNNING: Kit Includes 1. Raspberry Pi 4 Model B Board 2. Case With Easy to connect Built-in fan 3. 64GB Micro SD card Preloaded with RP OS 4. Vilros Pi 4 Compatible Power Supply with Inline on/off switch (power supply color may vary white/black) 5. Micro HDMI to Standard HDMI cable (5ft) 6. Micro SD to USB adapter to reflash card if desired 7. Neoprene Storage Bag to store all parts when not in use 8. Set of 4 Heatsinks 9. Vilros QuickStart Guide instruction booklet for Pi 4
- PASSIVE & ACTIVE COOLING: The included case is well-vented and the kit also includes a set of heatsinks with thermal stickers for easy application and a pre-installed fan to keep the board cool in any use.
- CONVENIENT ACCESSORIES: The power supply features an inline on/off switch neoprene bag that holds and protects all the parts when not in use and the QuickStart guide is updated and written for Raspberry Pi 4.
- IMPORTANT: Kit does NOT include Keyboard, Mouse or Monitor
Playback and visitor experience
- Autoplay: YouTube documents
autoplay=1as starting the initial video automatically. Enable it only if that behavior is intended; YouTube says playback data collection and sharing occur upon page load when autoplay is enabled. - Playlist position: Make the zero-based index clear wherever a visitor or site editor chooses an item. A human-friendly choice labeled “third video” must be sent as index
2. - Player space: Check the rendered viewport on the page, not just the dimensions in the iframe markup, especially in responsive layouts.
Troubleshooting
The playlist does not appear
Check that the playlist ID is correct and that the iframe URL includes both listType=playlist and list. The documented URL format does not need a video ID in the path.
The wrong item plays
Check whether the code is using a one-based number where the API expects a zero-based index. For example, the third item uses index: 2, not index: 3. Also confirm that the chosen position exists in the playlist being loaded.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →The player starts at the wrong point
Check whether you meant to choose a playlist item or a timestamp within a video. Use the API’s playlist index to select the item; use start or startSeconds for its time offset. A keyframe-aligned seek may start slightly before the requested time.
Best Value
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- CanaKit 3.5A USB-C Power Supply with Noise Filter (UL Listed) specially designed for the Raspberry Pi 4 (5-foot cable)
- CanaKit USB-C PiSwitch (On/Off Power Switch)
- Set of 3 Aluminum Heat Sinks for the Raspberry Pi 4
API control does not work as expected
When using JavaScript API control, check that the iframe enables it with enablejsapi=1 and that origin matches your website’s domain. Also verify that the player instance has been created before calling its playlist methods.
The embed is too small or autoplay surprises visitors
Ensure the displayed viewport is at least 200 × 200 pixels; for a 16:9 player with controls, use YouTube’s recommended minimum of 480 × 270 pixels. Remove autoplay=1 if visitors should start playback themselves.
Or let it run in the cloud
Embedding a playlist displays YouTube videos on your website. If instead you want uploaded videos to keep a YouTube channel live around the clock, StreamNeo is a separate cloud service: upload a recording or build a playlist, add your YouTube stream key, and go live. It does not create a website embed or stream from a camera.
Quick Recap
- Your computer and home connection do not have to stay on.
- Videos stream as uploaded, up to 4K 60fps, for one flat price per slot.
- StreamNeo automatically recovers if YouTube drops the stream.
- The first day is free with no card; the monthly price is $9.99 per month.
Learn more at StreamNeo, or start your free day.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




